@viamrobotics/test-widgets 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/dist/components/api-section.svelte +58 -50
  2. package/dist/components/api-section.svelte.d.ts +24 -11
  3. package/dist/components/content-rect.svelte +6 -0
  4. package/dist/components/content-rect.svelte.d.ts +1 -0
  5. package/dist/components/error.svelte +9 -0
  6. package/dist/components/error.svelte.d.ts +6 -0
  7. package/dist/components/index.d.ts +4 -2
  8. package/dist/components/index.js +4 -2
  9. package/dist/components/is-moving.svelte +26 -34
  10. package/dist/components/is-moving.svelte.d.ts +4 -5
  11. package/dist/components/progress.svelte +1 -0
  12. package/dist/components/queries.svelte +7 -0
  13. package/dist/components/queries.svelte.d.ts +4 -0
  14. package/dist/components/query.svelte +7 -0
  15. package/dist/components/query.svelte.d.ts +4 -0
  16. package/dist/components/section/index.d.ts +2 -0
  17. package/dist/components/section/index.js +2 -0
  18. package/dist/components/section/section-error-reporter.d.ts +8 -0
  19. package/dist/components/section/section-error-reporter.js +7 -0
  20. package/dist/components/section/section-error.svelte +36 -0
  21. package/dist/components/section/section-error.svelte.d.ts +9 -0
  22. package/dist/components/section/section-errors.svelte +132 -5
  23. package/dist/components/section/section.svelte +7 -1
  24. package/dist/components/section/section.svelte.d.ts +3 -0
  25. package/dist/components/section/use-section-errors.svelte.d.ts +1 -0
  26. package/dist/components/section/use-section-errors.svelte.js +11 -1
  27. package/dist/components/stop-button.svelte +1 -5
  28. package/dist/components/stop-button.svelte.d.ts +0 -1
  29. package/dist/components/stop.svelte +2 -2
  30. package/dist/components/widgets/arm/arm.svelte +24 -32
  31. package/dist/components/widgets/arm/get-joint-positions-widget.svelte +9 -8
  32. package/dist/components/widgets/arm/manual-mode-widget.svelte +13 -4
  33. package/dist/components/widgets/arm/manual-mode.svelte +1 -5
  34. package/dist/components/widgets/arm/manual-mode.svelte.d.ts +0 -1
  35. package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +10 -4
  36. package/dist/components/widgets/arm/move-to-joint-positions.svelte +1 -11
  37. package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +0 -1
  38. package/dist/components/widgets/arm/move-to-position-control.svelte +22 -18
  39. package/dist/components/widgets/arm/move-to-position.svelte +0 -4
  40. package/dist/components/widgets/arm/move-to-position.svelte.d.ts +0 -1
  41. package/dist/components/widgets/arm/quick-move-widget.svelte +10 -4
  42. package/dist/components/widgets/arm/quick-move.svelte +1 -4
  43. package/dist/components/widgets/arm/quick-move.svelte.d.ts +0 -1
  44. package/dist/components/widgets/audio-input/audio-input.svelte +76 -74
  45. package/dist/components/widgets/audio-input/get-properties-widget.svelte +15 -15
  46. package/dist/components/widgets/audio-output/audio-output.svelte +83 -81
  47. package/dist/components/widgets/audio-output/get-properties-widget.svelte +15 -15
  48. package/dist/components/widgets/base/base.svelte +70 -37
  49. package/dist/components/widgets/base/move-straight-widget.svelte +16 -4
  50. package/dist/components/widgets/base/quick-move-widget.svelte +25 -9
  51. package/dist/components/widgets/base/set-power-widget.svelte +20 -8
  52. package/dist/components/widgets/base/set-velocity-widget.svelte +20 -8
  53. package/dist/components/widgets/base/spin-widget.svelte +20 -8
  54. package/dist/components/widgets/board/read-write-pins.svelte +2 -2
  55. package/dist/components/widgets/button/push.svelte +2 -2
  56. package/dist/components/widgets/camera/camera.svelte +15 -23
  57. package/dist/components/widgets/camera/live-or-polling-video.svelte +12 -9
  58. package/dist/components/widgets/custom-control/__tests__/__fixtures__/with-sibling.svelte +10 -0
  59. package/dist/components/widgets/custom-control/control-frame.svelte +60 -0
  60. package/dist/components/widgets/custom-control/control-frame.svelte.d.ts +10 -0
  61. package/dist/components/widgets/custom-control/create-control-host.svelte.d.ts +19 -0
  62. package/dist/components/widgets/custom-control/create-control-host.svelte.js +26 -0
  63. package/dist/components/widgets/custom-control/custom-control.d.ts +35 -0
  64. package/dist/components/widgets/custom-control/custom-control.js +85 -0
  65. package/dist/components/widgets/custom-control/custom-control.svelte +45 -0
  66. package/dist/components/widgets/custom-control/custom-control.svelte.d.ts +14 -0
  67. package/dist/components/widgets/discovery/discovery.svelte +10 -15
  68. package/dist/components/widgets/encoder/encoder.svelte +20 -18
  69. package/dist/components/widgets/encoder/get-position-widget.svelte +18 -15
  70. package/dist/components/widgets/gantry/gantry.svelte +50 -74
  71. package/dist/components/widgets/gantry/get-position-widget.svelte +14 -13
  72. package/dist/components/widgets/gantry/home.svelte +21 -10
  73. package/dist/components/widgets/gantry/move-to-position-widget.svelte +2 -1
  74. package/dist/components/widgets/gantry/move-to-position.svelte +1 -4
  75. package/dist/components/widgets/gantry/move-to-position.svelte.d.ts +0 -1
  76. package/dist/components/widgets/gantry/quick-move-widget.svelte +2 -1
  77. package/dist/components/widgets/gantry/quick-move.svelte +1 -5
  78. package/dist/components/widgets/gantry/quick-move.svelte.d.ts +0 -1
  79. package/dist/components/widgets/generic/generic.svelte +7 -5
  80. package/dist/components/widgets/gripper/grab-widget.svelte +26 -0
  81. package/dist/components/widgets/gripper/grab-widget.svelte.d.ts +7 -0
  82. package/dist/components/widgets/gripper/grab.svelte +3 -19
  83. package/dist/components/widgets/gripper/grab.svelte.d.ts +1 -2
  84. package/dist/components/widgets/gripper/gripper.svelte +10 -12
  85. package/dist/components/widgets/gripper/is-holding-something.svelte +18 -19
  86. package/dist/components/widgets/gripper/open-widget.svelte +26 -0
  87. package/dist/components/widgets/gripper/open-widget.svelte.d.ts +7 -0
  88. package/dist/components/widgets/gripper/open.svelte +3 -19
  89. package/dist/components/widgets/gripper/open.svelte.d.ts +1 -2
  90. package/dist/components/widgets/input-controller/input-controller.svelte +7 -14
  91. package/dist/components/widgets/input-controller/webgamepad.svelte +2 -2
  92. package/dist/components/widgets/motion/motion.svelte +27 -35
  93. package/dist/components/widgets/motion/move-widget.svelte +32 -12
  94. package/dist/components/widgets/motion/move-widget.svelte.d.ts +6 -0
  95. package/dist/components/widgets/motion/move.svelte +1 -13
  96. package/dist/components/widgets/motion/move.svelte.d.ts +0 -1
  97. package/dist/components/widgets/motor/go-for-view.svelte +16 -8
  98. package/dist/components/widgets/motor/go-to-view.svelte +12 -4
  99. package/dist/components/widgets/motor/motor.svelte +88 -54
  100. package/dist/components/widgets/motor/quick-move-widget.svelte +16 -8
  101. package/dist/components/widgets/motor/set-power-widget.svelte +12 -4
  102. package/dist/components/widgets/motor/set-rpm-widget.svelte +12 -4
  103. package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +7 -10
  104. package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +7 -10
  105. package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +7 -10
  106. package/dist/components/widgets/movement-sensor/get-position-widget.svelte +7 -10
  107. package/dist/components/widgets/movement-sensor/movement-sensor.svelte +55 -56
  108. package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +2 -1
  109. package/dist/components/widgets/power-sensor/get-current-widget.svelte +7 -10
  110. package/dist/components/widgets/power-sensor/get-power-widget.svelte +7 -10
  111. package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +7 -10
  112. package/dist/components/widgets/power-sensor/power-sensor.svelte +26 -38
  113. package/dist/components/widgets/sensor/sensor.svelte +5 -10
  114. package/dist/components/widgets/servo/move-widget.svelte +2 -1
  115. package/dist/components/widgets/servo/move.svelte +1 -4
  116. package/dist/components/widgets/servo/move.svelte.d.ts +0 -1
  117. package/dist/components/widgets/servo/quick-move-widget.svelte +2 -1
  118. package/dist/components/widgets/servo/quick-move.svelte +1 -5
  119. package/dist/components/widgets/servo/quick-move.svelte.d.ts +0 -1
  120. package/dist/components/widgets/servo/servo.svelte +44 -33
  121. package/dist/components/widgets/slam/get-position-widget.svelte +7 -10
  122. package/dist/components/widgets/slam/move-on-map.svelte +6 -5
  123. package/dist/components/widgets/slam/move-on-map.svelte.d.ts +2 -1
  124. package/dist/components/widgets/slam/slam.svelte +64 -79
  125. package/dist/components/widgets/switch/position.svelte +2 -2
  126. package/package.json +3 -2
  127. package/dist/components/mutation-section.svelte +0 -75
  128. package/dist/components/mutation-section.svelte.d.ts +0 -18
  129. package/dist/components/mutation-view.svelte +0 -29
  130. package/dist/components/mutation-view.svelte.d.ts +0 -10
  131. package/dist/components/section-title.svelte +0 -65
  132. package/dist/components/section-title.svelte.d.ts +0 -15
