Compare commits

..

No commits in common. "1dfcadc8a3e30e7a7c037e29e4b9489383114a6c" and "9ae4b740e1d1fa845adb244658d6130997456e8a" have entirely different histories.

34 changed files with 180 additions and 431 deletions

View file

@ -43,11 +43,9 @@
"@sveltejs/vite-plugin-svelte": "^3.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0",
"@tabler/icons-webfont": "^2.47.0", "@tabler/icons-webfont": "^2.47.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"i18next": "^23.10.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"svelte": "^4.2.7", "svelte": "^4.2.7",
"svelte-i18next": "^2.2.2",
"tslib": "^2.4.1", "tslib": "^2.4.1",
"typescript": "^5.0.0", "typescript": "^5.0.0",
"vite": "^5.0.3" "vite": "^5.0.3"

View file

@ -26,9 +26,6 @@ dependencies:
debug: debug:
specifier: ^4.3.4 specifier: ^4.3.4
version: 4.3.4 version: 4.3.4
i18next:
specifier: ^23.10.0
version: 23.10.0
lodash: lodash:
specifier: ^4.17.21 specifier: ^4.17.21
version: 4.17.21 version: 4.17.21
@ -38,9 +35,6 @@ dependencies:
svelte: svelte:
specifier: ^4.2.7 specifier: ^4.2.7
version: 4.2.9 version: 4.2.9
svelte-i18next:
specifier: ^2.2.2
version: 2.2.2(i18next@23.10.0)(svelte@4.2.9)
tslib: tslib:
specifier: ^2.4.1 specifier: ^2.4.1
version: 2.6.2 version: 2.6.2
@ -145,6 +139,7 @@ packages:
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
dependencies: dependencies:
regenerator-runtime: 0.14.1 regenerator-runtime: 0.14.1
dev: true
/@esbuild/aix-ppc64@0.19.12: /@esbuild/aix-ppc64@0.19.12:
resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==}
@ -1807,12 +1802,6 @@ packages:
- supports-color - supports-color
dev: true dev: true
/i18next@23.10.0:
resolution: {integrity: sha512-/TgHOqsa7/9abUKJjdPeydoyDc0oTi/7u9F8lMSj6ufg4cbC1Oj3f/Jja7zj7WRIhEQKB7Q4eN6y68I9RDxxGQ==}
dependencies:
'@babel/runtime': 7.23.9
dev: false
/ieee754@1.2.1: /ieee754@1.2.1:
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
dev: true dev: true
@ -2407,6 +2396,7 @@ packages:
/regenerator-runtime@0.14.1: /regenerator-runtime@0.14.1:
resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==}
dev: true
/require-directory@2.1.1: /require-directory@2.1.1:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
@ -2693,16 +2683,6 @@ packages:
svelte: 4.2.9 svelte: 4.2.9
dev: false dev: false
/svelte-i18next@2.2.2(i18next@23.10.0)(svelte@4.2.9):
resolution: {integrity: sha512-IpJDZCH5cCgKfHQHgiLmGT4j9HCdg4fqsP3oP2deLu8PxmNj0Ui6khMiDoxAxedAiYEhr0xendv2xqh3Rq+uQQ==}
peerDependencies:
i18next: '*'
svelte: '*'
dependencies:
i18next: 23.10.0
svelte: 4.2.9
dev: false
/svelte-preprocess@5.1.3(postcss@8.4.33)(svelte@4.2.9)(typescript@5.3.3): /svelte-preprocess@5.1.3(postcss@8.4.33)(svelte@4.2.9)(typescript@5.3.3):
resolution: {integrity: sha512-xxAkmxGHT+J/GourS5mVJeOXZzne1FR5ljeOUAMXUkfEhkLEllRreXpbl3dIYJlcJRfL1LO1uIAPpBpBfiqGPw==} resolution: {integrity: sha512-xxAkmxGHT+J/GourS5mVJeOXZzne1FR5ljeOUAMXUkfEhkLEllRreXpbl3dIYJlcJRfL1LO1uIAPpBpBfiqGPw==}
engines: {node: '>= 16.0.0', pnpm: ^8.0.0} engines: {node: '>= 16.0.0', pnpm: ^8.0.0}

