@viamrobotics/test-widgets 0.16.0 → 0.17.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.
- package/dist/components/api-section.svelte +58 -50
- package/dist/components/api-section.svelte.d.ts +24 -11
- package/dist/components/content-rect.svelte +6 -0
- package/dist/components/content-rect.svelte.d.ts +1 -0
- package/dist/components/error.svelte +9 -0
- package/dist/components/error.svelte.d.ts +6 -0
- package/dist/components/index.d.ts +4 -2
- package/dist/components/index.js +4 -2
- package/dist/components/is-moving.svelte +26 -34
- package/dist/components/is-moving.svelte.d.ts +4 -5
- package/dist/components/progress.svelte +1 -0
- package/dist/components/queries.svelte +7 -0
- package/dist/components/queries.svelte.d.ts +4 -0
- package/dist/components/query.svelte +7 -0
- package/dist/components/query.svelte.d.ts +4 -0
- package/dist/components/section/index.d.ts +2 -0
- package/dist/components/section/index.js +2 -0
- package/dist/components/section/section-error-reporter.d.ts +8 -0
- package/dist/components/section/section-error-reporter.js +7 -0
- package/dist/components/section/section-error.svelte +36 -0
- package/dist/components/section/section-error.svelte.d.ts +9 -0
- package/dist/components/section/section-errors.svelte +132 -5
- package/dist/components/section/section.svelte +7 -1
- package/dist/components/section/section.svelte.d.ts +3 -0
- package/dist/components/section/use-section-errors.svelte.d.ts +1 -0
- package/dist/components/section/use-section-errors.svelte.js +11 -1
- package/dist/components/stop-button.svelte +1 -5
- package/dist/components/stop-button.svelte.d.ts +0 -1
- package/dist/components/stop.svelte +2 -2
- package/dist/components/widgets/arm/arm.svelte +24 -32
- package/dist/components/widgets/arm/get-joint-positions-widget.svelte +9 -8
- package/dist/components/widgets/arm/manual-mode-widget.svelte +13 -4
- package/dist/components/widgets/arm/manual-mode.svelte +1 -5
- package/dist/components/widgets/arm/manual-mode.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +10 -4
- package/dist/components/widgets/arm/move-to-joint-positions.svelte +1 -11
- package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/move-to-position-control.svelte +22 -18
- package/dist/components/widgets/arm/move-to-position.svelte +0 -4
- package/dist/components/widgets/arm/move-to-position.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/quick-move-widget.svelte +10 -4
- package/dist/components/widgets/arm/quick-move.svelte +1 -4
- package/dist/components/widgets/arm/quick-move.svelte.d.ts +0 -1
- package/dist/components/widgets/audio-input/audio-input.svelte +76 -74
- package/dist/components/widgets/audio-input/get-properties-widget.svelte +15 -15
- package/dist/components/widgets/audio-output/audio-output.svelte +83 -81
- package/dist/components/widgets/audio-output/get-properties-widget.svelte +15 -15
- package/dist/components/widgets/base/base.svelte +70 -37
- package/dist/components/widgets/base/move-straight-widget.svelte +16 -4
- package/dist/components/widgets/base/quick-move-widget.svelte +25 -9
- package/dist/components/widgets/base/set-power-widget.svelte +20 -8
- package/dist/components/widgets/base/set-velocity-widget.svelte +20 -8
- package/dist/components/widgets/base/spin-widget.svelte +20 -8
- package/dist/components/widgets/board/read-write-pins.svelte +2 -2
- package/dist/components/widgets/button/push.svelte +2 -2
- package/dist/components/widgets/camera/camera.svelte +15 -23
- package/dist/components/widgets/camera/live-or-polling-video.svelte +12 -9
- package/dist/components/widgets/custom-control/__tests__/__fixtures__/with-sibling.svelte +10 -0
- package/dist/components/widgets/custom-control/control-frame.svelte +60 -0
- package/dist/components/widgets/custom-control/control-frame.svelte.d.ts +10 -0
- package/dist/components/widgets/custom-control/create-control-host.svelte.d.ts +19 -0
- package/dist/components/widgets/custom-control/create-control-host.svelte.js +26 -0
- package/dist/components/widgets/custom-control/custom-control.d.ts +35 -0
- package/dist/components/widgets/custom-control/custom-control.js +85 -0
- package/dist/components/widgets/custom-control/custom-control.svelte +45 -0
- package/dist/components/widgets/custom-control/custom-control.svelte.d.ts +14 -0
- package/dist/components/widgets/discovery/discovery.svelte +10 -15
- package/dist/components/widgets/encoder/encoder.svelte +20 -18
- package/dist/components/widgets/encoder/get-position-widget.svelte +18 -15
- package/dist/components/widgets/gantry/gantry.svelte +50 -74
- package/dist/components/widgets/gantry/get-position-widget.svelte +14 -13
- package/dist/components/widgets/gantry/home.svelte +21 -10
- package/dist/components/widgets/gantry/move-to-position-widget.svelte +2 -1
- package/dist/components/widgets/gantry/move-to-position.svelte +1 -4
- package/dist/components/widgets/gantry/move-to-position.svelte.d.ts +0 -1
- package/dist/components/widgets/gantry/quick-move-widget.svelte +2 -1
- package/dist/components/widgets/gantry/quick-move.svelte +1 -5
- package/dist/components/widgets/gantry/quick-move.svelte.d.ts +0 -1
- package/dist/components/widgets/generic/generic.svelte +7 -5
- package/dist/components/widgets/gripper/grab-widget.svelte +26 -0
- package/dist/components/widgets/gripper/grab-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/grab.svelte +3 -19
- package/dist/components/widgets/gripper/grab.svelte.d.ts +1 -2
- package/dist/components/widgets/gripper/gripper.svelte +10 -12
- package/dist/components/widgets/gripper/is-holding-something.svelte +18 -19
- package/dist/components/widgets/gripper/open-widget.svelte +26 -0
- package/dist/components/widgets/gripper/open-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/open.svelte +3 -19
- package/dist/components/widgets/gripper/open.svelte.d.ts +1 -2
- package/dist/components/widgets/input-controller/input-controller.svelte +7 -14
- package/dist/components/widgets/input-controller/webgamepad.svelte +2 -2
- package/dist/components/widgets/motion/motion.svelte +27 -35
- package/dist/components/widgets/motion/move-widget.svelte +32 -12
- package/dist/components/widgets/motion/move-widget.svelte.d.ts +6 -0
- package/dist/components/widgets/motion/move.svelte +1 -13
- package/dist/components/widgets/motion/move.svelte.d.ts +0 -1
- package/dist/components/widgets/motor/go-for-view.svelte +16 -8
- package/dist/components/widgets/motor/go-to-view.svelte +12 -4
- package/dist/components/widgets/motor/motor.svelte +88 -54
- package/dist/components/widgets/motor/quick-move-widget.svelte +16 -8
- package/dist/components/widgets/motor/set-power-widget.svelte +12 -4
- package/dist/components/widgets/motor/set-rpm-widget.svelte +12 -4
- package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/get-position-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/movement-sensor.svelte +55 -56
- package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +2 -1
- package/dist/components/widgets/power-sensor/get-current-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/get-power-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/power-sensor.svelte +26 -38
- package/dist/components/widgets/sensor/sensor.svelte +5 -10
- package/dist/components/widgets/servo/move-widget.svelte +2 -1
- package/dist/components/widgets/servo/move.svelte +1 -4
- package/dist/components/widgets/servo/move.svelte.d.ts +0 -1
- package/dist/components/widgets/servo/quick-move-widget.svelte +2 -1
- package/dist/components/widgets/servo/quick-move.svelte +1 -5
- package/dist/components/widgets/servo/quick-move.svelte.d.ts +0 -1
- package/dist/components/widgets/servo/servo.svelte +44 -33
- package/dist/components/widgets/slam/get-position-widget.svelte +7 -10
- package/dist/components/widgets/slam/move-on-map.svelte +6 -5
- package/dist/components/widgets/slam/move-on-map.svelte.d.ts +2 -1
- package/dist/components/widgets/slam/slam.svelte +64 -79
- package/dist/components/widgets/switch/position.svelte +2 -2
- package/package.json +3 -2
- package/dist/components/mutation-section.svelte +0 -75
- package/dist/components/mutation-section.svelte.d.ts +0 -18
- package/dist/components/mutation-view.svelte +0 -29
- package/dist/components/mutation-view.svelte.d.ts +0 -10
- package/dist/components/section-title.svelte +0 -65
- package/dist/components/section-title.svelte.d.ts +0 -15
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
createResourceQuery,
|
|
7
7
|
} from '@viamrobotics/svelte-sdk'
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import ApiSection from '../../api-section.svelte'
|
|
10
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
10
11
|
|
|
11
12
|
import QuickMove from './quick-move.svelte'
|
|
12
13
|
|
|
@@ -34,12 +35,17 @@
|
|
|
34
35
|
}
|
|
35
36
|
</script>
|
|
36
37
|
|
|
37
|
-
<
|
|
38
|
+
<ApiSection
|
|
39
|
+
method="MoveToJointPositions"
|
|
40
|
+
api={ResourceTriplets.Arm}
|
|
41
|
+
queries={[jointPositionsQuery]}
|
|
42
|
+
mutations={[quickMoveToJointPosMutation]}
|
|
43
|
+
class="grow flex-col gap-4"
|
|
44
|
+
>
|
|
38
45
|
{#if jointPositionsQuery.data}
|
|
39
46
|
<QuickMove
|
|
40
47
|
positions={jointPositionsQuery.data.values}
|
|
41
48
|
moveToJointPositions={quickMoveToJointPositions}
|
|
42
|
-
lastError={quickMoveToJointPosMutation.error}
|
|
43
49
|
/>
|
|
44
50
|
{/if}
|
|
45
|
-
</
|
|
51
|
+
</ApiSection>
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Button } from '@viamrobotics/prime-core'
|
|
3
3
|
|
|
4
|
-
import ErrorDisplay from '../../error.svelte'
|
|
5
4
|
import Table from '../../table.svelte'
|
|
6
5
|
|
|
7
6
|
interface Props {
|
|
8
7
|
positions: number[]
|
|
9
8
|
moveToJointPositions: (jointPositions: number[]) => void
|
|
10
|
-
lastError: Error | null
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
const { positions, moveToJointPositions
|
|
11
|
+
const { positions, moveToJointPositions }: Props = $props()
|
|
14
12
|
|
|
15
13
|
const quickMove = (index: number, increment: number) => {
|
|
16
14
|
const clonedPositions = positions.map((position, positionIndex) =>
|
|
@@ -59,4 +57,3 @@
|
|
|
59
57
|
{/each}
|
|
60
58
|
</tbody>
|
|
61
59
|
</Table>
|
|
62
|
-
<ErrorDisplay {lastError} />
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
import ApiSection from '../../api-section.svelte'
|
|
7
7
|
import Properties from '../../audio-properties.svelte'
|
|
8
8
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
9
|
-
import MutationSection from '../../mutation-section.svelte'
|
|
10
|
-
import Query from '../../query.svelte'
|
|
11
9
|
import RefetchController from '../../refetch-controller.svelte'
|
|
12
10
|
import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
|
|
11
|
+
import { Section } from '../../section'
|
|
13
12
|
import { numberValueFromEvent } from '../../../event-handlers'
|
|
14
13
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
15
14
|
|
|
@@ -62,94 +61,97 @@
|
|
|
62
61
|
<div class="@container">
|
|
63
62
|
<div class="flex flex-col divide-y @2xl:flex-row @2xl:divide-x @2xl:divide-y-0">
|
|
64
63
|
<div class="flex w-full flex-col divide-y">
|
|
65
|
-
<
|
|
66
|
-
|
|
64
|
+
<ApiSection
|
|
65
|
+
method="GetAudio"
|
|
67
66
|
api={ResourceTriplets.AudioInput}
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
mutations={[capture]}
|
|
68
|
+
class="flex-row flex-wrap gap-2"
|
|
70
69
|
>
|
|
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
|
-
|
|
70
|
+
{#snippet subheading()}
|
|
71
|
+
<Section.Text>Capture audio from the device</Section.Text>
|
|
72
|
+
{/snippet}
|
|
73
|
+
<div class="flex grow flex-wrap justify-between gap-2">
|
|
74
|
+
<div class="flex flex-col gap-2">
|
|
75
|
+
<Label cx="gap-1 text-xs">
|
|
76
|
+
Codec
|
|
77
|
+
<Select
|
|
78
|
+
slot="input"
|
|
79
|
+
value={selectedCodec}
|
|
80
|
+
on:change={(e) => {
|
|
81
|
+
captureCodec = (e.target as HTMLSelectElement).value
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
{#each availableCodecs as codec (codec)}
|
|
85
|
+
<option value={codec}>{codec}</option>
|
|
86
|
+
{/each}
|
|
87
|
+
</Select>
|
|
88
|
+
</Label>
|
|
89
|
+
<Label cx="gap-1 text-xs">
|
|
90
|
+
Duration (seconds, 0 = stream until stopped)
|
|
91
|
+
<NumericInput
|
|
92
|
+
slot="input"
|
|
93
|
+
value={captureDuration}
|
|
94
|
+
on:change={(e) => {
|
|
95
|
+
captureDuration = numberValueFromEvent(e) ?? 3
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
98
|
+
</Label>
|
|
99
|
+
</div>
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<p class="font-roboto-mono text-subtle-1 text-xs">
|
|
101
|
-
{(capture.totalBytes / 1024).toFixed(1)} kB captured
|
|
102
|
-
</p>
|
|
103
|
-
<Button
|
|
104
|
-
icon="stop-circle-outline"
|
|
105
|
-
onclick={capture.stop}
|
|
106
|
-
>
|
|
107
|
-
Stop
|
|
108
|
-
</Button>
|
|
109
|
-
{:else}
|
|
110
|
-
{#if capture.downloadUrl}
|
|
101
|
+
<div class="mt-auto flex flex-col items-start gap-2">
|
|
102
|
+
{#if capture.status === 'recording'}
|
|
111
103
|
<p class="font-roboto-mono text-subtle-1 text-xs">
|
|
112
104
|
{(capture.totalBytes / 1024).toFixed(1)} kB captured
|
|
113
105
|
</p>
|
|
114
|
-
<
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
rel="external"
|
|
106
|
+
<Button
|
|
107
|
+
icon="stop-circle-outline"
|
|
108
|
+
onclick={capture.stop}
|
|
118
109
|
>
|
|
119
|
-
|
|
120
|
-
</
|
|
110
|
+
Stop
|
|
111
|
+
</Button>
|
|
112
|
+
{:else}
|
|
113
|
+
{#if capture.downloadUrl}
|
|
114
|
+
<p class="font-roboto-mono text-subtle-1 text-xs">
|
|
115
|
+
{(capture.totalBytes / 1024).toFixed(1)} kB captured
|
|
116
|
+
</p>
|
|
117
|
+
<a
|
|
118
|
+
href={capture.downloadUrl}
|
|
119
|
+
download="audio-capture.{selectedCodec}"
|
|
120
|
+
rel="external"
|
|
121
|
+
>
|
|
122
|
+
<Button icon="download">Download</Button>
|
|
123
|
+
</a>
|
|
124
|
+
{/if}
|
|
125
|
+
<Button
|
|
126
|
+
icon="play-circle-outline"
|
|
127
|
+
onclick={() => capture.start(selectedCodec, captureDuration)}
|
|
128
|
+
disabled={!client.current}
|
|
129
|
+
>
|
|
130
|
+
{capture.status === 'done' ? 'Capture Again' : 'Start Capture'}
|
|
131
|
+
</Button>
|
|
121
132
|
{/if}
|
|
122
|
-
|
|
123
|
-
icon="play-circle-outline"
|
|
124
|
-
onclick={() => capture.start(selectedCodec, captureDuration)}
|
|
125
|
-
disabled={!client.current}
|
|
126
|
-
>
|
|
127
|
-
{capture.status === 'done' ? 'Capture Again' : 'Start Capture'}
|
|
128
|
-
</Button>
|
|
129
|
-
{/if}
|
|
133
|
+
</div>
|
|
130
134
|
</div>
|
|
131
|
-
</
|
|
135
|
+
</ApiSection>
|
|
132
136
|
</div>
|
|
133
137
|
|
|
134
138
|
<div class="flex w-full flex-col divide-y @2xl:ml-auto @2xl:max-w-1/2 @4xl:max-w-1/3">
|
|
135
139
|
<ApiSection
|
|
136
|
-
|
|
140
|
+
method="GetProperties"
|
|
137
141
|
api={ResourceTriplets.AudioInput}
|
|
138
|
-
|
|
142
|
+
queries={[propertiesQuery]}
|
|
139
143
|
class="relative grow flex-col gap-4"
|
|
140
144
|
>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
{/if}
|
|
152
|
-
</Query>
|
|
145
|
+
{#snippet subheading()}
|
|
146
|
+
<Section.Text>Audio input properties</Section.Text>
|
|
147
|
+
{/snippet}
|
|
148
|
+
{#if propertiesQuery.data !== undefined}
|
|
149
|
+
<Properties
|
|
150
|
+
supportedCodecs={propertiesQuery.data.supportedCodecs}
|
|
151
|
+
sampleRateHz={propertiesQuery.data.sampleRateHz}
|
|
152
|
+
numChannels={propertiesQuery.data.numChannels}
|
|
153
|
+
/>
|
|
154
|
+
{/if}
|
|
153
155
|
</ApiSection>
|
|
154
156
|
</div>
|
|
155
157
|
</div>
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
6
|
import Properties from '../../audio-properties.svelte'
|
|
7
|
-
import
|
|
7
|
+
import { Section } from '../../section'
|
|
8
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
partID: string
|
|
@@ -23,20 +24,19 @@
|
|
|
23
24
|
</script>
|
|
24
25
|
|
|
25
26
|
<ApiSection
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
method="GetProperties"
|
|
28
|
+
api={ResourceTriplets.AudioInput}
|
|
29
|
+
queries={[query]}
|
|
28
30
|
class="grow flex-col gap-4"
|
|
29
31
|
>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{/if}
|
|
41
|
-
</Query>
|
|
32
|
+
{#snippet subheading()}
|
|
33
|
+
<Section.Text>Audio input properties</Section.Text>
|
|
34
|
+
{/snippet}
|
|
35
|
+
{#if query.data !== undefined}
|
|
36
|
+
<Properties
|
|
37
|
+
supportedCodecs={query.data.supportedCodecs}
|
|
38
|
+
sampleRateHz={query.data.sampleRateHz}
|
|
39
|
+
numChannels={query.data.numChannels}
|
|
40
|
+
/>
|
|
41
|
+
{/if}
|
|
42
42
|
</ApiSection>
|
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
import ApiSection from '../../api-section.svelte'
|
|
7
7
|
import Properties from '../../audio-properties.svelte'
|
|
8
8
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
9
|
-
import MutationSection from '../../mutation-section.svelte'
|
|
10
|
-
import Query from '../../query.svelte'
|
|
11
9
|
import RefetchController from '../../refetch-controller.svelte'
|
|
12
10
|
import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
|
|
11
|
+
import { Section } from '../../section'
|
|
13
12
|
import { numberValueFromEvent } from '../../../event-handlers'
|
|
14
13
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
15
14
|
|
|
@@ -107,96 +106,99 @@
|
|
|
107
106
|
<div class="@container">
|
|
108
107
|
<div class="flex flex-col divide-y @2xl:flex-row @2xl:divide-x @2xl:divide-y-0">
|
|
109
108
|
<div class="flex w-full flex-col divide-y">
|
|
110
|
-
<
|
|
111
|
-
|
|
109
|
+
<ApiSection
|
|
110
|
+
method="Play"
|
|
112
111
|
api={ResourceTriplets.AudioOutput}
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
mutations={[playContext]}
|
|
113
|
+
class="flex-row flex-wrap gap-2"
|
|
115
114
|
>
|
|
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
|
-
|
|
115
|
+
{#snippet subheading()}
|
|
116
|
+
<Section.Text>Send audio data to the device</Section.Text>
|
|
117
|
+
{/snippet}
|
|
118
|
+
<div class="flex grow flex-wrap justify-between gap-2">
|
|
119
|
+
<div class="flex flex-col gap-2">
|
|
120
|
+
<Label cx="gap-1 text-xs">
|
|
121
|
+
Audio file
|
|
122
|
+
<input
|
|
123
|
+
slot="input"
|
|
124
|
+
type="file"
|
|
125
|
+
accept={availableCodecs.map((c) => `.${c}`).join(',')}
|
|
126
|
+
class="text-xs"
|
|
127
|
+
onchange={handleFileChange}
|
|
128
|
+
/>
|
|
129
|
+
</Label>
|
|
130
|
+
{#if fileInputError}
|
|
131
|
+
<p class="text-xs text-red-500">{fileInputError}</p>
|
|
132
|
+
{/if}
|
|
133
|
+
{#if selectedFile}
|
|
134
|
+
<p class="font-roboto-mono text-subtle-1 text-xs">{selectedFile.name}</p>
|
|
135
|
+
{/if}
|
|
136
|
+
<Label cx="gap-1 text-xs">
|
|
137
|
+
Codec
|
|
138
|
+
<Select
|
|
139
|
+
slot="input"
|
|
140
|
+
value={selectedCodec}
|
|
141
|
+
on:change={(e) => {
|
|
142
|
+
playCodec = (e.target as HTMLSelectElement).value
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
{#each availableCodecs as codec (codec)}
|
|
146
|
+
<option value={codec}>{codec}</option>
|
|
147
|
+
{/each}
|
|
148
|
+
</Select>
|
|
149
|
+
</Label>
|
|
150
|
+
<Label cx="gap-1 text-xs">
|
|
151
|
+
Sample rate (Hz)
|
|
152
|
+
<NumericInput
|
|
153
|
+
slot="input"
|
|
154
|
+
value={selectedSampleRateHz}
|
|
155
|
+
on:change={(e) => {
|
|
156
|
+
playSampleRateHz = numberValueFromEvent(e) ?? null
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
</Label>
|
|
160
|
+
<Label cx="gap-1 text-xs">
|
|
161
|
+
Channels
|
|
162
|
+
<NumericInput
|
|
163
|
+
slot="input"
|
|
164
|
+
value={selectedNumChannels}
|
|
165
|
+
on:change={(e) => {
|
|
166
|
+
playNumChannels = numberValueFromEvent(e) ?? null
|
|
167
|
+
}}
|
|
168
|
+
/>
|
|
169
|
+
</Label>
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<div class="mt-auto">
|
|
173
|
+
<Button
|
|
174
|
+
icon="play-circle-outline"
|
|
175
|
+
onclick={play}
|
|
176
|
+
disabled={!client.current || playContext.status === 'playing'}
|
|
141
177
|
>
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
</Select>
|
|
146
|
-
</Label>
|
|
147
|
-
<Label cx="gap-1 text-xs">
|
|
148
|
-
Sample rate (Hz)
|
|
149
|
-
<NumericInput
|
|
150
|
-
slot="input"
|
|
151
|
-
value={selectedSampleRateHz}
|
|
152
|
-
on:change={(e) => {
|
|
153
|
-
playSampleRateHz = numberValueFromEvent(e) ?? null
|
|
154
|
-
}}
|
|
155
|
-
/>
|
|
156
|
-
</Label>
|
|
157
|
-
<Label cx="gap-1 text-xs">
|
|
158
|
-
Channels
|
|
159
|
-
<NumericInput
|
|
160
|
-
slot="input"
|
|
161
|
-
value={selectedNumChannels}
|
|
162
|
-
on:change={(e) => {
|
|
163
|
-
playNumChannels = numberValueFromEvent(e) ?? null
|
|
164
|
-
}}
|
|
165
|
-
/>
|
|
166
|
-
</Label>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
<div class="mt-auto">
|
|
170
|
-
<Button
|
|
171
|
-
icon="play-circle-outline"
|
|
172
|
-
onclick={play}
|
|
173
|
-
disabled={!client.current || playContext.status === 'playing'}
|
|
174
|
-
>
|
|
175
|
-
{playButtonLabel}
|
|
176
|
-
</Button>
|
|
178
|
+
{playButtonLabel}
|
|
179
|
+
</Button>
|
|
180
|
+
</div>
|
|
177
181
|
</div>
|
|
178
|
-
</
|
|
182
|
+
</ApiSection>
|
|
179
183
|
</div>
|
|
180
184
|
|
|
181
185
|
<div class="flex w-full flex-col divide-y @2xl:ml-auto @2xl:max-w-1/2 @4xl:max-w-1/3">
|
|
182
186
|
<ApiSection
|
|
183
|
-
|
|
187
|
+
method="GetProperties"
|
|
184
188
|
api={ResourceTriplets.AudioOutput}
|
|
185
|
-
|
|
189
|
+
queries={[propertiesQuery]}
|
|
186
190
|
class="relative grow flex-col gap-4"
|
|
187
191
|
>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
{/if}
|
|
199
|
-
</Query>
|
|
192
|
+
{#snippet subheading()}
|
|
193
|
+
<Section.Text>Audio output properties</Section.Text>
|
|
194
|
+
{/snippet}
|
|
195
|
+
{#if propertiesQuery.data !== undefined}
|
|
196
|
+
<Properties
|
|
197
|
+
supportedCodecs={propertiesQuery.data.supportedCodecs}
|
|
198
|
+
sampleRateHz={propertiesQuery.data.sampleRateHz}
|
|
199
|
+
numChannels={propertiesQuery.data.numChannels}
|
|
200
|
+
/>
|
|
201
|
+
{/if}
|
|
200
202
|
</ApiSection>
|
|
201
203
|
</div>
|
|
202
204
|
</div>
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
6
|
import Properties from '../../audio-properties.svelte'
|
|
7
|
-
import
|
|
7
|
+
import { Section } from '../../section'
|
|
8
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
partID: string
|
|
@@ -23,20 +24,19 @@
|
|
|
23
24
|
</script>
|
|
24
25
|
|
|
25
26
|
<ApiSection
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
method="GetProperties"
|
|
28
|
+
api={ResourceTriplets.AudioOutput}
|
|
29
|
+
queries={[query]}
|
|
28
30
|
class="grow flex-col gap-4"
|
|
29
31
|
>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{/if}
|
|
41
|
-
</Query>
|
|
32
|
+
{#snippet subheading()}
|
|
33
|
+
<Section.Text>Audio output properties</Section.Text>
|
|
34
|
+
{/snippet}
|
|
35
|
+
{#if query.data !== undefined}
|
|
36
|
+
<Properties
|
|
37
|
+
supportedCodecs={query.data.supportedCodecs}
|
|
38
|
+
sampleRateHz={query.data.sampleRateHz}
|
|
39
|
+
numChannels={query.data.numChannels}
|
|
40
|
+
/>
|
|
41
|
+
{/if}
|
|
42
42
|
</ApiSection>
|