@viamrobotics/test-widgets 0.16.0 → 0.17.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 (132) hide show
  1. package/dist/components/api-section.svelte +58 -50
  2. package/dist/components/api-section.svelte.d.ts +24 -11
  3. package/dist/components/content-rect.svelte +6 -0
  4. package/dist/components/content-rect.svelte.d.ts +1 -0
  5. package/dist/components/error.svelte +9 -0
  6. package/dist/components/error.svelte.d.ts +6 -0
  7. package/dist/components/index.d.ts +4 -2
  8. package/dist/components/index.js +4 -2
  9. package/dist/components/is-moving.svelte +26 -34
  10. package/dist/components/is-moving.svelte.d.ts +4 -5
  11. package/dist/components/progress.svelte +1 -0
  12. package/dist/components/queries.svelte +7 -0
  13. package/dist/components/queries.svelte.d.ts +4 -0
  14. package/dist/components/query.svelte +7 -0
  15. package/dist/components/query.svelte.d.ts +4 -0
  16. package/dist/components/section/index.d.ts +2 -0
  17. package/dist/components/section/index.js +2 -0
  18. package/dist/components/section/section-error-reporter.d.ts +8 -0
  19. package/dist/components/section/section-error-reporter.js +7 -0
  20. package/dist/components/section/section-error.svelte +36 -0
  21. package/dist/components/section/section-error.svelte.d.ts +9 -0
  22. package/dist/components/section/section-errors.svelte +132 -5
  23. package/dist/components/section/section.svelte +7 -1
  24. package/dist/components/section/section.svelte.d.ts +3 -0
  25. package/dist/components/section/use-section-errors.svelte.d.ts +1 -0
  26. package/dist/components/section/use-section-errors.svelte.js +11 -1
  27. package/dist/components/stop-button.svelte +1 -5
  28. package/dist/components/stop-button.svelte.d.ts +0 -1
  29. package/dist/components/stop.svelte +2 -2
  30. package/dist/components/widgets/arm/arm.svelte +24 -32
  31. package/dist/components/widgets/arm/get-joint-positions-widget.svelte +9 -8
  32. package/dist/components/widgets/arm/manual-mode-widget.svelte +13 -4
  33. package/dist/components/widgets/arm/manual-mode.svelte +1 -5
  34. package/dist/components/widgets/arm/manual-mode.svelte.d.ts +0 -1
  35. package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +10 -4
  36. package/dist/components/widgets/arm/move-to-joint-positions.svelte +1 -11
  37. package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +0 -1
  38. package/dist/components/widgets/arm/move-to-position-control.svelte +22 -18
  39. package/dist/components/widgets/arm/move-to-position.svelte +0 -4
  40. package/dist/components/widgets/arm/move-to-position.svelte.d.ts +0 -1
  41. package/dist/components/widgets/arm/quick-move-widget.svelte +10 -4
  42. package/dist/components/widgets/arm/quick-move.svelte +1 -4
  43. package/dist/components/widgets/arm/quick-move.svelte.d.ts +0 -1
  44. package/dist/components/widgets/audio-input/audio-input.svelte +76 -74
  45. package/dist/components/widgets/audio-input/get-properties-widget.svelte +15 -15
  46. package/dist/components/widgets/audio-output/audio-output.svelte +83 -81
  47. package/dist/components/widgets/audio-output/get-properties-widget.svelte +15 -15
  48. package/dist/components/widgets/base/base.svelte +70 -37
  49. package/dist/components/widgets/base/move-straight-widget.svelte +16 -4
  50. package/dist/components/widgets/base/quick-move-widget.svelte +25 -9
  51. package/dist/components/widgets/base/set-power-widget.svelte +20 -8
  52. package/dist/components/widgets/base/set-velocity-widget.svelte +20 -8
  53. package/dist/components/widgets/base/spin-widget.svelte +20 -8
  54. package/dist/components/widgets/board/read-write-pins.svelte +2 -2
  55. package/dist/components/widgets/button/push.svelte +2 -2
  56. package/dist/components/widgets/camera/camera.svelte +15 -23
  57. package/dist/components/widgets/camera/live-or-polling-video.svelte +12 -9
  58. package/dist/components/widgets/custom-control/__tests__/__fixtures__/with-sibling.svelte +10 -0
  59. package/dist/components/widgets/custom-control/control-frame.svelte +60 -0
  60. package/dist/components/widgets/custom-control/control-frame.svelte.d.ts +10 -0
  61. package/dist/components/widgets/custom-control/create-control-host.svelte.d.ts +19 -0
  62. package/dist/components/widgets/custom-control/create-control-host.svelte.js +28 -0
  63. package/dist/components/widgets/custom-control/custom-control.d.ts +35 -0
  64. package/dist/components/widgets/custom-control/custom-control.js +85 -0
  65. package/dist/components/widgets/custom-control/custom-control.svelte +45 -0
  66. package/dist/components/widgets/custom-control/custom-control.svelte.d.ts +14 -0
  67. package/dist/components/widgets/discovery/discovery.svelte +10 -15
  68. package/dist/components/widgets/encoder/encoder.svelte +20 -18
  69. package/dist/components/widgets/encoder/get-position-widget.svelte +18 -15
  70. package/dist/components/widgets/gantry/gantry.svelte +50 -74
  71. package/dist/components/widgets/gantry/get-position-widget.svelte +14 -13
  72. package/dist/components/widgets/gantry/home.svelte +21 -10
  73. package/dist/components/widgets/gantry/move-to-position-widget.svelte +2 -1
  74. package/dist/components/widgets/gantry/move-to-position.svelte +1 -4
  75. package/dist/components/widgets/gantry/move-to-position.svelte.d.ts +0 -1
  76. package/dist/components/widgets/gantry/quick-move-widget.svelte +2 -1
  77. package/dist/components/widgets/gantry/quick-move.svelte +1 -5
  78. package/dist/components/widgets/gantry/quick-move.svelte.d.ts +0 -1
  79. package/dist/components/widgets/generic/generic.svelte +7 -5
  80. package/dist/components/widgets/gripper/grab-widget.svelte +26 -0
  81. package/dist/components/widgets/gripper/grab-widget.svelte.d.ts +7 -0
  82. package/dist/components/widgets/gripper/grab.svelte +3 -19
  83. package/dist/components/widgets/gripper/grab.svelte.d.ts +1 -2
  84. package/dist/components/widgets/gripper/gripper.svelte +10 -12
  85. package/dist/components/widgets/gripper/is-holding-something.svelte +18 -19
  86. package/dist/components/widgets/gripper/open-widget.svelte +26 -0
  87. package/dist/components/widgets/gripper/open-widget.svelte.d.ts +7 -0
  88. package/dist/components/widgets/gripper/open.svelte +3 -19
  89. package/dist/components/widgets/gripper/open.svelte.d.ts +1 -2
  90. package/dist/components/widgets/input-controller/input-controller.svelte +7 -14
  91. package/dist/components/widgets/input-controller/webgamepad.svelte +2 -2
  92. package/dist/components/widgets/motion/motion.svelte +27 -35
  93. package/dist/components/widgets/motion/move-widget.svelte +32 -12
  94. package/dist/components/widgets/motion/move-widget.svelte.d.ts +6 -0
  95. package/dist/components/widgets/motion/move.svelte +1 -13
  96. package/dist/components/widgets/motion/move.svelte.d.ts +0 -1
  97. package/dist/components/widgets/motor/go-for-view.svelte +16 -8
  98. package/dist/components/widgets/motor/go-to-view.svelte +12 -4
  99. package/dist/components/widgets/motor/motor.svelte +88 -54
  100. package/dist/components/widgets/motor/quick-move-widget.svelte +16 -8
  101. package/dist/components/widgets/motor/set-power-widget.svelte +12 -4
  102. package/dist/components/widgets/motor/set-rpm-widget.svelte +12 -4
  103. package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +7 -10
  104. package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +7 -10
  105. package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +7 -10
  106. package/dist/components/widgets/movement-sensor/get-position-widget.svelte +7 -10
  107. package/dist/components/widgets/movement-sensor/movement-sensor.svelte +55 -56
  108. package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +2 -1
  109. package/dist/components/widgets/power-sensor/get-current-widget.svelte +7 -10
  110. package/dist/components/widgets/power-sensor/get-power-widget.svelte +7 -10
  111. package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +7 -10
  112. package/dist/components/widgets/power-sensor/power-sensor.svelte +26 -38
  113. package/dist/components/widgets/sensor/sensor.svelte +5 -10
  114. package/dist/components/widgets/servo/move-widget.svelte +2 -1
  115. package/dist/components/widgets/servo/move.svelte +1 -4
  116. package/dist/components/widgets/servo/move.svelte.d.ts +0 -1
  117. package/dist/components/widgets/servo/quick-move-widget.svelte +2 -1
  118. package/dist/components/widgets/servo/quick-move.svelte +1 -5
  119. package/dist/components/widgets/servo/quick-move.svelte.d.ts +0 -1
  120. package/dist/components/widgets/servo/servo.svelte +44 -33
  121. package/dist/components/widgets/slam/get-position-widget.svelte +7 -10
  122. package/dist/components/widgets/slam/move-on-map.svelte +6 -5
  123. package/dist/components/widgets/slam/move-on-map.svelte.d.ts +2 -1
  124. package/dist/components/widgets/slam/slam.svelte +64 -79
  125. package/dist/components/widgets/switch/position.svelte +2 -2
  126. package/package.json +3 -2
  127. package/dist/components/mutation-section.svelte +0 -75
  128. package/dist/components/mutation-section.svelte.d.ts +0 -18
  129. package/dist/components/mutation-view.svelte +0 -29
  130. package/dist/components/mutation-view.svelte.d.ts +0 -10
  131. package/dist/components/section-title.svelte +0 -65
  132. 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 Query from '../../query.svelte'
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
- <Query query={jointPositionsQuery}>
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
- </Query>
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, lastError }: Props = $props()
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} />
@@ -1,7 +1,6 @@
1
1
  interface Props {
2
2
  positions: number[];
3
3
  moveToJointPositions: (jointPositions: number[]) => void;
4
- lastError: Error | null;
5
4
  }
