@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
@@ -5,7 +5,6 @@
5
5
  import { CodeEditor } from '@viamrobotics/prime-core/code-editor'
6
6
  import { PersistedState } from 'runed'
7
7
 
8
- import ErrorDisplay from '../../error.svelte'
9
8
  import PoseEditor from '../../pose-editor.svelte'
10
9
 
11
10
  import type { MoveInput } from './parse-move-args'
@@ -17,20 +16,11 @@
17
16
  destination: string
18
17
  currentPose?: Pose
19
18
  isPending: boolean
20
- lastError: Error | null
21
19
  storageKey: string
22
20
  onExecute: (input: MoveInput) => void
23
21
  }
24
22
 
25
- const {
26
- frameName,
27
- destination,
28
- currentPose,
29
- isPending,
30
- lastError,
31
- storageKey,
32
- onExecute,
33
- }: Props = $props()
23
+ const { frameName, destination, currentPose, isPending, storageKey, onExecute }: Props = $props()
34
24
 
35
25
  const zeroPose: Pose = { x: 0, y: 0, z: 0, oX: 0, oY: 0, oZ: 1, theta: 0 }
36
26
 
@@ -60,9 +50,11 @@
60
50
  onPoseChange={(next) => {
61
51
  edit = { key: editKey, pose: next }
62
52
  }}
