@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
@@ -9,9 +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 Query from '../../query.svelte'
12
+ import { Section } from '../../section'
13
+ import { useSectionErrors } from '../../section/use-section-errors.svelte'
13
14
  import StopButton from '../../stop-button.svelte'
14
15
  import { formatNumeric } from '../../../format'
16
+ import { ResourceTriplets } from '../../../resource-triplet'
15
17
 
16
18
  import Move from './move.svelte'
17
19
  import QuickMove from './quick-move.svelte'
@@ -37,6 +39,11 @@
37
39
  const quickMoveMutation = createResourceMutation(client, 'move')
38
40
  const stopMutation = createResourceMutation(client, 'stop')
39
41
 
42
+ const quickMoveErrors = useSectionErrors(() => ({
43
+ queries: [positionQuery],
44
+ mutations: [quickMoveMutation],
45
+ }))
46
+
40
47
  const moveTo = (angle: number) => {
41
48
  moveMutation.mutate([angle], {})
42
49
  }
@@ -53,59 +60,68 @@
53
60
  <div class="@container grow">
54
61
  <div class="grid grid-cols-1 divide-y @2xl:grid-cols-3 @2xl:divide-x @2xl:divide-y-0">
55
62
  <ApiSection
56
- title="GetPosition"
57
- api="rdk:component:servo"
58
- bottomText="Updates automatically"
63
+ class="grow flex-col gap-4"
64
+ method="GetPosition"
65
+ api={ResourceTriplets.Servo}
66
+ queries={[positionQuery]}
59
67
  >