6
5
  declare const QuickMove: import("svelte").Component<Props, {}, "">;
7
6
  type QuickMove = ReturnType<typeof QuickMove>;
@@ -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
- <MutationSection
66
- title="GetAudio"
64
+ <ApiSection
65
+ method="GetAudio"
67
66
  api={ResourceTriplets.AudioInput}
68
- description="Capture audio from the device"
69
- lastError={capture.error}
67
+ mutations={[capture]}
68
+ class="flex-row flex-wrap gap-2"
70
69
  >
71
- <div class="flex flex-col gap-2">
72
- <Label cx="gap-1 text-xs">
73
- Codec
74
- <Select
75
- slot="input"
76
- value={selectedCodec}
77
- on:change={(e) => {
78
- captureCodec = (e.target as HTMLSelectElement).value
79
- }}
80
- >
81
- {#each availableCodecs as codec (codec)}
82
- <option value={codec}>{codec}</option>
83
- {/each}
84
- </Select>
85
- </Label>
86
- <Label cx="gap-1 text-xs">
87
- Duration (seconds, 0 = stream until stopped)
88
- <NumericInput
89
- slot="input"
90
- value={captureDuration}
91
- on:change={(e) => {
92
- captureDuration = numberValueFromEvent(e) ?? 3
93
- }}
94
- />
95
- </Label>
96
- </div>
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
- <div class="mt-auto flex flex-col items-start gap-2">
99
- {#if capture.status === 'recording'}
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
- <a
115
- href={capture.downloadUrl}
116
- download="audio-capture.{selectedCodec}"
117
- rel="external"
106
+ <Button
107
+ icon="stop-circle-outline"
108
+ onclick={capture.stop}
118
109
  >
119
- <Button icon="download">Download</Button>
120
- </a>
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
- <Button
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
- </MutationSection>
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
- title="GetProperties"
140
+ method="GetProperties"
137
141
  api={ResourceTriplets.AudioInput}
138
- description="Audio input properties"
142
+ queries={[propertiesQuery]}
139
143
  class="relative grow flex-col gap-4"
140
144
  >
141
- <Query
142
- query={propertiesQuery}
143
- class="h-6"
144
- >
145
- {#if propertiesQuery.data !== undefined}
146
- <Properties
147
- supportedCodecs={propertiesQuery.data.supportedCodecs}
148
- sampleRateHz={propertiesQuery.data.sampleRateHz}
149
- numChannels={propertiesQuery.data.numChannels}
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 Query from '../../query.svelte'
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
- title="GetProperties"
27
- description="Audio input properties"
27
+ method="GetProperties"
28
+ api={ResourceTriplets.AudioInput}
29
+ queries={[query]}
28
30
  class="grow flex-col gap-4"
29
31
  >
30
- <Query
31
- {query}
32
- class="h-6"
33
- >
34
- {#if query.data !== undefined}
35
- <Properties
36
- supportedCodecs={query.data.supportedCodecs}
37
- sampleRateHz={query.data.sampleRateHz}
38
- numChannels={query.data.numChannels}
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
- <MutationSection
111
- title="Play"
109
+ <ApiSection
110
+ method="Play"
112
111
  api={ResourceTriplets.AudioOutput}
113
- description="Send audio data to the device"
114
- lastError={playContext.error}
112
+ mutations={[playContext]}
113
+ class="flex-row flex-wrap gap-2"
115
114
  >
116
- <div class="flex flex-col gap-2">
117
- <Label cx="gap-1 text-xs">
118
- Audio file
119
- <input
120
- slot="input"
121
- type="file"
122
- accept={availableCodecs.map((c) => `.${c}`).join(',')}
123
- class="text-xs"
124
- onchange={handleFileChange}
125
- />
126
- </Label>
127
- {#if fileInputError}
128
- <p class="text-xs text-red-500">{fileInputError}</p>
129
- {/if}
130
- {#if selectedFile}
131
- <p class="font-roboto-mono text-subtle-1 text-xs">{selectedFile.name}</p>
132
- {/if}
133
- <Label cx="gap-1 text-xs">
134
- Codec
135
- <Select
136
- slot="input"
137
- value={selectedCodec}
138
- on:change={(e) => {
139
- playCodec = (e.target as HTMLSelectElement).value
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
- {#each availableCodecs as codec (codec)}
143
- <option value={codec}>{codec}</option>
144
- {/each}
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
- </MutationSection>
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
- title="GetProperties"
187
+ method="GetProperties"
184
188
  api={ResourceTriplets.AudioOutput}
185
- description="Audio output properties"
189
+ queries={[propertiesQuery]}
186
190
  class="relative grow flex-col gap-4"
187
191
  >
188
- <Query
189
- query={propertiesQuery}
190
- class="h-6"
191
- >
192
- {#if propertiesQuery.data !== undefined}
193
- <Properties
194
- supportedCodecs={propertiesQuery.data.supportedCodecs}
195
- sampleRateHz={propertiesQuery.data.sampleRateHz}
196
- numChannels={propertiesQuery.data.numChannels}
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 Query from '../../query.svelte'
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
- title="GetProperties"
27
- description="Audio output properties"
27
+ method="GetProperties"
28
+ api={ResourceTriplets.AudioOutput}
29
+ queries={[query]}
28
30
  class="grow flex-col gap-4"
29
31
  >
30
- <Query
31
- {query}
32
- class="h-6"
33
- >
34
- {#if query.data !== undefined}
35
- <Properties
36
- supportedCodecs={query.data.supportedCodecs}
37
- sampleRateHz={query.data.sampleRateHz}
38
- numChannels={query.data.numChannels}
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>