@@ -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,8 +9,8 @@
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
16
  import { ResourceTriplets } from '../../../resource-triplet'
@@ -54,6 +54,8 @@
54
54
  const goToMutation = createResourceMutation(client, 'goTo')
55
55
  const stopMutation = createResourceMutation(client, 'stop')
56
56
 
57
+ const quickMoveErrors = useSectionErrors(() => ({ mutations: [quickSetPowerMutation] }))
58
+
57
59
  const setPower = (val: number) => {
58
60
  setPowerMutation.mutate([val], {})
59
61
  }
@@ -80,56 +82,85 @@
80
82
  <div class="@container">
81
83
  <div class="flex flex-col divide-y @2xl:flex-row @2xl:divide-x @2xl:divide-y-0">
82
84
  <div class="flex w-full flex-col divide-y">
83
- <MutationSection
84
- title="Quick move"
85
- lastError={quickSetPowerMutation.error}
85
+ <Section
86
+ errorReporter={quickMoveErrors}
87
+ class="flex-row flex-wrap gap-2"
86
88
  >
87
- <QuickMove setPower={quickSetPower} />
88
- </MutationSection>
89
- <MutationSection
90
- title="SetPower"
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"
91
106
  api={ResourceTriplets.Motor}
92
- description="Move continuously"
93
- lastError={setPowerMutation.error}
107
+ mutations={[setPowerMutation]}
94
108
  >
