@viamrobotics/test-widgets 0.15.1 → 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.
Files changed (200) hide show
  1. package/README.md +15 -1
  2. package/dist/api-docs-href.d.ts +2 -2
  3. package/dist/api-docs-href.js +0 -1
  4. package/dist/components/api-section.svelte +58 -49
  5. package/dist/components/api-section.svelte.d.ts +24 -10
  6. package/dist/components/boundary.svelte +51 -0
  7. package/dist/components/boundary.svelte.d.ts +5 -0
  8. package/dist/components/connection-status.svelte +57 -61
  9. package/dist/components/connection-status.svelte.d.ts +5 -5
  10. package/dist/components/content-rect.svelte +10 -5
  11. package/dist/components/content-rect.svelte.d.ts +3 -1
  12. package/dist/components/error.svelte +15 -5
  13. package/dist/components/error.svelte.d.ts +8 -1
  14. package/dist/components/index.d.ts +4 -3
  15. package/dist/components/index.js +4 -3
  16. package/dist/components/is-moving.svelte +29 -35
  17. package/dist/components/is-moving.svelte.d.ts +6 -6
  18. package/dist/components/maplibre/index.svelte +5 -6
  19. package/dist/components/maplibre/index.svelte.d.ts +3 -1
  20. package/dist/components/pose-editor.svelte +83 -15
  21. package/dist/components/pose-editor.svelte.d.ts +11 -4
  22. package/dist/components/progress.svelte +1 -0
  23. package/dist/components/queries.svelte +14 -4
  24. package/dist/components/queries.svelte.d.ts +6 -1
  25. package/dist/components/query.svelte +11 -3
  26. package/dist/components/query.svelte.d.ts +6 -1
  27. package/dist/components/section/error-key.d.ts +2 -0
  28. package/dist/components/section/error-key.js +2 -0
  29. package/dist/components/section/index.d.ts +21 -0
  30. package/dist/components/section/index.js +21 -0
  31. package/dist/components/section/section-body.svelte +36 -0
  32. package/dist/components/section/section-body.svelte.d.ts +13 -0
  33. package/dist/components/section/section-error-reporter.d.ts +8 -0
  34. package/dist/components/section/section-error-reporter.js +7 -0
  35. package/dist/components/section/section-error.svelte +36 -0
  36. package/dist/components/section/section-error.svelte.d.ts +9 -0
  37. package/dist/components/section/section-errors.svelte +145 -0
  38. package/dist/components/section/section-errors.svelte.d.ts +6 -0
  39. package/dist/components/section/section-heading.svelte +21 -0
  40. package/dist/components/section/section-heading.svelte.d.ts +9 -0
  41. package/dist/components/section/section-loading.d.ts +4 -0
  42. package/dist/components/section/section-loading.js +10 -0
  43. package/dist/components/section/section-method.svelte +29 -0
  44. package/dist/components/section/section-method.svelte.d.ts +9 -0
  45. package/dist/components/section/section-placeholder.svelte +29 -0
  46. package/dist/components/section/section-placeholder.svelte.d.ts +7 -0
  47. package/dist/components/section/section-text.svelte +17 -0
  48. package/dist/components/section/section-text.svelte.d.ts +8 -0
  49. package/dist/components/section/section-tooltip.svelte +25 -0
  50. package/dist/components/section/section-tooltip.svelte.d.ts +7 -0
  51. package/dist/components/section/section.svelte +23 -0
  52. package/dist/components/section/section.svelte.d.ts +11 -0
  53. package/dist/components/section/use-section-errors.svelte.d.ts +19 -0
  54. package/dist/components/section/use-section-errors.svelte.js +49 -0
  55. package/dist/components/stop-button.svelte +1 -5
  56. package/dist/components/stop-button.svelte.d.ts +0 -1
  57. package/dist/components/stop.svelte +31 -14
  58. package/dist/components/stop.svelte.d.ts +6 -1
  59. package/dist/components/widgets/arm/arm.svelte +43 -40
  60. package/dist/components/widgets/arm/get-joint-positions-widget.svelte +10 -9
  61. package/dist/components/widgets/arm/joint-position-editor.svelte +105 -27
  62. package/dist/components/widgets/arm/joint-position-editor.svelte.d.ts +4 -3
  63. package/dist/components/widgets/arm/joint-position-slider.svelte +6 -2
  64. package/dist/components/widgets/arm/joint-position-slider.svelte.d.ts +2 -1
  65. package/dist/components/widgets/arm/manual-mode-widget.svelte +16 -6
  66. package/dist/components/widgets/arm/manual-mode.svelte +1 -5
  67. package/dist/components/widgets/arm/manual-mode.svelte.d.ts +0 -1
  68. package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +22 -8
  69. package/dist/components/widgets/arm/move-to-joint-positions.svelte +15 -17
  70. package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +0 -1
  71. package/dist/components/widgets/arm/move-to-position-control.svelte +45 -33
  72. package/dist/components/widgets/arm/move-to-position.svelte +97 -34
  73. package/dist/components/widgets/arm/move-to-position.svelte.d.ts +3 -2
  74. package/dist/components/widgets/arm/quick-move-widget.svelte +10 -4
  75. package/dist/components/widgets/arm/quick-move.svelte +1 -4
  76. package/dist/components/widgets/arm/quick-move.svelte.d.ts +0 -1
  77. package/dist/components/widgets/arm/use-arm-motion-tracking.svelte.d.ts +16 -0
  78. package/dist/components/widgets/arm/use-arm-motion-tracking.svelte.js +37 -0
  79. package/dist/components/widgets/arm/use-edited-targets.svelte.d.ts +9 -0
  80. package/dist/components/widgets/arm/use-edited-targets.svelte.js +24 -0
  81. package/dist/components/widgets/audio-input/audio-input.svelte +80 -77
  82. package/dist/components/widgets/audio-input/get-properties-widget.svelte +16 -16
  83. package/dist/components/widgets/audio-output/audio-output.svelte +87 -84
  84. package/dist/components/widgets/audio-output/get-properties-widget.svelte +16 -16
  85. package/dist/components/widgets/base/base.svelte +78 -43
  86. package/dist/components/widgets/base/move-straight-widget.svelte +16 -4
  87. package/dist/components/widgets/base/quick-move-widget.svelte +25 -9
  88. package/dist/components/widgets/base/quick-move.svelte +5 -6
  89. package/dist/components/widgets/base/set-power-widget.svelte +20 -8
  90. package/dist/components/widgets/base/set-power.svelte +6 -4
  91. package/dist/components/widgets/base/set-velocity-widget.svelte +20 -8
  92. package/dist/components/widgets/base/set-velocity.svelte +6 -4
  93. package/dist/components/widgets/base/spin-widget.svelte +20 -8
  94. package/dist/components/widgets/base/vec3-builder.svelte +3 -2
  95. package/dist/components/widgets/base/vec3-builder.svelte.d.ts +2 -1
  96. package/dist/components/widgets/board/analog-read.svelte +2 -4
  97. package/dist/components/widgets/board/analog-write.svelte +2 -4
  98. package/dist/components/widgets/board/gpio-read.svelte +2 -1
  99. package/dist/components/widgets/board/gpio-write.svelte +2 -1
  100. package/dist/components/widgets/board/pin-section.svelte +5 -6
  101. package/dist/components/widgets/board/pin-section.svelte.d.ts +3 -2
  102. package/dist/components/widgets/board/read-write-pins.svelte +2 -2
  103. package/dist/components/widgets/button/push.svelte +2 -2
  104. package/dist/components/widgets/camera/camera.svelte +17 -24
  105. package/dist/components/widgets/camera/live-or-polling-video.svelte +33 -30
  106. package/dist/components/widgets/custom-control/__tests__/__fixtures__/with-sibling.svelte +10 -0
  107. package/dist/components/widgets/custom-control/control-frame.svelte +60 -0
  108. package/dist/components/widgets/custom-control/control-frame.svelte.d.ts +10 -0
  109. package/dist/components/widgets/custom-control/create-control-host.svelte.d.ts +19 -0
  110. package/dist/components/widgets/custom-control/create-control-host.svelte.js +26 -0
  111. package/dist/components/widgets/custom-control/custom-control.d.ts +35 -0
  112. package/dist/components/widgets/custom-control/custom-control.js +85 -0
  113. package/dist/components/widgets/custom-control/custom-control.svelte +45 -0
  114. package/dist/components/widgets/custom-control/custom-control.svelte.d.ts +14 -0
  115. package/dist/components/widgets/discovery/discovery.svelte +13 -17
  116. package/dist/components/widgets/encoder/encoder.svelte +25 -21
  117. package/dist/components/widgets/encoder/get-position-widget.svelte +19 -16
  118. package/dist/components/widgets/gantry/gantry.svelte +58 -76
  119. package/dist/components/widgets/gantry/get-position-widget.svelte +15 -14
  120. package/dist/components/widgets/gantry/home.svelte +21 -10
  121. package/dist/components/widgets/gantry/move-to-position-widget.svelte +2 -1
  122. package/dist/components/widgets/gantry/move-to-position.svelte +1 -4
  123. package/dist/components/widgets/gantry/move-to-position.svelte.d.ts +0 -1
  124. package/dist/components/widgets/gantry/quick-move-widget.svelte +3 -2
  125. package/dist/components/widgets/gantry/quick-move.svelte +1 -5
  126. package/dist/components/widgets/gantry/quick-move.svelte.d.ts +0 -1
  127. package/dist/components/widgets/generic/generic.svelte +11 -6
  128. package/dist/components/widgets/gripper/grab-widget.svelte +26 -0
  129. package/dist/components/widgets/gripper/grab-widget.svelte.d.ts +7 -0
  130. package/dist/components/widgets/gripper/grab.svelte +3 -19
  131. package/dist/components/widgets/gripper/grab.svelte.d.ts +1 -2
  132. package/dist/components/widgets/gripper/gripper.svelte +18 -18
  133. package/dist/components/widgets/gripper/is-holding-something.svelte +21 -21
  134. package/dist/components/widgets/gripper/open-widget.svelte +26 -0
  135. package/dist/components/widgets/gripper/open-widget.svelte.d.ts +7 -0
  136. package/dist/components/widgets/gripper/open.svelte +3 -19
  137. package/dist/components/widgets/gripper/open.svelte.d.ts +1 -2
  138. package/dist/components/widgets/input-controller/input-controller.svelte +10 -16
  139. package/dist/components/widgets/input-controller/webgamepad.svelte +2 -2
  140. package/dist/components/widgets/ml-model-service/ml-model-service.svelte +1 -1
  141. package/dist/components/widgets/motion/frame-select.svelte +4 -2
  142. package/dist/components/widgets/motion/frame-select.svelte.d.ts +2 -1
  143. package/dist/components/widgets/motion/motion.svelte +27 -31
  144. package/dist/components/widgets/motion/move-widget.svelte +32 -12
  145. package/dist/components/widgets/motion/move-widget.svelte.d.ts +6 -0
  146. package/dist/components/widgets/motion/move.svelte +6 -16
  147. package/dist/components/widgets/motion/move.svelte.d.ts +0 -1
  148. package/dist/components/widgets/motor/go-for-view.svelte +16 -8
  149. package/dist/components/widgets/motor/go-to-view.svelte +12 -4
  150. package/dist/components/widgets/motor/motor.svelte +100 -64
  151. package/dist/components/widgets/motor/quick-move-widget.svelte +16 -8
  152. package/dist/components/widgets/motor/set-power-widget.svelte +12 -4
  153. package/dist/components/widgets/motor/set-rpm-widget.svelte +12 -4
  154. package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +8 -11
  155. package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +8 -11
  156. package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +8 -11
  157. package/dist/components/widgets/movement-sensor/get-position-widget.svelte +8 -11
  158. package/dist/components/widgets/movement-sensor/movement-sensor.svelte +64 -66
  159. package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +2 -1
  160. package/dist/components/widgets/power-sensor/get-current-widget.svelte +8 -11
  161. package/dist/components/widgets/power-sensor/get-power-widget.svelte +8 -11
  162. package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +8 -11
  163. package/dist/components/widgets/power-sensor/power-sensor.svelte +35 -45
  164. package/dist/components/widgets/sensor/sensor.svelte +8 -12
  165. package/dist/components/widgets/servo/move-widget.svelte +2 -1
  166. package/dist/components/widgets/servo/move.svelte +1 -4
  167. package/dist/components/widgets/servo/move.svelte.d.ts +0 -1
  168. package/dist/components/widgets/servo/quick-move-widget.svelte +2 -1
  169. package/dist/components/widgets/servo/quick-move.svelte +1 -5
  170. package/dist/components/widgets/servo/quick-move.svelte.d.ts +0 -1
  171. package/dist/components/widgets/servo/servo.svelte +53 -37
  172. package/dist/components/widgets/slam/get-position-widget.svelte +8 -11
  173. package/dist/components/widgets/slam/move-on-map.svelte +9 -6
  174. package/dist/components/widgets/slam/move-on-map.svelte.d.ts +2 -1
  175. package/dist/components/widgets/slam/slam.svelte +65 -75
  176. package/dist/components/widgets/switch/position-view.svelte +1 -1
  177. package/dist/components/widgets/switch/position.svelte +2 -2
  178. package/dist/components/widgets/switch/switch.svelte +1 -1
  179. package/dist/components/widgets/vision-service/detection-row.svelte +4 -2
  180. package/dist/components/widgets/vision-service/detection-row.svelte.d.ts +2 -1
  181. package/dist/components/widgets/vision-service/fonts/public-sans.json +1 -0
  182. package/dist/components/widgets/vision-service/fonts/public-sans.png +0 -0
  183. package/dist/components/widgets/vision-service/image.svelte +4 -4
  184. package/dist/components/widgets/vision-service/legend.svelte +4 -4
  185. package/dist/components/widgets/vision-service/public-sans-font.d.ts +5 -0
  186. package/dist/components/widgets/vision-service/public-sans-font.js +14 -0
  187. package/dist/components/widgets/vision-service/vision-service.svelte +2 -2
  188. package/dist/index.d.ts +1 -1
  189. package/dist/index.js +0 -1
  190. package/package.json +19 -5
  191. package/dist/components/board/pin-section.svelte +0 -28
  192. package/dist/components/board/pin-section.svelte.d.ts +0 -9
  193. package/dist/components/mutation-section.svelte +0 -73
  194. package/dist/components/mutation-section.svelte.d.ts +0 -16
  195. package/dist/components/mutation-view.svelte +0 -29
  196. package/dist/components/mutation-view.svelte.d.ts +0 -10
  197. package/dist/components/section-group.svelte +0 -64
  198. package/dist/components/section-group.svelte.d.ts +0 -14
  199. package/dist/components/section-title.svelte +0 -63
  200. package/dist/components/section-title.svelte.d.ts +0 -14