60
- <Query query={positionQuery}>
61
- {#if positionQuery.data !== undefined}
62
- <!-- span required to get unit closer to position reading -->
63
- <span class="flex flex-row gap-1">
64
- <span class="font-roboto-mono font-normal"
65
- >{formatNumeric(positionQuery.data)}</span
66
- >
67
- <abbr class="text-subtle-2">º</abbr>
68
- </span>
69
- {/if}
70
- </Query>
68
+ {#if positionQuery.data !== undefined}
69
+ <!-- span required to get unit closer to position reading -->
70
+ <span class="flex flex-row gap-1">
71
+ <span class="font-roboto-mono font-normal"
72
+ >{formatNumeric(positionQuery.data)}</span
73
+ >
74
+ <abbr class="text-subtle-2">º</abbr>
75
+ </span>
76
+ {/if}
77
+ <Section.Text class="mt-auto">Updates automatically</Section.Text>
71
78
  </ApiSection>
72
79
  <ApiSection
73
- title="Move"
74
- api="rdk:component:servo"
80
+ class="grow flex-col gap-4"
81
+ method="Move"
82
+ api={ResourceTriplets.Servo}
83
+ queries={[positionQuery]}
84
+ mutations={[moveMutation]}
75
85
  >
76
- <Query query={positionQuery}>
77
- {#if positionQuery.data !== undefined}
78
- <Move
79
- currentPosition={positionQuery.data}
80
- {moveTo}
81
- lastError={moveMutation.error}
82
- />
83
- {/if}
84
- </Query>
86
+ {#if positionQuery.data !== undefined}
87
+ <Move
88
+ currentPosition={positionQuery.data}
89
+ {moveTo}
90
+ />
91
+ {/if}
85
92
  </ApiSection>
86
- <ApiSection
87
- title="Quick move"
88
- bottomText="Press a button to execute"
93
+ <Section
94
+ errorReporter={quickMoveErrors}
95
+ class="grow flex-col gap-4"
89
96
  >
90
- <Query query={positionQuery}>
97
+ <div class="flex flex-col gap-0.5">
98
+ <Section.Heading>
99
+ Quick move
100
+ {#snippet aside()}
101
+ <Section.Errors errors={quickMoveErrors.errors} />
102
+ {/snippet}
103
+ </Section.Heading>
104
+ </div>
105
+ <Section.Body isLoading={quickMoveErrors.isLoading}>
91
106
  {#if positionQuery.data !== undefined}
92
107
  <QuickMove
93
108
  currentPosition={positionQuery.data}
94
109
  moveTo={quickMoveTo}
95
- lastError={quickMoveMutation.error}
96
110
  />
97
111
  {/if}
98
- </Query>
99
- </ApiSection>
112
+ <Section.Text class="mt-auto">Press a button to execute</Section.Text>
113
+ </Section.Body>
114
+ </Section>
100
115
  </div>
101
116
  </div>
102
117
  <div class="flex flex-col divide-y @4xl:ml-auto @4xl:w-full @4xl:max-w-40">
103
118
  <ApiSection
104
- title="Stop"
105
- api="rdk:component:servo"
119
+ class="grow flex-col gap-4"
120
+ method="Stop"
121
+ api={ResourceTriplets.Servo}
122
+ mutations={[stopMutation]}
106
123
  >
107
124
  <StopButton
108
- error={stopMutation.error}
109
125
  onStop={() => {
110
126
  stopMutation.mutate([])
111
127
  }}
@@ -113,7 +129,7 @@
113
129
  </ApiSection>
114
130
  <IsMoving
115
131
  client={ServoClient}
116
- api="rdk:component:servo"
132
+ api={ResourceTriplets.Servo}
117
133
  {partID}
118
134
  {resourceName}
119
135
  />
@@ -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.Slam}
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 position={query.data} />
36
- {/if}
37
- </Query>
32
+ {#if query.data !== undefined}
33
+ <Position position={query.data} />
34
+ {/if}
38
35
  </ApiSection>
@@ -1,9 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { Button, Label, NumericInput } from '@viamrobotics/prime-core'
3
3
 
4
+ import type { SectionMutation } from '../../section/use-section-errors.svelte'
5
+
4
6
  import ApiSection from '../../api-section.svelte'
5
- import ErrorDisplay from '../../error.svelte'
6
7
  import { numberValueFromEvent } from '../../../event-handlers'
8
+ import { ResourceTriplets } from '../../../resource-triplet'
7
9
 
8
10
  import type { PosePosition } from './pose'
9
11
 
@@ -12,10 +14,10 @@
12
14
  updateDestination: (_: Partial<PosePosition>) => void
13
15
  moveOnMap: (planDeviationM: number | undefined) => void
14
16
  stopPlan: () => void
15
- lastError: Error | null
17
+ mutations: SectionMutation[]
16
18
  }
17
19
 
18
- const { destination, updateDestination, moveOnMap, stopPlan, lastError }: Props = $props()
20
+ const { destination, updateDestination, moveOnMap, stopPlan, mutations }: Props = $props()
19
21
 
20
22
  const destinationID = $props.id()
21
23
 
@@ -23,8 +25,10 @@
23
25
  </script>
24
26
 
25
27
  <ApiSection
26
- title="MoveOnMap"
27
- api="rdk:service:motion"
28
+ class="grow flex-col gap-4"
29
+ method="MoveOnMap"
30
+ api={ResourceTriplets.Motion}
31
+ {mutations}
28
32
  >
29
33
  <Label>
30
34
  Plan deviation <abbr>(m)</abbr>
@@ -100,5 +104,4 @@
100
104
  Stop
101
105
  </Button>
102
106
  </div>
103
- <ErrorDisplay {lastError} />
104
107
  </ApiSection>
@@ -1,10 +1,11 @@
1
+ import type { SectionMutation } from '../../section/use-section-errors.svelte';
1
2
  import type { PosePosition } from './pose';
2
3
  interface Props {
3
4
  destination: PosePosition | undefined;
4
5
  updateDestination: (_: Partial<PosePosition>) => void;
5
6
  moveOnMap: (planDeviationM: number | undefined) => void;
6
7
  stopPlan: () => void;
7
- lastError: Error | null;
8
+ mutations: SectionMutation[];
8
9
  }
9
10
  declare const MoveOnMap: import("svelte").Component<Props, {}, "">;
10
11
  type MoveOnMap = ReturnType<typeof MoveOnMap>;
@@ -16,14 +16,14 @@
16
16
 
17
17
  import ApiSection from '../../api-section.svelte'
18
18
  import ConnectionStatus from '../../connection-status.svelte'
19
- import Queries from '../../queries.svelte'
20
- import Query from '../../query.svelte'
21
19
  import RefetchController from '../../refetch-controller.svelte'
22
20
  import {
23
21
  createRefetchIntervalStore,
24
22
  RefetchIntervals,
25
23
  } from '../../refetch-interval-store.svelte'
24
+ import { Section } from '../../section'
26
25
  import SlamMap2D from '../../slam/map2d/index.svelte'
26
+ import { ResourceTriplets } from '../../../resource-triplet'
27
27
 
28
28
  import type { PosePosition } from './pose'
29
29
 
@@ -178,44 +178,41 @@
178
178
 
179
179
  <ConnectionStatus {partID}>
180
180
  {#snippet connected()}
181
- <Query
182
- query={propertiesQuery}
183
- contentCx="p-4 h-14"
184
- >
185
- {#if propertiesQuery.data?.cloudSlam}
186
- <div class="p-4 text-sm">
187
- This resource is using Cloud SLAM. <a
188
- href="https://docs.viam.com/operate/reference/services/slam/cloudslam/"
189
- target="_blank"
190
- class="text-link">Learn more</a
191
- >.
192
- </div>
193
- {:else}
194
- <div class="@container">
195
- <div class="flex flex-col @2xl:flex-row @2xl:divide-x">
196
- <div class="divide-y">
197
- <div class="m-4">
198
- <RefetchController
199
- {refetchInterval}
200
- queries={[positionQuery, pointCloudMapQuery]}
201
- />
202
- </div>
181
+ {#if propertiesQuery.data?.cloudSlam}
182
+ <div class="p-4 text-sm">
183
+ This resource is using Cloud SLAM. <a
184
+ href="https://docs.viam.com/operate/reference/services/slam/cloudslam/"
185
+ target="_blank"
186
+ class="text-link">Learn more</a
187
+ >.
188
+ </div>
189
+ {:else}
190
+ <div class="@container">
191
+ <div class="flex flex-col @2xl:flex-row @2xl:divide-x">
192
+ <div class="divide-y">
193
+ <div class="m-4">
194
+ <RefetchController
195
+ {refetchInterval}
196
+ queries={[positionQuery, pointCloudMapQuery]}
197
+ />
198
+ </div>
203
199
 
204
- <ApiSection
205
- title="GetPosition"
206
- api="rdk:service:slam"
207
- >
208
- <Queries
209
- queries={[propertiesQuery, positionQuery]}
210
- contentCx="h-6"
211
- >
212
- {#if positionQuery.data !== undefined}
213
- <Position position={positionQuery.data} />
214
- {/if}
215
- </Queries>
216
- </ApiSection>
200
+ <ApiSection
201
+ class="grow flex-col gap-4"
202
+ method="GetPosition"
203
+ api={ResourceTriplets.Slam}
204
+ queries={[propertiesQuery, positionQuery, pointCloudMapQuery]}
205
+ >
206
+ {#if positionQuery.data !== undefined}
207
+ <Position position={positionQuery.data} />
208
+ {/if}
209
+ </ApiSection>
217
210
 
218
- <ApiSection title="Motion">
211
+ <Section class="grow flex-col gap-4">
212
+ <div class="flex flex-col gap-0.5">
213
+ <Section.Heading>Motion</Section.Heading>
214
+ </div>
215
+ <Section.Body>
219
216
  <Label>
220
217
  Base name
221
218
 
@@ -233,46 +230,39 @@
233
230
  bind:value={motionName}
234
231
  />
235
232
  </Label>
236
- </ApiSection>
233
+ </Section.Body>
234
+ </Section>
237
235
 
238
- <MoveOnMap
239
- {destination}
240
- {updateDestination}
241
- {moveOnMap}
242
- {stopPlan}
243
- lastError={moveOnMapMutation.error ?? stopPlanMutation.error}
244
- />
245
- </div>
236
+ <MoveOnMap
237
+ {destination}
238
+ {updateDestination}
239
+ {moveOnMap}
240
+ {stopPlan}
241
+ mutations={[moveOnMapMutation, stopPlanMutation]}
242
+ />
243
+ </div>
246
244
 
247
- <div class="flex w-full">
248
- <Queries
249
- queries={[propertiesQuery, positionQuery, pointCloudMapQuery]}
250
- contentCx="p-4 h-auto"
251
- >
252
- {#if positionQuery.data?.pose !== undefined && pointCloudMapQuery.data !== undefined}
253
- <div class="h-80 w-full @2xl:h-full">
254
- <SlamMap2D
255
- pointcloud={pointCloudMapQuery.data}
256
- basePose={{
257
- // Position is returned in millimeters, but the map uses meters
258
- x: positionQuery.data.pose.x / 1000,
259
- y: positionQuery.data.pose.y / 1000,
260
- theta: positionQuery.data.pose.theta,
261
- }}
262
- {motionPath}
263
- destination={destination
264
- ? new Vector2(destination.x, destination.y)
265
- : undefined}
266
- helpers={true}
267
- onClick={handleClick}
268
- />
269
- </div>
270
- {/if}
271
- </Queries>
272
- </div>
245
+ <div class="flex w-full p-4">
246
+ {#if positionQuery.data?.pose !== undefined && pointCloudMapQuery.data !== undefined}
247
+ <div class="h-80 w-full @2xl:h-full">
248
+ <SlamMap2D
249
+ pointcloud={pointCloudMapQuery.data}
250
+ basePose={{
251
+ // Position is returned in millimeters, but the map uses meters
252
+ x: positionQuery.data.pose.x / 1000,
253
+ y: positionQuery.data.pose.y / 1000,
254
+ theta: positionQuery.data.pose.theta,
255
+ }}
256
+ {motionPath}
257
+ destination={destination ? new Vector2(destination.x, destination.y) : undefined}
258
+ helpers={true}
259
+ onClick={handleClick}
260
+ />
261
+ </div>
262
+ {/if}
273
263
  </div>
274
264
  </div>
275
- {/if}
276
- </Query>
265
+ </div>
266
+ {/if}
277
267
  {/snippet}
278
268
  </ConnectionStatus>
@@ -45,7 +45,7 @@
45
45
 
46
46
  <Queries
47
47
  queries={[positionQuery, numPositionsQuery]}
48
- contentCx="h-7.5"
48
+ class="h-7.5"
49
49
  >
50
50
  {#if positionQuery.data !== undefined && numPositionsQuery.data !== undefined}
51
51
  <Position
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { ToggleButtons } from '@viamrobotics/prime-core'
3
3
 
4
- import ErrorDisplay from '../../error.svelte'
4
+ import { Section } from '../../section'
5
5
 
6
6
  interface Props {
7
7
  numPositions: number
@@ -39,5 +39,5 @@
39
39
  cx={[{ '[&>div>button]:w-12!': !hasLabels }, 'font-roboto-mono [&>div]:flex-wrap!']}
40
40
  on:input={handleInput}
41
41
  />
42
- <ErrorDisplay {lastError} />
42
+ <Section.Error error={lastError} />
43
43
  </div>
@@ -45,7 +45,7 @@
45
45
  <div class="p-4">
46
46
  <Queries
47
47
  queries={[positionQuery, numPositionsQuery]}
48
- contentCx="h-7.5"
48
+ class="h-7.5"
49
49
  >
50
50
  {#if positionQuery.data !== undefined && numPositionsQuery.data !== undefined}
51
51
  <Position
@@ -1,11 +1,13 @@
1
1
  <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+
2
4
  import type { Detection } from './context.svelte.js'
3
5
 
4
6
  import { useDetections } from './context.svelte.js'
5
7
 
6
8
  interface Props {
7
9
  detection: Detection
8
- label: string
10
+ label: Snippet
9
11
  }
10
12
 
11
13
  let { detection, label }: Props = $props()
@@ -33,6 +35,6 @@
33
35
  context.selected = context.selected === detection.id ? null : detection.id
34
36
  }}
35
37
  >
36
- {label}
38
+ {@render label()}
37
39
  <span class="text-subtle-2 pl-1">{detection.confidence}%</span>
38
40
  </button>
@@ -1,7 +1,8 @@
1
+ import type { Snippet } from 'svelte';
1
2
  import type { Detection } from './context.svelte.ts';
2
3
  interface Props {
3
4
  detection: Detection;
4
- label: string;
5
+ label: Snippet;
5
6
  }
6
7
  declare const DetectionRow: import("svelte").Component<Props, {}, "">;
7
8
  type DetectionRow = ReturnType<typeof DetectionRow>;