95
- <SetPower {setPower} />
96
- </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>
97
114
  {#if propertiesQuery.data?.positionReporting}
98
- <MutationSection
99
- title="SetRPM"
115
+ <ApiSection
116
+ class="flex-row flex-wrap gap-2"
117
+ method="SetRPM"
100
118
  api={ResourceTriplets.Motor}
101
- description="Move indefinitely at a specified speed."
102
- lastError={setRPMMutation.error}
119
+ mutations={[setRPMMutation]}
103
120
  >
104
- <SetRPM {setRPM} />
105
- </MutationSection>
106
- <MutationSection
107
- title="GoFor"
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"
108
131
  api={ResourceTriplets.Motor}
109
- description="Move a specified number of revolutions"
110
- lastError={goForMutation.error}
132
+ mutations={[goForMutation]}
111
133
  >
112
- <GoFor {goFor} />
113
- </MutationSection>
114
- <MutationSection
115
- title="GoTo"
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"
116
144
  api={ResourceTriplets.Motor}
117
- description="Turn to a specified position"
118
- lastError={goToMutation.error}
145
+ mutations={[goToMutation]}
119
146
  >
120
- <GoTo {goTo} />
121
- </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>
122
153
  {/if}
123
154
  </div>
124
155
 
125
156
  <div class="flex w-full flex-col divide-y @2xl:ml-auto @2xl:max-w-1/2 @4xl:max-w-1/3">
126
157
  <ApiSection
127
158
  class="grow flex-col gap-4"
128
- title="Stop"
159
+ method="Stop"
129
160
  api={ResourceTriplets.Motor}
161
+ mutations={[stopMutation]}
130
162
  >
131
163
  <StopButton
132
- error={stopMutation.error}
133
164
  onStop={() => {
134
165
  stopMutation.mutate([])
135
166
  }}
@@ -143,39 +174,42 @@
143
174
  >
144
175
  <div class="flex flex-col gap-6 pt-2">
145
176
  <ApiSection
146
- title="IsPowered"
177
+ method="IsPowered"
147
178
  api={ResourceTriplets.Motor}
179
+ queries={[isPoweredQuery]}
148
180
  class="grow flex-col gap-3 p-0!"
149
- tooltip="Returns whether or not the motor is running and the current portion of max power.
150
-
151
- Stepper motors will report ”true” if they are being powered while holding
152
- a position and while they are turning."
153
181
  >
154
- <Query query={isPoweredQuery}>
155
- {#if isPoweredQuery.data !== undefined}
156
- {@const [isPowered, powerPct] = isPoweredQuery.data}
157
- <span class="font-roboto-mono flex flex-row gap-1 text-xs">
158
- <p class="text-default">{isPowered}</p>
159
- <p class="text-disabled">/</p>
160
- <p class="text-subtle-1">
161
- {formatNumeric(powerPct * 100, 1)}%
162
- </p>
163
- </span>
164
- {/if}
165
- </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}
166
197
  </ApiSection>
167
198
  {#if propertiesQuery.data?.positionReporting === true}
168
199
  <ApiSection
169
- title="GetPosition"
200
+ method="GetPosition"
170
201
  api={ResourceTriplets.Motor}
202
+ queries={[positionQuery]}
171
203
  class="grow flex-col gap-3 p-0!"
172
- tooltip="Reports the position of an encoded motor in revolutions from zero/home."
173
204
  >
174
- <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}
175
209
  <p class="font-roboto-mono text-default text-xs">
176
210
  {formatNumeric(positionQuery.data, 4)}
177
211
  </p>
178
- </Query>
212
+ {/if}
179
213
  </ApiSection>
180
214
  {/if}
181
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"
27
+ method="GetAccuracy"
28
+ api={ResourceTriplets.MovementSensor}
29
+ queries={[query]}
28
30
  class="grow flex-col gap-4"
29
31
  >
30
- <Query
31
- {query}
32
- class="h-6"
33
- >
34
- {#if query.data !== undefined}
35
- <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"
27
+ method="GetCompassHeading"
28
+ api={ResourceTriplets.MovementSensor}
29
+ queries={[query]}
28
30
  class="grow flex-col gap-4"
29
31
  >
30
- <Query
31
- {query}
32
- class="h-6"
33
- >
34
- {#if query.data !== undefined}
35
- <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"
27
+ method="GetOrientation"
28
+ api={ResourceTriplets.MovementSensor}
29
+ queries={[query]}
28
30
  class="grow flex-col gap-4"
29
31
  >
30
- <Query
31
- {query}
32
- class="h-6"
33
- >
34
- {#if query.data !== undefined}
35
- <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"
27
+ method="GetPosition"
28
+ api={ResourceTriplets.MovementSensor}
29
+ queries={[query]}
28
30
  class="grow flex-col gap-4"
29
31
  >
30
- <Query
31
- {query}
32
- class="h-6"
33
- >
34
- {#if query.data !== undefined}
35
- <Position data={query.data} />
36
- {/if}
37
- </Query>
32
+ {#if query.data !== undefined}
33
+ <Position data={query.data} />
34
+ {/if}
38
35
  </ApiSection>
@@ -9,7 +9,7 @@
9
9
  import ReadingsList from '../../readings-list.svelte'
10
10
  import RefetchController from '../../refetch-controller.svelte'
11
11
  import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
12
- import SectionTitle from '../../section-title.svelte'
12
+ import { Section } from '../../section'
13
13
  import { ResourceTriplets } from '../../../resource-triplet'
14
14
 
15
15
  import Accuracy from './accuracy.svelte'
@@ -85,8 +85,6 @@
85
85
  enabled: showFullReadings,
86
86
  refetchInterval: refetchInterval.current,
87
87
  }))
88
-
89
- const headingID = $props.id()
90
88
  </script>
91
89
 
92
90
  <ConnectionStatus {partID}>
@@ -107,10 +105,12 @@
107
105
  <div class="flex w-full flex-col gap-5 py-4 pr-6 pl-4 @4xl:w-1/4">
108
106
  {#if propertiesQuery.data?.positionSupported}
109
107
  <div class="flex flex-col gap-2">
110
- <SectionTitle
111
- title="GetPosition"
112
- api={ResourceTriplets.MovementSensor}
113
- />
108
+ <Section.Heading>
109
+ <Section.Method
110
+ method="GetPosition"
111
+ api={ResourceTriplets.MovementSensor}
112
+ />
113
+ </Section.Heading>
114
114
  <Query
115
115
  query={positionQuery}
116
116
  class="h-6"
@@ -124,13 +124,13 @@
124
124
 
125
125
  {#if propertiesQuery.data?.orientationSupported}
126
126
  <div class="flex flex-col gap-2">
127
- <SectionTitle
128
- title="GetOrientation"
129
- api={ResourceTriplets.MovementSensor}
130
- >
131
- {#snippet suffix()}<span class="text-subtle-2 text-xs font-normal">(º)</span
132
- >{/snippet}
133
- </SectionTitle>
127
+ <Section.Heading>
128
+ <Section.Method
129
+ method="GetOrientation"
130
+ api={ResourceTriplets.MovementSensor}
131
+ />
132
+ <span class="text-subtle-2 text-xs font-normal">(º)</span>
133
+ </Section.Heading>
134
134
  <Query
135
135
  query={orientationQuery}
136
136
  class="h-6"
@@ -144,13 +144,13 @@
144
144
 
145
145
  {#if propertiesQuery.data?.compassHeadingSupported}
146
146
  <div class="flex flex-col gap-2">
147
- <SectionTitle
148
- title="GetCompassHeading"
149
- api={ResourceTriplets.MovementSensor}
150
- >
151
- {#snippet suffix()}<span class="text-subtle-2 text-xs font-normal">(º)</span
152
- >{/snippet}
153
- </SectionTitle>
147
+ <Section.Heading>
148
+ <Section.Method
149
+ method="GetCompassHeading"
150
+ api={ResourceTriplets.MovementSensor}
151
+ />
152
+ <span class="text-subtle-2 text-xs font-normal">(º)</span>
153
+ </Section.Heading>
154
154
  <Query
155
155
  query={compassHeadingQuery}
156
156
  class="h-6"
@@ -166,13 +166,13 @@
166
166
  <div class="flex w-full flex-col gap-5 p-4 @4xl:w-1/4">
167
167
  {#if propertiesQuery.data?.angularVelocitySupported}
168
168
  <div class="flex flex-col gap-2">
169
- <SectionTitle
170
- title="GetAngularVelocity"
171
- api={ResourceTriplets.MovementSensor}
172
- >
173
- {#snippet suffix()}<span class="text-subtle-2 text-xs font-normal">(º/s)</span
174
- >{/snippet}
175
- </SectionTitle>
169
+ <Section.Heading>
170
+ <Section.Method
171
+ method="GetAngularVelocity"
172
+ api={ResourceTriplets.MovementSensor}
173
+ />
174
+ <span class="text-subtle-2 text-xs font-normal">(º/s)</span>
175
+ </Section.Heading>
176
176
  <Query
177
177
  query={angularVelocityQuery}
178
178
  class="h-6"
@@ -186,13 +186,13 @@
186
186
 
187
187
  {#if propertiesQuery.data?.linearVelocitySupported}
188
188
  <div class="flex flex-col gap-2">
189
- <SectionTitle
190
- title="GetLinearVelocity"
191
- api={ResourceTriplets.MovementSensor}
192
- >
193
- {#snippet suffix()}<span class="text-subtle-2 text-xs font-normal">(m/s)</span
194
- >{/snippet}
195
- </SectionTitle>
189
+ <Section.Heading>
190
+ <Section.Method
191
+ method="GetLinearVelocity"
192
+ api={ResourceTriplets.MovementSensor}
193
+ />
194
+ <span class="text-subtle-2 text-xs font-normal">(m/s)</span>
195
+ </Section.Heading>
196
196
  <Query
197
197
  query={linearVelocityQuery}
198
198
  class="h-6"
@@ -206,14 +206,13 @@
206
206
 
207
207
  {#if propertiesQuery.data?.linearAccelerationSupported}
208
208
  <div class="flex flex-col gap-2">
209
- <SectionTitle
210
- title="GetLinearAcceleration"
211
- api={ResourceTriplets.MovementSensor}
212
- >
213
- {#snippet suffix()}<span class="text-subtle-2 text-xs font-normal"
214
- >(m/s<sup>2</sup>)</span
215
- >{/snippet}
216
- </SectionTitle>
209
+ <Section.Heading>
210
+ <Section.Method
211
+ method="GetLinearAcceleration"
212
+ api={ResourceTriplets.MovementSensor}
213
+ />
214
+ <span class="text-subtle-2 text-xs font-normal">(m/s<sup>2</sup>)</span>
215
+ </Section.Heading>
217
216
  <Query
218
217
  query={linearAccelerationQuery}
219
218
  class="h-6"
@@ -226,10 +225,12 @@
226
225
  {/if}
227
226
 
228
227
  <div class="flex flex-col gap-2">
229
- <SectionTitle
230
- title="GetAccuracy"
231
- api={ResourceTriplets.MovementSensor}
232
- />
228
+ <Section.Heading>
229
+ <Section.Method
230
+ method="GetAccuracy"
231
+ api={ResourceTriplets.MovementSensor}
232
+ />
233
+ </Section.Heading>
233
234
  <Query
234
235
  query={accuracyQuery}
235
236
  class="h-6"
@@ -251,16 +252,14 @@
251
252
  </div>
252
253
  </Query>
253
254
 
254
- <section
255
- class="flex flex-col gap-4 p-4"
256
- aria-labelledby={headingID}
257
- >
255
+ <section class="flex flex-col gap-4 p-4">
258
256
  <div class="flex flex-col gap-0.5">
259
- <SectionTitle
260
- title="GetReadings"
261
- api={ResourceTriplets.MovementSensor}
262
- headingId={headingID}
263
- />
257
+ <Section.Heading>
258
+ <Section.Method
259
+ method="GetReadings"
260
+ api={ResourceTriplets.MovementSensor}
261
+ />
262
+ </Section.Heading>
264
263
  <p class="text-subtle-2 text-xs">Get all the measurements and data from the sensor</p>
265
264
  </div>
266
265
 
@@ -4,6 +4,7 @@
4
4
  import { slide } from 'svelte/transition'
5
5
 
6
6
  import ErrorDisplay from '../../error.svelte'
7
+ import { Section } from '../../section'
7
8
 
8
9
  import OperationsTable from './operations-table.svelte'
9
10
  import RttPill from './rtt-pill.svelte'
@@ -98,7 +99,7 @@
98
99
  />
99
100
  {/if}
100
101
  <ErrorDisplay lastError={operationsQuery.error} />
101
- <ErrorDisplay lastError={cancelOperationMutation.error} />
102
+ <Section.Error error={cancelOperationMutation.error} />
102
103
  </div>
103
104
  <div class="flex h-max flex-col gap-2">
104
105
  <span class="text-default text-sm font-semibold">Sessions</span>