@@ -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"
28
- class="grow"
27
+ method="GetProperties"
28
+ api={ResourceTriplets.AudioInput}
29
+ queries={[query]}
30
+ class="grow flex-col gap-4"
29
31
  >
30
- <Query
31
- {query}
32
- contentCx="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,11 +6,11 @@
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'
13
+ import { ResourceTriplets } from '../../../resource-triplet'
14
14
 
15
15
  import { ExtToCodec, MimeToCodec } from './codec.js'
16
16
  import { createAudioPlayer } from './create-audio-player.svelte.js'
@@ -106,96 +106,99 @@
106
106
  <div class="@container">
107
107
  <div class="flex flex-col divide-y @2xl:flex-row @2xl:divide-x @2xl:divide-y-0">
108
108
  <div class="flex w-full flex-col divide-y">
109
- <MutationSection
110
- title="Play"
111
- api="rdk:component:audio_output"
112
- description="Send audio data to the device"
113
- lastError={playContext.error}
109
+ <ApiSection
110
+ method="Play"
111
+ api={ResourceTriplets.AudioOutput}
112
+ mutations={[playContext]}
113
+ class="flex-row flex-wrap gap-2"
114
114
  >
115
- <div class="flex flex-col gap-2">
116
- <Label cx="gap-1 text-xs">
117
- Audio file
118
- <input
119
- slot="input"
120
- type="file"
121
- accept={availableCodecs.map((c) => `.${c}`).join(',')}
122
- class="text-xs"
123
- onchange={handleFileChange}
124
- />
125
- </Label>
126
- {#if fileInputError}
127
- <p class="text-xs text-red-500">{fileInputError}</p>
128
- {/if}
129
- {#if selectedFile}
130
- <p class="font-roboto-mono text-subtle-1 text-xs">{selectedFile.name}</p>
131
- {/if}
132
- <Label cx="gap-1 text-xs">
133
- Codec
134
- <Select
135
- slot="input"
136
- value={selectedCodec}
137
- on:change={(e) => {
138
- playCodec = (e.target as HTMLSelectElement).value
139
- }}
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'}
140
177
  >
141
- {#each availableCodecs as codec (codec)}
142
- <option value={codec}>{codec}</option>
143
- {/each}
144
- </Select>
145
- </Label>
146
- <Label cx="gap-1 text-xs">
147
- Sample rate (Hz)
148
- <NumericInput
149
- slot="input"
150
- value={selectedSampleRateHz}
151
- on:change={(e) => {
152
- playSampleRateHz = numberValueFromEvent(e) ?? null
153
- }}
154
- />
155
- </Label>
156
- <Label cx="gap-1 text-xs">
157
- Channels
158
- <NumericInput
159
- slot="input"
160
- value={selectedNumChannels}
161
- on:change={(e) => {
162
- playNumChannels = numberValueFromEvent(e) ?? null
163
- }}
164
- />
165
- </Label>
166
- </div>
167
-
168
- <div class="mt-auto">
169
- <Button
170
- icon="play-circle-outline"
171
- onclick={play}
172
- disabled={!client.current || playContext.status === 'playing'}
173
- >
174
- {playButtonLabel}
175
- </Button>
178
+ {playButtonLabel}
179
+ </Button>
180
+ </div>
176
181
  </div>
177
- </MutationSection>
182
+ </ApiSection>
178
183
  </div>
179
184
 
180
185
  <div class="flex w-full flex-col divide-y @2xl:ml-auto @2xl:max-w-1/2 @4xl:max-w-1/3">
181
186
  <ApiSection
182
- title="GetProperties"
183
- api="rdk:component:audio_output"
184
- description="Audio output properties"
185
- class="relative"
187
+ method="GetProperties"
188
+ api={ResourceTriplets.AudioOutput}
189
+ queries={[propertiesQuery]}
190
+ class="relative grow flex-col gap-4"
186
191
  >
187
- <Query
188
- query={propertiesQuery}
189
- contentCx="h-6"
190
- >
191
- {#if propertiesQuery.data !== undefined}
192
- <Properties
193
- supportedCodecs={propertiesQuery.data.supportedCodecs}
194
- sampleRateHz={propertiesQuery.data.sampleRateHz}
195
- numChannels={propertiesQuery.data.numChannels}
196
- />
197
- {/if}
198
- </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}
199
202
  </ApiSection>
200
203
  </div>
201
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"
28
- class="grow"
27
+ method="GetProperties"
28
+ api={ResourceTriplets.AudioOutput}
29
+ queries={[query]}
30
+ class="grow flex-col gap-4"
29
31
  >
30
- <Query
31
- {query}
32
- contentCx="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>
@@ -6,8 +6,10 @@
6
6
  import ApiSection from '../../api-section.svelte'
7
7
  import ConnectionStatus from '../../connection-status.svelte'
8
8
  import IsMoving from '../../is-moving.svelte'
9
- import MutationSection from '../../mutation-section.svelte'
9
+ import { Section } from '../../section'
10
+ import { useSectionErrors } from '../../section/use-section-errors.svelte'
10
11
  import StopButton from '../../stop-button.svelte'
12
+ import { ResourceTriplets } from '../../../resource-triplet'
11
13
 
12
14
  import MoveStraight from './move-straight.svelte'
13
15
  import QuickMove from './quick-move.svelte'
@@ -55,6 +57,8 @@
55
57
  moveStraightMutation.mutate([distanceMm, mmPerSec], {})
56
58
  }
57
59
 
60
+ const quickMoveErrors = useSectionErrors(() => ({ mutations: [quickSetPowerMutation] }))
61
+
58
62
  let quickMoveKeyboardControl = $state(false)
59
63
  </script>
60
64
 
@@ -62,11 +66,17 @@
62
66
  {#snippet connected()}
63
67
  <div class="@container">
64
68
  <div class="flex flex-col divide-y @4xl:flex-row @4xl:divide-x @4xl:divide-y-0">
65
- <MutationSection
66
- title="Quick move"
67
- lastError={quickSetPowerMutation.error}
69
+ <Section
70
+ errorReporter={quickMoveErrors}
71
+ class="flex-row flex-wrap gap-2"
68
72
  >
69
- {#snippet titleInput()}
73
+ <div class="flex flex-col gap-0.5">
74
+ <Section.Heading>
75
+ Quick move
76
+ {#snippet aside()}
77
+ <Section.Errors errors={quickMoveErrors.errors} />
78
+ {/snippet}
79
+ </Section.Heading>
70
80
  <Label>
71
81
  Keyboard control
72
82
 
@@ -76,20 +86,25 @@
76
86
  on:change={() => (quickMoveKeyboardControl = !quickMoveKeyboardControl)}
77
87
  />
78
88
  </Label>
79
- {/snippet}
89
+ </div>
80
90
 
81
- <QuickMove
82
- isKeyboardEnabled={quickMoveKeyboardControl}
83
- setPower={quickSetPower}
84
- />
85
- </MutationSection>
91
+ <Section.Body>
92
+ <div class="flex grow flex-wrap justify-between gap-2">
93
+ <QuickMove
94
+ isKeyboardEnabled={quickMoveKeyboardControl}
95
+ setPower={quickSetPower}
96
+ />
97
+ </div>
98
+ </Section.Body>
99
+ </Section>
86
100
  <div class="flex grow flex-col divide-y @4xl:ml-auto @4xl:w-full @4xl:max-w-40">
87
101
  <ApiSection
88
- title="Stop"
89
- api="rdk:component:base"
102
+ class="grow flex-col gap-4"
103
+ method="Stop"
104
+ api={ResourceTriplets.Base}
105
+ mutations={[stopMutation]}
90
106
  >
91
107
  <StopButton
92
- error={stopMutation.error}
93
108
  onStop={() => {
94
109
  stopMutation.mutate([])
95
110
  }}
@@ -97,44 +112,64 @@
97
112
  </ApiSection>
98
113
  <IsMoving
99
114
  client={BaseClient}
100
- api="rdk:component:base"
115
+ api={ResourceTriplets.Base}
101
116
  {partID}
102
117
  {resourceName}
103
118
  />
104
119
  </div>
105
120
  </div>
106
121
  </div>
107
- <MutationSection
108
- title="MoveStraight"
109
- api="rdk:component:base"
110
- description="Move across a given distance at a given velocity"
111
- lastError={moveStraightMutation.error}
122
+ <ApiSection
123
+ class="flex-row flex-wrap gap-2"
124
+ method="MoveStraight"
125
+ api={ResourceTriplets.Base}
126
+ mutations={[moveStraightMutation]}
112
127
  >
113
- <MoveStraight {moveStraight} />
114
- </MutationSection>
115
- <MutationSection
116
- title="Spin"
117
- api="rdk:component:base"
118
- description="Turn to a given angle at a given velocity"
119
- lastError={spinMutation.error}
128
+ {#snippet subheading()}
129
+ <Section.Text>Move across a given distance at a given velocity</Section.Text>
130
+ {/snippet}
131
+ <div class="flex grow flex-wrap justify-between gap-2">
132
+ <MoveStraight {moveStraight} />
133
+ </div>
134
+ </ApiSection>
135
+ <ApiSection
136
+ class="flex-row flex-wrap gap-2"
137
+ method="Spin"
138
+ api={ResourceTriplets.Base}
139
+ mutations={[spinMutation]}
120
140
  >
121
- <Spin {spin} />
122
- </MutationSection>
123
- <MutationSection
124
- title="SetPower"
125
- api="rdk:component:base"
126
- description="Move continuously at a given amount of power"
127
- lastError={setPowerMutation.error}
141
+ {#snippet subheading()}
142
+ <Section.Text>Turn to a given angle at a given velocity</Section.Text>
143
+ {/snippet}
144
+ <div class="flex grow flex-wrap justify-between gap-2">
145
+ <Spin {spin} />
146
+ </div>
147
+ </ApiSection>
148
+ <ApiSection
149
+ class="flex-row flex-wrap gap-2"
150
+ method="SetPower"
151
+ api={ResourceTriplets.Base}
152
+ mutations={[setPowerMutation]}
128
153
  >
129
- <SetPower {setPower} />
130
- </MutationSection>
131
- <MutationSection
132
- title="SetVelocity"
133
- api="rdk:component:base"
134
- description="Move continually at a given velocity"
135
- lastError={setVelocityMutation.error}
154
+ {#snippet subheading()}
155
+ <Section.Text>Move continuously at a given amount of power</Section.Text>
156
+ {/snippet}
157
+ <div class="flex grow flex-wrap justify-between gap-2">
158
+ <SetPower {setPower} />
159
+ </div>
160
+ </ApiSection>
161
+ <ApiSection
162
+ class="flex-row flex-wrap gap-2"
163
+ method="SetVelocity"
164
+ api={ResourceTriplets.Base}
165
+ mutations={[setVelocityMutation]}
136
166
  >
137
- <SetVelocity {setVelocity} />
138
- </MutationSection>
167
+ {#snippet subheading()}
168
+ <Section.Text>Move continually at a given velocity</Section.Text>
169
+ {/snippet}
170
+ <div class="flex grow flex-wrap justify-between gap-2">
171
+ <SetVelocity {setVelocity} />
172
+ </div>
173
+ </ApiSection>
139
174
  {/snippet}
140
175
  </ConnectionStatus>
@@ -2,7 +2,9 @@
2
2
  import { BaseClient } from '@viamrobotics/sdk'
3
3
  import { createResourceClient, createResourceMutation } from '@viamrobotics/svelte-sdk'
4
4
 
5
- import MutationView from '../../mutation-view.svelte'
5
+ import ApiSection from '../../api-section.svelte'
6
+ import { Section } from '../../section'
7
+ import { ResourceTriplets } from '../../../resource-triplet'
6
8
 
7
9
  import MoveStraight from './move-straight.svelte'
8
10
 
@@ -26,6 +28,16 @@
26
28
  }
27
29
  </script>
28
30
 
29
- <MutationView lastError={moveStraightMutation.error}>
30
- <MoveStraight {moveStraight} />
31
- </MutationView>
31
+ <ApiSection
32
+ class="flex-row flex-wrap gap-2"
33
+ method="MoveStraight"
34
+ api={ResourceTriplets.Base}
35
+ mutations={[moveStraightMutation]}
36
+ >
37
+ {#snippet subheading()}
38
+ <Section.Text>Move across a given distance at a given velocity</Section.Text>
39
+ {/snippet}
40
+ <div class="flex grow flex-wrap justify-between gap-2">
41
+ <MoveStraight {moveStraight} />
42
+ </div>
43
+ </ApiSection>
@@ -3,7 +3,8 @@
3
3
  import { BaseClient, type Vector3 } from '@viamrobotics/sdk'
4
4
  import { createResourceClient, createResourceMutation } from '@viamrobotics/svelte-sdk'
5
5
 
6
- import MutationView from '../../mutation-view.svelte'
6
+ import { Section } from '../../section'
7
+ import { useSectionErrors } from '../../section/use-section-errors.svelte'
7
8
 
8
9
  import QuickMove from './quick-move.svelte'
9
10
 
@@ -26,11 +27,22 @@
26
27
  quickSetPowerMutation.mutate([linear, angular], {})
27
28
  }
28
29
 
30
+ const sectionErrors = useSectionErrors(() => ({ mutations: [quickSetPowerMutation] }))
31
+
29
32
  let isKeyboardEnabled = $state(false)
30
33
  </script>
31
34
 
32
- <MutationView lastError={quickSetPowerMutation.error}>
33
- {#snippet titleInput()}
35
+ <Section
36
+ errorReporter={sectionErrors}
37
+ class="flex-row flex-wrap gap-2"
38
+ >
39
+ <div class="flex flex-col gap-0.5">
40
+ <Section.Heading>
41
+ Quick move
42
+ {#snippet aside()}
43
+ <Section.Errors errors={sectionErrors.errors} />
44
+ {/snippet}
45
+ </Section.Heading>
34
46
  <Label cx="w-fit!">
35
47
  Keyboard control
36
48
 
@@ -40,10 +52,14 @@
40
52
  on:change={() => (isKeyboardEnabled = !isKeyboardEnabled)}
41
53
  />
42
54
  </Label>
43
- {/snippet}
55
+ </div>
44
56
 
45
- <QuickMove
46
- setPower={quickSetPower}
47
- {isKeyboardEnabled}
48
- />
49
- </MutationView>
57
+ <Section.Body>
58
+ <div class="flex grow flex-wrap justify-between gap-2">
59
+ <QuickMove
60
+ setPower={quickSetPower}
61
+ {isKeyboardEnabled}
62
+ />
63
+ </div>
64
+ </Section.Body>
65
+ </Section>
@@ -3,7 +3,6 @@
3
3
 
4
4
  import { Icon, Label, RangeInput } from '@viamrobotics/prime-core'
5
5
  import { onMount } from 'svelte'
6
- import { twMerge } from 'tailwind-merge'
7
6
 
8
7
  import { numberValueFromEvent } from '../../../event-handlers'
9
8
 
@@ -51,7 +50,7 @@
51
50
  }
52
51
 
53
52
  const buttonCx =
54
- 'flex gap-2 justify-center items-center w-[60px] border border-light bg-light px-2.5 py-3 hover:border-medium hover:bg-medium active:bg-gray-2 h-fit'
53
+ 'flex gap-2 justify-center items-center w-[60px] border border-light px-2.5 py-3 hover:border-medium hover:bg-medium active:bg-gray-2 h-fit'
55
54
 
56
55
  const keys = {
57
56
  W_KEY: 'w',
@@ -154,7 +153,7 @@
154
153
  aria-label="left"
155
154
  onmouseup={mouseEnd}
156
155
  onmouseleave={mouseEnd}
157
- class={twMerge(buttonCx, pressedKeys.a && 'bg-gray-2')}
156
+ class={[buttonCx, pressedKeys.a ? 'bg-gray-2' : 'bg-light']}
158
157
  >
159
158
  <Icon
160
159
  name="undo"
@@ -171,7 +170,7 @@
171
170
  aria-label="forwards"
172
171
  onmouseup={mouseEnd}
173
172
  onmouseleave={mouseEnd}
174
- class={twMerge(buttonCx, 'flex-col', pressedKeys.w && 'bg-gray-2')}
173
+ class={[buttonCx, 'flex-col', pressedKeys.w ? 'bg-gray-2' : 'bg-light']}
175
174
  >
176
175
  <Icon
177
176
  name="arrow-up"
@@ -187,7 +186,7 @@
187
186
  aria-label="backwards"
188
187
  onmouseup={mouseEnd}
189
188
  onmouseleave={mouseEnd}
190
- class={twMerge(buttonCx, 'flex-col', pressedKeys.s && 'bg-gray-2')}
189
+ class={[buttonCx, 'flex-col', pressedKeys.s ? 'bg-gray-2' : 'bg-light']}
191
190
  >
192
191
  {#if isKeyboardEnabled}
193
192
  <div class="text-gray-6 text-sm font-semibold">S</div>
@@ -205,7 +204,7 @@
205
204
  aria-label="right"
206
205
  onmouseup={mouseEnd}
207
206
  onmouseleave={mouseEnd}
208
- class={twMerge(buttonCx, pressedKeys.d && 'bg-gray-2')}
207
+ class={[buttonCx, pressedKeys.d ? 'bg-gray-2' : 'bg-light']}
209
208
  >
210
209
  {#if isKeyboardEnabled}
211
210
  <div class="text-gray-6 text-sm font-semibold">D</div>
@@ -2,7 +2,9 @@
2
2
  import { BaseClient, type Vector3 } from '@viamrobotics/sdk'
3
3
  import { createResourceClient, createResourceMutation } from '@viamrobotics/svelte-sdk'
4
4
 
5
- import MutationView from '../../mutation-view.svelte'
5
+ import ApiSection from '../../api-section.svelte'
6
+ import { Section } from '../../section'
7
+ import { ResourceTriplets } from '../../../resource-triplet'
6
8
 
7
9
  import SetPower from './set-power.svelte'
8
10
 
@@ -22,10 +24,20 @@
22
24
  const setPowerMutation = createResourceMutation(client, 'setPower')
23
25
  </script>
24
26
 
25
- <MutationView lastError={setPowerMutation.error}>
26
- <SetPower
27
- setPower={(linear: Vector3, angular: Vector3) => {
28
- setPowerMutation.mutate([linear, angular], {})
29
- }}
30
- />
31
- </MutationView>
27
+ <ApiSection
28
+ class="flex-row flex-wrap gap-2"
29
+ method="SetPower"
30
+ api={ResourceTriplets.Base}
31
+ mutations={[setPowerMutation]}
32
+ >
33
+ {#snippet subheading()}
34
+ <Section.Text>Move continuously at a given amount of power</Section.Text>
35
+ {/snippet}
36
+ <div class="flex grow flex-wrap justify-between gap-2">
37
+ <SetPower
38
+ setPower={(linear: Vector3, angular: Vector3) => {
39
+ setPowerMutation.mutate([linear, angular], {})
40
+ }}
41
+ />
42
+ </div>
43
+ </ApiSection>
@@ -17,19 +17,21 @@
17
17
 
18
18
  <div class="flex flex-wrap gap-4">
19
19
  <Vec3Builder
20
- title="Linear power"
21
20
  titleTooltip="The percentage of max power of the base’s linear propulsion. In the range of –1.0 to 1.0, with 1.0 meaning 100% power."
22
21
  xTooltip="+X is right, –X is left"
23
22
  yTooltip="+Y is forward, –Y is backward"
24
23
  zTooltip="+Z is up, –Z is down"
25
24
  bind:vector={linearPower}
26
- />
25
+ >
26
+ {#snippet title()}Linear power{/snippet}
27
+ </Vec3Builder>
27
28
  <Vec3Builder
28
- title="Angular power"
29
29
  titleTooltip="The percentage of max power of the base’s angular propulsion. In the range of -1.0 to 1.0, with 1.0 meaning 100% power."
30
30
  zTooltip="+Z is left, –Z is right"
31
31
  bind:vector={angularPower}
32
- />
32
+ >
33
+ {#snippet title()}Angular power{/snippet}
34
+ </Vec3Builder>
33
35
  </div>
34
36
 
35
37
  <Button