View file

@ -38,23 +38,6 @@ button, .button {
background: black; background: black;
color: white; color: white;
&:disabled {
opacity: 0.7;
}
}
input[type="number"] {
background: transparent;
color: white;
border: 1px solid white;
border-radius: 4px;
padding: 0.2em;
&:disabled {
opacity: 0.7;
pointer-events: none;
}
} }
select { select {

View file

@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
import { i18n } from '$lib/i18n';
let screenResolution = '... x ...'; let screenResolution = '... x ...';
let windowResolution = ''; let windowResolution = '';
@ -25,11 +24,11 @@
<div class="info"> <div class="info">
<div class="resolution"> <div class="resolution">
<div class="title">{$i18n.t('Screen Resolution')}</div> <div class="title">Screen Resolution</div>
<div class="value">{screenResolution}</div> <div class="value">{screenResolution}</div>
{#if windowResolution && windowResolution !== screenResolution} {#if windowResolution && windowResolution !== screenResolution}
<div class="window" transition:fade> <div class="window" transition:fade>
<div class="title">{$i18n.t('Window Resolution')}</div> <div class="title">Window Resolution</div>
<div class="value">{windowResolution}</div> <div class="value">{windowResolution}</div>
</div> </div>
{/if} {/if}

22
src/lib/Spinner.svelte Normal file
View file

@ -0,0 +1,22 @@
<script>
import { IconSpiral } from '@tabler/icons-svelte';
export let size = 32;
</script>
<div class="spinner"><IconSpiral {size} class="spinner-icon" /></div>
<style>
.spinner {
text-align: center;
}
:global(.spinner-icon) {
animation: spin 1s linear infinite;
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
</style>

View file

@ -7,7 +7,7 @@
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher<{ focus: void }>(); const dispatch = createEventDispatcher<{ focus: void }>();
export let bg = false; export let full = false;
let sizes = { let sizes = {
blockSize: 64, blockSize: 64,
@ -28,7 +28,7 @@
<!-- svelte-ignore a11y-no-static-element-interactions --> <!-- svelte-ignore a11y-no-static-element-interactions -->
<div <div
class="test-card" class="test-card"
class:bg class:full
style="--block-size: {sizes.blockSize}px; style="--block-size: {sizes.blockSize}px;
--horizontal-margin: {sizes.horizontalMargin}px; --horizontal-margin: {sizes.horizontalMargin}px;
--vertical-margin: {sizes.verticalMargin}px; --vertical-margin: {sizes.verticalMargin}px;
@ -38,7 +38,7 @@
--left-column: {leftColumn};" --left-column: {leftColumn};"
on:dblclick={() => dispatch('focus') && document.body.requestFullscreen()} on:dblclick={() => dispatch('focus') && document.body.requestFullscreen()}
> >
<BackgroundGrid on:change={(ev) => (sizes = ev.detail)} subdued={bg} /> <BackgroundGrid on:change={(ev) => (sizes = ev.detail)} subdued={!full} />
<div class="axes"> <div class="axes">
<Axes /> <Axes />
@ -141,7 +141,7 @@
} }
} }
.test-card.bg { .test-card:not(.full) {
& .info, & .info,
& .column, & .column,
& .axes, & .axes,

View file

@ -1,8 +0,0 @@
import i18next from 'i18next';
import { createI18nStore } from 'svelte-i18next';
i18next.init({
lng: 'en'
});
export const i18n = createI18nStore(i18next);

View file

@ -1,5 +0,0 @@
<script>
import TestCard from '$lib/TestCard.svelte';
</script>
<TestCard />

View file

@ -1,116 +0,0 @@
<script lang="ts">
import TestCard from '$lib/TestCard.svelte';
let x = -1;
let y = -1;
let leftButton = false;
let rightButton = false;
function onMouseMove(ev: MouseEvent) {
x = ev.x;
y = ev.y;
}
function onMouseDown(ev: MouseEvent) {
if (ev.button === 0) {
leftButton = true;
} else if (ev.button === 2) {
rightButton = true;
}
ev.preventDefault();
}
function onMouseUp(ev: MouseEvent) {
if (ev.button === 0) {
leftButton = false;
} else if (ev.button === 2) {
rightButton = false;
}
ev.preventDefault();
}
</script>
<svelte:body
on:mousemove={onMouseMove}
on:mousedown={onMouseDown}
on:mouseup={onMouseUp}
on:contextmenu={(ev) => {
ev.preventDefault();
return false;
}}
/>
<div class="background">
<TestCard bg />
</div>
<div class="indicator" style="--x: {x}px; --y: {y}px">
<div class="x"></div>
<div class="y"></div>
<div class="click left" class:pressed={leftButton}></div>
<div class="click right" class:pressed={rightButton}></div>
</div>
<style>
.background {
opacity: 0.33;
}
.indicator {
position: absolute;
top: 0;
left: 0;
overflow: hidden;
width: 100vw;
height: 100vh;
& .x,
& .y {
position: absolute;
background: white;
}
& .x {
height: 100vh;
width: 1px;
top: 0;
left: var(--x);
}
& .y {
height: 1px;
width: 100vw;
top: var(--y);
left: 0;
}
& .click {
position: absolute;
top: var(--y);
left: var(--x);
transform: translate(-50%, -50%);
width: 3rem;
height: 3rem;
border-radius: 50%;
opacity: 0;
&.left {
background: red;
}
&.right {
background: yellow;
}
&.pressed {
opacity: 0.5;
transition: none;
}
transition: opacity 1s ease-out;
}
}
</style>

View file

@ -1,50 +0,0 @@
<script lang="ts">
import TestCard from '$lib/TestCard.svelte';
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { i18n } from '$lib/i18n';
</script>
<TestCard bg on:focus={() => goto('/card')} />
<main class:sub={!$page.data.root}>
<a href=".." class="button button-back"><i class="ti ti-arrow-back" />{$i18n.t('Back')}</a>
<slot />
</main>
<style>
main {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.8);
border-radius: 0.5rem;
border: 1px solid white;
padding: 1rem;
display: flex;
flex-direction: column;
}
main.sub {
height: 90vh;
width: 90vw;
}
.button-back {
position: absolute;
top: 1rem;
right: 1rem;
opacity: 0.66;
transition: opacity 0.3s;
&:hover {
opacity: 1;
}
}
main:not(.sub) .button-back {
display: none;
}
</style>

View file

@ -1,6 +0,0 @@
<script lang="ts">
import { i18n } from '$lib/i18n';
</script>
<h2><i class="ti ti-volume"></i> {$i18n.t('Audio test')}</h2>
<slot />

View file

@ -1,41 +0,0 @@
<script lang="ts">
import StereoTest from './(channels)/stereo-test.svelte';
import PhaseTest from './phase.svelte';
import { i18n } from '$lib/i18n';
</script>
<article>
<h3>{$i18n.t('Channel tests')}</h3>
<h4>{$i18n.t('Stereo')}</h4>
<section>
<StereoTest />
</section>
<h4>{$i18n.t('Surround audio')}</h4>
<section>
<ul>
<li><a class="button" href="channels-5.1">{$i18n.t('5.1 Surround')}</a></li>
<li><a class="button" href="channels-7.1">{$i18n.t('7.1 Surround')}</a></li>
</ul>
</section>
<h3>{$i18n.t('Phase test')}</h3>
<PhaseTest />
</article>
<style>
h4 {
margin-bottom: 0;
}
ul {
list-style-type: none;
padding: 0;
margin: 0;
display: inline-flex;
gap: 1em;
}
section {
margin: 1em 0;
}
</style>

View file

@ -1,87 +0,0 @@
<script lang="ts">
import { onMount } from 'svelte';
import { i18n } from '$lib/i18n';
let frequency = 60;
let playing = false;
let audioCtx: AudioContext | undefined;
let oscillatorL: OscillatorNode | undefined;
let oscillatorR: OscillatorNode | undefined;
onMount(() => {
audioCtx = new window.AudioContext();
});
function start(mode: 'inPhase' | 'outOfPhase') {
if (!audioCtx) return;
oscillatorL?.stop();
oscillatorR?.stop();
oscillatorL = audioCtx.createOscillator();
oscillatorR = audioCtx.createOscillator();
const gainNode = audioCtx.createGain();
const stereoPannerL = audioCtx.createStereoPanner();
const stereoPannerR = audioCtx.createStereoPanner();
oscillatorL.frequency.setValueAtTime(frequency, audioCtx.currentTime);
oscillatorR.frequency.setValueAtTime(frequency, audioCtx.currentTime);
stereoPannerL.pan.setValueAtTime(-1, audioCtx.currentTime);
stereoPannerR.pan.setValueAtTime(1, audioCtx.currentTime);
oscillatorL.connect(stereoPannerL).connect(audioCtx.destination);
oscillatorR.connect(gainNode).connect(stereoPannerR).connect(audioCtx.destination);
if (mode === 'inPhase') {
gainNode?.gain.setValueAtTime(1, audioCtx.currentTime); // Normal phase
} else {
gainNode?.gain.setValueAtTime(-1, audioCtx.currentTime); // Invert phase
}
oscillatorL?.start();
oscillatorR?.start();
playing = true;
}
async function stop() {
oscillatorL?.stop();
oscillatorR?.stop();
playing = false;
}
</script>
<div class="test">
<label>
{$i18n.t('Frequency')}
<input type="number" bind:value={frequency} min="20" max="20000" disabled={playing} />Hz
</label>
<div class="controls">
<button on:click={() => start('inPhase')}>{$i18n.t('In Phase')}</button>
<button on:click={() => start('outOfPhase')}>{$i18n.t('Out of Phase')}</button>
<button class="stop" on:click={stop} disabled={!playing}>{$i18n.t('Stop')}</button>
</div>
</div>
<style>
.test {
margin: 1em 0;
}
.controls {
margin-top: 0.5em;
}
.stop {
margin-left: 1em;
&:not(:disabled) {
background: darkred;
}
}
input {
width: 5em;
}
</style>

View file

@ -4,7 +4,10 @@
import '@fontsource/b612/700.css'; import '@fontsource/b612/700.css';
import '@tabler/icons-webfont/tabler-icons.css'; import '@tabler/icons-webfont/tabler-icons.css';
import '../index.css'; import '../index.css';
import TestCard from '$lib/TestCard.svelte';
import { page } from '$app/stores';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { goto } from '$app/navigation';
let idleTimeout: NodeJS.Timeout | undefined; let idleTimeout: NodeJS.Timeout | undefined;
onMount(() => { onMount(() => {
@ -16,11 +19,53 @@
}, 3000); }, 3000);
}); });
}); });
$: onlyCard = $page.data.card;
</script> </script>
<TestCard full={onlyCard} on:focus={() => goto('/card')} />
<main class:content={!onlyCard} class:sub={!$page.data.root && !onlyCard}>
<a href=".." class="button button-back"><i class="ti ti-arrow-back" />Back</a>
<slot /> <slot />
</main>
<style> <style>
main.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.8);
border-radius: 0.5rem;
border: 1px solid white;
padding: 1rem;
display: flex;
flex-direction: column;
}
main.sub {
height: 90vh;
width: 90vw;
}
.button-back {
position: absolute;
top: 1rem;
right: 1rem;
opacity: 0.66;
transition: opacity 0.3s;
&:hover {
opacity: 1;
}
}
main:not(.sub) .button-back {
display: none;
}
:global(.hide-idle) { :global(.hide-idle) {
transition: opacity 1s; transition: opacity 1s;
opacity: 1; opacity: 1;

View file

@ -1,47 +1,46 @@
<script> <script>
import { version } from '../../../package.json'; import { version } from '../../package.json';
import { i18n } from '$lib/i18n';
</script> </script>
<nav> <nav>
<h1>Total Tech Test</h1> <h1>Universal Test Card</h1>
<div class="options"> <div class="options">
<a href="card"> <a href="card">
<i class="ti ti-device-desktop"></i> <i class="ti ti-device-desktop"></i>
{$i18n.t('Screen')} Screen
</a> </a>
<a href="audio"> <a href="audio">
<i class="ti ti-volume"></i> <i class="ti ti-volume"></i>
{$i18n.t('Audio')} Audio
</a> </a>
<a href="av-sync"> <a href="av-sync">
<i class="ti ti-time-duration-off"></i> <i class="ti ti-time-duration-off"></i>
{$i18n.t('AV Sync')} AV&nbsp;Sync
</a> </a>
<a href="keyboard"> <a href="keyboard">
<i class="ti ti-keyboard"></i> <i class="ti ti-keyboard"></i>
{$i18n.t('Keyboard')} Keyboard
</a> </a>
<a href="mouse"> <a href="mouse" class="disabled">
<i class="ti ti-mouse"></i> <i class="ti ti-mouse"></i>
{$i18n.t('Mouse')} Mouse
</a> </a>
<a href="gamepad"> <a href="gamepad">
<i class="ti ti-device-gamepad"></i> <i class="ti ti-device-gamepad"></i>
{$i18n.t('Gamepad')} Gamepad
</a> </a>
<a href="camera"> <a href="camera">
<i class="ti ti-camera"></i> <i class="ti ti-camera"></i>
{$i18n.t('Camera')} Camera
</a> </a>
<a href="microphone" class="disabled"> <a href="microphone" class="disabled">
<i class="ti ti-microphone"></i> <i class="ti ti-microphone"></i>
{$i18n.t('Microphone')} Microphone
</a> </a>
<a href="sensors" class="disabled"> <a href="sensors" class="disabled">
<i class="ti ti-cpu-2"></i> <i class="ti ti-cpu-2"></i>
{$i18n.t('Sensors')} Sensors
</a> </a>
</div> </div>
</nav> </nav>
@ -64,7 +63,6 @@
& a { & a {
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
white-space: nowrap;
&.disabled { &.disabled {
pointer-events: none; pointer-events: none;

View file

@ -6,20 +6,19 @@
import rearLeftUrl from '@assets/audio/5.1/Rear_Left.mp3'; import rearLeftUrl from '@assets/audio/5.1/Rear_Left.mp3';
import rearRightUrl from '@assets/audio/5.1/Rear_Right.mp3'; import rearRightUrl from '@assets/audio/5.1/Rear_Right.mp3';
import LfeUrl from '@assets/audio/5.1/LFE_Noise.mp3'; import LfeUrl from '@assets/audio/5.1/LFE_Noise.mp3';
import { i18n } from '$lib/i18n';
</script> </script>
<div class="row"> <div class="row">
<Speaker src={frontLeftUrl} left>{$i18n.t('Front Left')}</Speaker> <Speaker src={frontLeftUrl} left>Front Left</Speaker>
<div class="center"> <div class="center">
<Speaker src={frontCenterUrl} center>{$i18n.t('Front Center')}</Speaker> <Speaker src={frontCenterUrl} center>Front Center</Speaker>
</div> </div>
<Speaker src={frontRightUrl} right>{$i18n.t('Front Right')}</Speaker> <Speaker src={frontRightUrl} right>Front Right</Speaker>
</div> </div>
<div class="row"> <div class="row">
<Speaker src={rearLeftUrl} left>{$i18n.t('Rear Left')}</Speaker> <Speaker src={rearLeftUrl} left>Rear Left</Speaker>
<Speaker src={rearRightUrl} right>{$i18n.t('Rear Right')}</Speaker> <Speaker src={rearRightUrl} right>Rear Right</Speaker>
</div> </div>
<Speaker src={LfeUrl} lfe>{$i18n.t('LFE')}</Speaker> <Speaker src={LfeUrl} lfe>LFE</Speaker>
<div class="label">5.1</div> <div class="label">5.1</div>

View file

@ -8,25 +8,24 @@
import rearLeftUrl from '@assets/audio/7.1/Rear_Left.mp3'; import rearLeftUrl from '@assets/audio/7.1/Rear_Left.mp3';
import rearRightUrl from '@assets/audio/7.1/Rear_Right.mp3'; import rearRightUrl from '@assets/audio/7.1/Rear_Right.mp3';
import LfeUrl from '@assets/audio/7.1/LFE_Noise.mp3'; import LfeUrl from '@assets/audio/7.1/LFE_Noise.mp3';
import { i18n } from '$lib/i18n';
</script> </script>
<div class="row"> <div class="row">
<Speaker src={frontLeftUrl} left>{$i18n.t('Front Left')}</Speaker> <Speaker src={frontLeftUrl} left>Front Left</Speaker>
<div class="center"> <div class="center">
<Speaker src={frontCenterUrl} center>{$i18n.t('Front Center')}</Speaker> <Speaker src={frontCenterUrl} center>Front Center</Speaker>
</div> </div>
<Speaker src={frontRightUrl} right>{$i18n.t('Front Right')}</Speaker> <Speaker src={frontRightUrl} right>Front Right</Speaker>
</div> </div>
<div class="row"> <div class="row">
<Speaker src={sideLeftUrl} left>{$i18n.t('Side Left')}</Speaker> <Speaker src={sideLeftUrl} left>Side Left</Speaker>
<Speaker src={sideRightUrl} right>{$i18n.t('Side Right')}</Speaker> <Speaker src={sideRightUrl} right>Side Right</Speaker>
</div> </div>
<div class="row"> <div class="row">
<Speaker src={rearLeftUrl} left>{$i18n.t('Rear Left')}</Speaker> <Speaker src={rearLeftUrl} left>Rear Left</Speaker>
<Speaker src={rearRightUrl} right>{$i18n.t('Rear Right')}</Speaker> <Speaker src={rearRightUrl} right>Rear Right</Speaker>
</div> </div>
<Speaker src={LfeUrl} lfe>{$i18n.t('LFE')}</Speaker> <Speaker src={LfeUrl} lfe>LFE</Speaker>
<div class="label">7.1</div> <div class="label">7.1</div>

View file

@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import { onDestroy } from 'svelte'; import { onDestroy } from 'svelte';
import { i18n } from '$lib/i18n';
export let element: HTMLElement; export let element: HTMLElement;
@ -47,8 +46,8 @@
<button on:click={onClick}> <button on:click={onClick}>
<i class="ti ti-refresh"></i> <i class="ti ti-refresh"></i>
{#if cycling} {#if cycling}
{$i18n.t('Stop Cycling')} Stop Cycling
{:else} {:else}
{$i18n.t('Cycle through')} Cycle through
{/if} {/if}
</button> </button>

View file

@ -4,16 +4,15 @@
import rightUrl from '@assets/audio/stereo/Right.mp3'; import rightUrl from '@assets/audio/stereo/Right.mp3';
import Speaker from './speaker.svelte'; import Speaker from './speaker.svelte';
import CycleButton from './cycle-button.svelte'; import CycleButton from './cycle-button.svelte';
import { i18n } from '$lib/i18n';
let speakersEl: HTMLElement; let speakersEl: HTMLElement;
</script> </script>
<div class="test"> <div class="test">
<div class="speakers" bind:this={speakersEl}> <div class="speakers" bind:this={speakersEl}>
<Speaker src={leftUrl} left inline>{$i18n.t('Left')}</Speaker> <Speaker src={leftUrl} left inline>Left</Speaker>
<Speaker src={centerUrl} center inline>{$i18n.t('Center')}</Speaker> <Speaker src={centerUrl} center inline>Center</Speaker>
<Speaker src={rightUrl} right inline>{$i18n.t('Right')}</Speaker> <Speaker src={rightUrl} right inline>Right</Speaker>
</div> </div>
<CycleButton element={speakersEl} /> <CycleButton element={speakersEl} />
</div> </div>

View file

@ -0,0 +1,5 @@
<script lang="ts">
</script>
<h2><i class="ti ti-volume"></i> Audio test</h2>
<slot />

View file

@ -0,0 +1,37 @@
<script lang="ts">
import StereoTest from './(channels)/stereo-test.svelte';
</script>
<article>
<h3>Channel tests</h3>
<h4>Stereo</h4>
<section>
<StereoTest />
</section>
<h4>Surround audio</h4>
<section>
<ul>
<li><a class="button" href="channels-5.1">5.1 Surround</a></li>
<li><a class="button" href="channels-7.1">7.1 Surround</a></li>
</ul>
</section>
</article>
<style>
h4 {
margin-bottom: 0;
}
ul {
list-style-type: none;
padding: 0;
margin: 0;
display: inline-flex;
gap: 1em;
}
section {
margin: 1em 0;
}
</style>

View file

@ -1,10 +1,9 @@
<script lang="ts"> <script lang="ts">
import videoUrl from '@assets/avsync.webm'; import videoUrl from '@assets/avsync.webm';
import { i18n } from '$lib/i18n';
let paused = true; let paused = true;
</script> </script>
<h2><i class="ti ti-time-duration-off"></i> {$i18n.t('Audio/Video Synchronization')}</h2> <h2><i class="ti ti-time-duration-off"></i> Audio/Video Synchronization</h2>
<!-- svelte-ignore a11y-media-has-caption --> <!-- svelte-ignore a11y-media-has-caption -->
<video <video
class:playing={!paused} class:playing={!paused}

View file

@ -2,7 +2,6 @@
import { onDestroy, onMount } from 'svelte'; import { onDestroy, onMount } from 'svelte';
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import debug from 'debug'; import debug from 'debug';
import { i18n } from '$lib/i18n';
const dbg = debug('app:camera'); const dbg = debug('app:camera');
let video: HTMLVideoElement; let video: HTMLVideoElement;
@ -79,26 +78,26 @@
} }
</script> </script>
<h2><i class="ti ti-camera"></i> {$i18n.t('Camera test')}</h2> <h2><i class="ti ti-camera"></i> Camera test</h2>
<div class="controls"> <div class="controls">
<label> <label>
{$i18n.t('Device')} Device
<select bind:value={currentDevice} disabled={!devices.length}> <select bind:value={currentDevice} disabled={!devices.length}>
{#each devices as device} {#each devices as device}
<option value={device.deviceId}>{device.label || '???'}</option> <option value={device.deviceId}>{device.label || '???'}</option>
{:else} {:else}
<option>{$i18n.t('No camera found')}</option> <option>No camera found</option>
{/each} {/each}
</select> </select>
</label> </label>
<button on:click={refreshDevices}> <button on:click={refreshDevices}>
<i class="ti ti-refresh"></i> <i class="ti ti-refresh"></i>
{$i18n.t('Refresh')} Refresh
</button> </button>
<div class="separator"></div> <div class="separator"></div>
<label> <label>
{$i18n.t('Resolution')} Resolution
<select bind:value={requestResolution}> <select bind:value={requestResolution}>
<option value="auto">Auto</option> <option value="auto">Auto</option>
<option value={[4096, 2160]}>4096x2160</option> <option value={[4096, 2160]}>4096x2160</option>
@ -110,7 +109,7 @@
</select> </select>
</label> </label>
<label> <label>
{$i18n.t('Frame rate')} Frame rate
<select bind:value={requestFramerate}> <select bind:value={requestFramerate}>
<option value="auto">Auto</option> <option value="auto">Auto</option>
<option value={120}>120 fps</option> <option value={120}>120 fps</option>
@ -136,29 +135,29 @@
<footer> <footer>
{#if !currentDevice} {#if !currentDevice}
<span class="subdued">{$i18n.t('No camera selected')}</span> <span class="subdued">No camera selected</span>
{:else} {:else}
<ul> <ul>
{#key currentDevice} {#key currentDevice}
<li> <li>
{$i18n.t('Resolution')}: <strong>{deviceInfo.resolution || '???'}</strong> Resolution: <strong>{deviceInfo.resolution || '???'}</strong>
</li> </li>
<li> <li>
{$i18n.t('Frame rate')}: <strong>{deviceInfo.frameRate || '???'}</strong> Frame rate: <strong>{deviceInfo.frameRate || '???'}</strong>
</li> </li>
{/key} {/key}
</ul> </ul>
<div class="controls"> <div class="controls">
<button on:click={takeSnapshot}> <button on:click={takeSnapshot}>
<i class="ti ti-camera"></i> <i class="ti ti-camera"></i>
{$i18n.t('Take picture')} Take picture
</button> </button>
<button on:click={() => (flipped = !flipped)}> <button on:click={() => (flipped = !flipped)}>
<i class="ti ti-flip-vertical"></i> <i class="ti ti-flip-vertical"></i>
{#if flipped} {#if flipped}
{$i18n.t('Unflip image')} Unflip image
{:else} {:else}
{$i18n.t('Flip image')} Flip image
{/if} {/if}
</button> </button>
</div> </div>

View file

@ -1,9 +1,7 @@
<script> <script>
import { i18n } from '$lib/i18n';
</script> </script>
<a href="/" class="hide-idle"><i class="ti ti-arrow-back"></i> {$i18n.t('Back')}</a> <a href="/" class="hide-idle"><i class="ti ti-arrow-back"></i> Back</a>
<slot />
<style> <style>
a { a {
@ -23,7 +21,5 @@
align-items: center; align-items: center;
text-decoration: none; text-decoration: none;
z-index: 99;
} }
</style> </style>

7
src/routes/card/+page.ts Normal file
View file

@ -0,0 +1,7 @@
import type { PageLoad } from './$types';
export const load: PageLoad = () => {
return {
card: true
};
};

View file

@ -2,7 +2,6 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { browser } from '$app/environment'; import { browser } from '$app/environment';
import debug from 'debug'; import debug from 'debug';
import { i18n } from '$lib/i18n';
const dbg = debug('app:camera'); const dbg = debug('app:camera');
@ -93,27 +92,27 @@
}); });
</script> </script>
<h2><i class="ti ti-device-gamepad"></i> {$i18n.t('Gamepad & Joystick Tests')}</h2> <h2><i class="ti ti-device-gamepad"></i> Gamepad & Joystick Tests</h2>
<div class="controls"> <div class="controls">
<label> <label>
{$i18n.t('Device')} Device
<select disabled={!gamepads.length}> <select disabled={!gamepads.length}>
{#each gamepads as gamepad} {#each gamepads as gamepad}
<option value={gamepad.index}>{gamepad.id}</option> <option value={gamepad.index}>{gamepad.id}</option>
{:else} {:else}
<option>{$i18n.t('No gamepads detected. (Try pressing a button)')}</option> <option>No gamepads detected. (Try pressing a button)</option>
{/each} {/each}
</select> </select>
</label> </label>
<button on:click={refreshGamepads}> <button on:click={refreshGamepads}>
<i class="ti ti-refresh"></i> <i class="ti ti-refresh"></i>
{$i18n.t('Refresh')} Refresh
</button> </button>
</div> </div>
{#if currentGamepad} {#if currentGamepad}
<section> <section>
<h3>{$i18n.t('Buttons')}</h3> <h3>Buttons</h3>
<ul class="buttons"> <ul class="buttons">
{#each buttons as button, i} {#each buttons as button, i}
<li class:pressed={button.pressed}>{i}</li> <li class:pressed={button.pressed}>{i}</li>
@ -121,7 +120,7 @@
</ul> </ul>
</section> </section>
<section> <section>
<h3>{$i18n.t('Axes')}</h3> <h3>Axes</h3>
<div class="axes"> <div class="axes">
{#each axes as axis, i (i)} {#each axes as axis, i (i)}
<div class="axis"> <div class="axis">
@ -131,7 +130,7 @@
<span>{axis.toFixed(2)}</span> <span>{axis.toFixed(2)}</span>
</div> </div>
<details> <details>
<summary>{$i18n.t('History')}</summary> <summary>History</summary>
<canvas width="512" height="128" data-axis={i}></canvas> <canvas width="512" height="128" data-axis={i}></canvas>
</details> </details>
</div> </div>

View file

@ -1,6 +1,5 @@
<script lang="ts"> <script lang="ts">
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { i18n } from '$lib/i18n';
let key: string; let key: string;
let code: string; let code: string;
@ -15,8 +14,8 @@
}); });
</script> </script>
<h2>{$i18n.t('Keyboard testing')}</h2> <h2>Keyboard testing</h2>
<p>{$i18n.t('Press a key on the keyboard to see the event object and the key code.')}</p> <p>Press a key on the keyboard to see the event object and the key code.</p>
<div class="current"> <div class="current">
{#if key} {#if key}
<span>{key}</span> <span>{key}</span>
@ -26,7 +25,7 @@
{/if} {/if}
</div> </div>
<p>{$i18n.t('Pressed keys:')}</p> <p>Pressed keys:</p>
<ul> <ul>
{#each pressedKeys as key} {#each pressedKeys as key}
<li>{key}</li> <li>{key}</li>

View file

View file