63
- title="Destination pose"
64
- description="The target pose expressed in the selected reference frame. Translations are in millimeters."
65
- />
53
+ >
54
+ {#snippet heading()}Destination pose{/snippet}
55
+ {#snippet description()}The target pose expressed in the selected reference frame. Translations
56
+ are in millimeters.{/snippet}
57
+ </PoseEditor>
66
58
 
67
59
  <div class="flex flex-col gap-2">
68
60
  <span class="flex flex-row gap-2">
@@ -137,6 +129,4 @@
137
129
  <p class="text-subtle-2 text-xs">
138
130
  Move blocks until the motion completes. Stop the component itself to interrupt.
139
131
  </p>
140
-
141
- <ErrorDisplay {lastError} />
142
132
  </div>
@@ -7,7 +7,6 @@ interface Props {
7
7
  destination: string;
8
8
  currentPose?: Pose;
9
9
  isPending: boolean;
10
- lastError: Error | null;
11
10
  storageKey: string;
12
11
  onExecute: (input: MoveInput) => void;
13
12
  }
@@ -2,7 +2,8 @@
2
2
  import { MotorClient } 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 { ResourceTriplets } from '../../../resource-triplet'
6
7
 
7
8
  import GoFor from './go-for.svelte'
8
9
 
@@ -22,10 +23,17 @@
22
23
  const goForMutation = createResourceMutation(client, 'goFor')
23
24
  </script>
24
25
 
25
- <MutationView lastError={goForMutation.error}>
26
- <GoFor
27
- goFor={(rpm: number, revolutions: number) => {
28
- goForMutation.mutate([rpm, revolutions], {})
29
- }}
30
- />
31
- </MutationView>
26
+ <ApiSection
27
+ class="flex-row flex-wrap gap-2"
28
+ method="GoFor"
29
+ api={ResourceTriplets.Motor}
30
+ mutations={[goForMutation]}
31
+ >
32
+ <div class="flex grow flex-wrap justify-between gap-2">
33
+ <GoFor
34
+ goFor={(rpm: number, revolutions: number) => {
35
+ goForMutation.mutate([rpm, revolutions], {})
36
+ }}
37
+ />
38
+ </div>
39
+ </ApiSection>
@@ -2,7 +2,8 @@
2
2
  import { MotorClient } 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 { ResourceTriplets } from '../../../resource-triplet'
6
7
 
7
8
  import GoTo from './go-to.svelte'
8
9
 
@@ -26,6 +27,13 @@
26
27
  }
27
28
  </script>
28
29
 
29
- <MutationView lastError={goToMutation.error}>
30
- <GoTo {goTo} />
31
- </MutationView>
30
+ <ApiSection
31
+ class="flex-row flex-wrap gap-2"
32
+ method="GoTo"
33
+ api={ResourceTriplets.Motor}
34
+ mutations={[goToMutation]}
35
+ >
36
+ <div class="flex grow flex-wrap justify-between gap-2">
37
+ <GoTo {goTo} />
38
+ </div>
39
+ </ApiSection>
@@ -9,10 +9,11 @@
9
9
  import ApiSection from '../../api-section.svelte'
10
10
  import ConnectionStatus from '../../connection-status.svelte'
11
11
  import IsMoving from '../../is-moving.svelte'
12
- import MutationSection from '../../mutation-section.svelte'
13
- import Query from '../../query.svelte'
12
+ import { Section } from '../../section'
13
+ import { useSectionErrors } from '../../section/use-section-errors.svelte'
14
14
  import StopButton from '../../stop-button.svelte'
15
15
  import { formatNumeric } from '../../../format'
16
+ import { ResourceTriplets } from '../../../resource-triplet'
16
17
 
17
18
  import GoFor from './go-for.svelte'
18
19
  import GoTo from './go-to.svelte'
@@ -53,6 +54,8 @@
53
54
  const goToMutation = createResourceMutation(client, 'goTo')
54
55
  const stopMutation = createResourceMutation(client, 'stop')
55
56
 
57
+ const quickMoveErrors = useSectionErrors(() => ({ mutations: [quickSetPowerMutation] }))
58
+
56
59
  const setPower = (val: number) => {
57
60
  setPowerMutation.mutate([val], {})
58
61
  }
@@ -79,55 +82,85 @@
79
82
  <div class="@container">
80
83
  <div class="flex flex-col divide-y @2xl:flex-row @2xl:divide-x @2xl:divide-y-0">
81
84
  <div class="flex w-full flex-col divide-y">
82
- <MutationSection
83
- title="Quick move"
84
- lastError={quickSetPowerMutation.error}
85
+ <Section
86
+ errorReporter={quickMoveErrors}
87
+ class="flex-row flex-wrap gap-2"
85
88
  >
86
- <QuickMove setPower={quickSetPower} />
87
- </MutationSection>
88
- <MutationSection
89
- title="SetPower"
90
- api="rdk:component:motor"
91
- description="Move continuously"
92
- lastError={setPowerMutation.error}
89
+ <div class="flex flex-col gap-0.5">
90
+ <Section.Heading>
91
+ Quick move
92
+ {#snippet aside()}
93
+ <Section.Errors errors={quickMoveErrors.errors} />
94
+ {/snippet}
95
+ </Section.Heading>
96
+ </div>
97
+ <Section.Body>
98
+ <div class="flex grow flex-wrap justify-between gap-2">
99
+ <QuickMove setPower={quickSetPower} />
100
+ </div>
101
+ </Section.Body>
102
+ </Section>
103
+ <ApiSection
104
+ class="flex-row flex-wrap gap-2"
105
+ method="SetPower"
106
+ api={ResourceTriplets.Motor}
107
+ mutations={[setPowerMutation]}
93
108
  >
94
- <SetPower {setPower} />
95
- </MutationSection>
109
+ {#snippet subheading()}<Section.Text>Move continuously</Section.Text>{/snippet}
110
+ <div class="flex grow flex-wrap justify-between gap-2">
111
+ <SetPower {setPower} />
112
+ </div>
113
+ </ApiSection>
96
114
  {#if propertiesQuery.data?.positionReporting}
97
- <MutationSection
98
- title="SetRPM"
99
- api="rdk:component:motor"
100
- description="Move indefinitely at a specified speed."
101
- lastError={setRPMMutation.error}
115
+ <ApiSection
116
+ class="flex-row flex-wrap gap-2"
117
+ method="SetRPM"
118
+ api={ResourceTriplets.Motor}
119
+ mutations={[setRPMMutation]}
102
120
  >
103
- <SetRPM {setRPM} />
104
- </MutationSection>
105
- <MutationSection
106
- title="GoFor"
107
- api="rdk:component:motor"
108
- description="Move a specified number of revolutions"
109
- lastError={goForMutation.error}
121
+ {#snippet subheading()}<Section.Text
122
+ >Move indefinitely at a specified speed.</Section.Text
123
+ >{/snippet}
124
+ <div class="flex grow flex-wrap justify-between gap-2">
125
+ <SetRPM {setRPM} />
126
+ </div>
127
+ </ApiSection>
128
+ <ApiSection
129
+ class="flex-row flex-wrap gap-2"
130
+ method="GoFor"
131
+ api={ResourceTriplets.Motor}
132
+ mutations={[goForMutation]}
110
133
  >
111
- <GoFor {goFor} />
112
- </MutationSection>
113
- <MutationSection
114
- title="GoTo"
115
- api="rdk:component:motor"
116
- description="Turn to a specified position"
117
- lastError={goToMutation.error}
134
+ {#snippet subheading()}<Section.Text
135
+ >Move a specified number of revolutions</Section.Text
136
+ >{/snippet}
137
+ <div class="flex grow flex-wrap justify-between gap-2">
138
+ <GoFor {goFor} />
139
+ </div>
140
+ </ApiSection>
141
+ <ApiSection
142
+ class="flex-row flex-wrap gap-2"
143
+ method="GoTo"
144
+ api={ResourceTriplets.Motor}
145
+ mutations={[goToMutation]}
118
146
  >
119
- <GoTo {goTo} />
120
- </MutationSection>
147
+ {#snippet subheading()}<Section.Text>Turn to a specified position</Section.Text
148
+ >{/snippet}
149
+ <div class="flex grow flex-wrap justify-between gap-2">
150
+ <GoTo {goTo} />
151
+ </div>
152
+ </ApiSection>
121
153
  {/if}
122
154
  </div>
123
155
 
124
156
  <div class="flex w-full flex-col divide-y @2xl:ml-auto @2xl:max-w-1/2 @4xl:max-w-1/3">
125
157
  <ApiSection
126
- title="Stop"
127
- api="rdk:component:motor"
158
+ class="grow flex-col gap-4"
159
+ method="Stop"
160
+ api={ResourceTriplets.Motor}
161
+ mutations={[stopMutation]}
128
162
  >
129
163
  <StopButton
130
- error={stopMutation.error}
131
164
  onStop={() => {
132
165
  stopMutation.mutate([])
133
166
  }}
@@ -135,45 +168,48 @@
135
168
  </ApiSection>
136
169
  <IsMoving
137
170
  client={MotorClient}
138
- api="rdk:component:motor"
171
+ api={ResourceTriplets.Motor}
139
172
  {partID}
140
173
  {resourceName}
141
174
  >
142
175
  <div class="flex flex-col gap-6 pt-2">
143
176
  <ApiSection
144
- title="IsPowered"
145
- api="rdk:component:motor"
146
- class="gap-3 p-0"
147
- tooltip="Returns whether or not the motor is running and the current portion of max power.
148
-
149
- Stepper motors will report ”true” if they are being powered while holding
150
- a position and while they are turning."
177
+ method="IsPowered"
178
+ api={ResourceTriplets.Motor}
179
+ queries={[isPoweredQuery]}
180
+ class="grow flex-col gap-3 p-0!"
151
181
  >
152
- <Query query={isPoweredQuery}>
153
- {#if isPoweredQuery.data !== undefined}
154
- {@const [isPowered, powerPct] = isPoweredQuery.data}
155
- <span class="font-roboto-mono flex flex-row gap-1 text-xs">
156
- <p class="text-default">{isPowered}</p>
157
- <p class="text-disabled">/</p>
158
- <p class="text-subtle-1">
159
- {formatNumeric(powerPct * 100, 1)}%
160
- </p>
161
- </span>
162
- {/if}
163
- </Query>
182
+ {#snippet tooltip()}
183
+ Returns whether or not the motor is running and the current portion of max power.
184
+ Stepper motors will report ”true” if they are being powered while holding a
185
+ position and while they are turning.
186
+ {/snippet}
187
+ {#if isPoweredQuery.data !== undefined}
188
+ {@const [isPowered, powerPct] = isPoweredQuery.data}
189
+ <span class="font-roboto-mono flex flex-row gap-1 text-xs">
190
+ <p class="text-default">{isPowered}</p>
191
+ <p class="text-disabled">/</p>
192
+ <p class="text-subtle-1">
193
+ {formatNumeric(powerPct * 100, 1)}%
194
+ </p>
195
+ </span>
196
+ {/if}
164
197
  </ApiSection>
165
198
  {#if propertiesQuery.data?.positionReporting === true}
166
199
  <ApiSection
167
- title="GetPosition"
168
- api="rdk:component:motor"
169
- class="gap-3 p-0"
170
- tooltip="Reports the position of an encoded motor in revolutions from zero/home."
200
+ method="GetPosition"
201
+ api={ResourceTriplets.Motor}
202
+ queries={[positionQuery]}
203
+ class="grow flex-col gap-3 p-0!"
171
204
  >
172
- <Query query={positionQuery}>
205
+ {#snippet tooltip()}
206
+ Reports the position of an encoded motor in revolutions from zero/home.
207
+ {/snippet}
208
+ {#if positionQuery.data !== undefined}
173
209
  <p class="font-roboto-mono text-default text-xs">
174
210
  {formatNumeric(positionQuery.data, 4)}
175
211
  </p>
176
- </Query>
212
+ {/if}
177
213
  </ApiSection>
178
214
  {/if}
179
215
  </div>
@@ -2,7 +2,8 @@
2
2
  import { MotorClient } 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 { ResourceTriplets } from '../../../resource-triplet'
6
7
 
7
8
  import QuickMove from './quick-move.svelte'
8
9
 
@@ -22,10 +23,17 @@
22
23
  const quickSetPowerMutation = createResourceMutation(client, 'setPower')
23
24
  </script>
24
25
 
25
- <MutationView lastError={quickSetPowerMutation.error}>
26
- <QuickMove
27
- setPower={(val) => {
28
- quickSetPowerMutation.mutate([val], {})
29
- }}
30
- />
31
- </MutationView>
26
+ <ApiSection
27
+ class="flex-row flex-wrap gap-2"
28
+ method="SetPower"
29
+ api={ResourceTriplets.Motor}
30
+ mutations={[quickSetPowerMutation]}
31
+ >
32
+ <div class="flex grow flex-wrap justify-between gap-2">
33
+ <QuickMove
34
+ setPower={(val) => {
35
+ quickSetPowerMutation.mutate([val], {})
36
+ }}
37
+ />
38
+ </div>
39
+ </ApiSection>
@@ -2,7 +2,8 @@
2
2
  import { MotorClient } 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 { ResourceTriplets } from '../../../resource-triplet'
6
7
 
7
8
  import SetPower from './set-power.svelte'
8
9
 
@@ -24,6 +25,13 @@
24
25
  const setPower = (val: number) => setPowerMutation.mutate([val], {})
25
26
  </script>
26
27
 
27
- <MutationView lastError={setPowerMutation.error}>
28
- <SetPower {setPower} />
29
- </MutationView>
28
+ <ApiSection
29
+ class="flex-row flex-wrap gap-2"
30
+ method="SetPower"
31
+ api={ResourceTriplets.Motor}
32
+ mutations={[setPowerMutation]}
33
+ >
34
+ <div class="flex grow flex-wrap justify-between gap-2">
35
+ <SetPower {setPower} />
36
+ </div>
37
+ </ApiSection>
@@ -2,7 +2,8 @@
2
2
  import { MotorClient } 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 { ResourceTriplets } from '../../../resource-triplet'
6
7
 
7
8
  import SetRPM from './set-rpm.svelte'
8
9
 
@@ -24,6 +25,13 @@
24
25
  const setRPM = (val: number) => setRPMMutation.mutate([val], {})
25
26
  </script>
26
27
 
27
- <MutationView lastError={setRPMMutation.error}>
28
- <SetRPM {setRPM} />
29
- </MutationView>
28
+ <ApiSection
29
+ class="flex-row flex-wrap gap-2"
30
+ method="SetRPM"
31
+ api={ResourceTriplets.Motor}
32
+ mutations={[setRPMMutation]}
33
+ >
34
+ <div class="flex grow flex-wrap justify-between gap-2">
35
+ <SetRPM {setRPM} />
36
+ </div>
37
+ </ApiSection>
@@ -3,7 +3,7 @@
3
3
  import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
4
4
 
5
5
  import ApiSection from '../../api-section.svelte'
6
- import Query from '../../query.svelte'
6
+ import { ResourceTriplets } from '../../../resource-triplet'
7
7
 
8
8
  import Accuracy from './accuracy.svelte'
9
9
 
@@ -24,15 +24,12 @@
24
24
  </script>
25
25
 
26
26
  <ApiSection
27
- title="GetAccuracy"
28
- class="grow"
27
+ method="GetAccuracy"
28
+ api={ResourceTriplets.MovementSensor}
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
- <Accuracy data={query.data} />
36
- {/if}
37
- </Query>
32
+ {#if query.data !== undefined}
33
+ <Accuracy data={query.data} />
34
+ {/if}
38
35
  </ApiSection>
@@ -3,7 +3,7 @@
3
3
  import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
4
4
 
5
5
  import ApiSection from '../../api-section.svelte'
6
- import Query from '../../query.svelte'
6
+ import { ResourceTriplets } from '../../../resource-triplet'
7
7
 
8
8
  import CompassHeading from './compass-heading.svelte'
9
9
 
@@ -24,15 +24,12 @@
24
24
  </script>
25
25
 
26
26
  <ApiSection
27
- title="GetCompassHeading"
28
- class="grow"
27
+ method="GetCompassHeading"
28
+ api={ResourceTriplets.MovementSensor}
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
- <CompassHeading data={query.data} />
36
- {/if}
37
- </Query>
32
+ {#if query.data !== undefined}
33
+ <CompassHeading data={query.data} />
34
+ {/if}
38
35
  </ApiSection>
@@ -3,7 +3,7 @@
3
3
  import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
4
4
 
5
5
  import ApiSection from '../../api-section.svelte'
6
- import Query from '../../query.svelte'
6
+ import { ResourceTriplets } from '../../../resource-triplet'
7
7
 
8
8
  import Orientation from './orientation.svelte'
9
9
 
@@ -24,15 +24,12 @@
24
24
  </script>
25
25
 
26
26
  <ApiSection
27
- title="GetOrientation"
28
- class="grow"
27
+ method="GetOrientation"
28
+ api={ResourceTriplets.MovementSensor}
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
- <Orientation data={query.data} />
36
- {/if}
37
- </Query>
32
+ {#if query.data !== undefined}
33
+ <Orientation data={query.data} />
34
+ {/if}
38
35
  </ApiSection>
@@ -3,7 +3,7 @@
3
3
  import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
4
4
 
5
5
  import ApiSection from '../../api-section.svelte'
6
- import Query from '../../query.svelte'
6
+ import { ResourceTriplets } from '../../../resource-triplet'
7
7
 
8
8
  import Position from './position.svelte'
9
9
 
@@ -24,15 +24,12 @@
24
24
  </script>
25
25
 
26
26
  <ApiSection
27
- title="GetPosition"
28
- class="grow"
27
+ method="GetPosition"
28
+ api={ResourceTriplets.MovementSensor}
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
- <Position data={query.data} />
36
- {/if}
37
- </Query>
32
+ {#if query.data !== undefined}
33
+ <Position data={query.data} />
34
+ {/if}
38
35
  </ApiSection>