@viamrobotics/test-widgets 0.15.1 → 0.16.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 (137) 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 +7 -6
  5. package/dist/components/api-section.svelte.d.ts +4 -3
  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 +4 -5
  11. package/dist/components/content-rect.svelte.d.ts +2 -1
  12. package/dist/components/error.svelte +6 -5
  13. package/dist/components/error.svelte.d.ts +2 -1
  14. package/dist/components/index.d.ts +0 -1
  15. package/dist/components/index.js +0 -1
  16. package/dist/components/is-moving.svelte +4 -2
  17. package/dist/components/is-moving.svelte.d.ts +2 -1
  18. package/dist/components/maplibre/index.svelte +5 -6
  19. package/dist/components/maplibre/index.svelte.d.ts +3 -1
  20. package/dist/components/mutation-section.svelte +7 -5
  21. package/dist/components/mutation-section.svelte.d.ts +4 -2
  22. package/dist/components/pose-editor.svelte +83 -15
  23. package/dist/components/pose-editor.svelte.d.ts +11 -4
  24. package/dist/components/queries.svelte +7 -4
  25. package/dist/components/queries.svelte.d.ts +2 -1
  26. package/dist/components/query.svelte +4 -3
  27. package/dist/components/query.svelte.d.ts +2 -1
  28. package/dist/components/section/error-key.d.ts +2 -0
  29. package/dist/components/section/error-key.js +2 -0
  30. package/dist/components/section/index.d.ts +19 -0
  31. package/dist/components/section/index.js +19 -0
  32. package/dist/components/section/section-body.svelte +36 -0
  33. package/dist/components/section/section-body.svelte.d.ts +13 -0
  34. package/dist/components/section/section-errors.svelte +18 -0
  35. package/dist/components/section/section-errors.svelte.d.ts +6 -0
  36. package/dist/components/section/section-heading.svelte +21 -0
  37. package/dist/components/section/section-heading.svelte.d.ts +9 -0
  38. package/dist/components/section/section-loading.d.ts +4 -0
  39. package/dist/components/section/section-loading.js +10 -0
  40. package/dist/components/section/section-method.svelte +29 -0
  41. package/dist/components/section/section-method.svelte.d.ts +9 -0
  42. package/dist/components/section/section-placeholder.svelte +29 -0
  43. package/dist/components/section/section-placeholder.svelte.d.ts +7 -0
  44. package/dist/components/section/section-text.svelte +17 -0
  45. package/dist/components/section/section-text.svelte.d.ts +8 -0
  46. package/dist/components/section/section-tooltip.svelte +25 -0
  47. package/dist/components/section/section-tooltip.svelte.d.ts +7 -0
  48. package/dist/components/section/section.svelte +17 -0
  49. package/dist/components/section/section.svelte.d.ts +8 -0
  50. package/dist/components/section/use-section-errors.svelte.d.ts +18 -0
  51. package/dist/components/section/use-section-errors.svelte.js +39 -0
  52. package/dist/components/section-title.svelte +3 -1
  53. package/dist/components/section-title.svelte.d.ts +2 -1
  54. package/dist/components/stop.svelte +31 -14
  55. package/dist/components/stop.svelte.d.ts +6 -1
  56. package/dist/components/widgets/arm/arm.svelte +22 -11
  57. package/dist/components/widgets/arm/get-joint-positions-widget.svelte +1 -1
  58. package/dist/components/widgets/arm/joint-position-editor.svelte +105 -27
  59. package/dist/components/widgets/arm/joint-position-editor.svelte.d.ts +4 -3
  60. package/dist/components/widgets/arm/joint-position-slider.svelte +6 -2
  61. package/dist/components/widgets/arm/joint-position-slider.svelte.d.ts +2 -1
  62. package/dist/components/widgets/arm/manual-mode-widget.svelte +3 -2
  63. package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +12 -4
  64. package/dist/components/widgets/arm/move-to-joint-positions.svelte +14 -6
  65. package/dist/components/widgets/arm/move-to-position-control.svelte +25 -17
  66. package/dist/components/widgets/arm/move-to-position.svelte +97 -30
  67. package/dist/components/widgets/arm/move-to-position.svelte.d.ts +3 -1
  68. package/dist/components/widgets/arm/use-arm-motion-tracking.svelte.d.ts +16 -0
  69. package/dist/components/widgets/arm/use-arm-motion-tracking.svelte.js +37 -0
  70. package/dist/components/widgets/arm/use-edited-targets.svelte.d.ts +9 -0
  71. package/dist/components/widgets/arm/use-edited-targets.svelte.js +24 -0
  72. package/dist/components/widgets/audio-input/audio-input.svelte +5 -4
  73. package/dist/components/widgets/audio-input/get-properties-widget.svelte +2 -2
  74. package/dist/components/widgets/audio-output/audio-output.svelte +5 -4
  75. package/dist/components/widgets/audio-output/get-properties-widget.svelte +2 -2
  76. package/dist/components/widgets/base/base.svelte +8 -6
  77. package/dist/components/widgets/base/quick-move.svelte +5 -6
  78. package/dist/components/widgets/base/set-power.svelte +6 -4
  79. package/dist/components/widgets/base/set-velocity.svelte +6 -4
  80. package/dist/components/widgets/base/vec3-builder.svelte +3 -2
  81. package/dist/components/widgets/base/vec3-builder.svelte.d.ts +2 -1
  82. package/dist/components/widgets/board/analog-read.svelte +2 -4
  83. package/dist/components/widgets/board/analog-write.svelte +2 -4
  84. package/dist/components/widgets/board/gpio-read.svelte +2 -1
  85. package/dist/components/widgets/board/gpio-write.svelte +2 -1
  86. package/dist/components/widgets/board/pin-section.svelte +5 -6
  87. package/dist/components/widgets/board/pin-section.svelte.d.ts +3 -2
  88. package/dist/components/widgets/camera/camera.svelte +4 -3
  89. package/dist/components/widgets/camera/live-or-polling-video.svelte +22 -22
  90. package/dist/components/widgets/discovery/discovery.svelte +4 -3
  91. package/dist/components/widgets/encoder/encoder.svelte +5 -3
  92. package/dist/components/widgets/encoder/get-position-widget.svelte +1 -1
  93. package/dist/components/widgets/gantry/gantry.svelte +13 -7
  94. package/dist/components/widgets/gantry/get-position-widget.svelte +1 -1
  95. package/dist/components/widgets/gantry/quick-move-widget.svelte +1 -1
  96. package/dist/components/widgets/generic/generic.svelte +4 -1
  97. package/dist/components/widgets/gripper/gripper.svelte +8 -6
  98. package/dist/components/widgets/gripper/is-holding-something.svelte +3 -2
  99. package/dist/components/widgets/input-controller/input-controller.svelte +4 -3
  100. package/dist/components/widgets/ml-model-service/ml-model-service.svelte +1 -1
  101. package/dist/components/widgets/motion/frame-select.svelte +4 -2
  102. package/dist/components/widgets/motion/frame-select.svelte.d.ts +2 -1
  103. package/dist/components/widgets/motion/motion.svelte +9 -5
  104. package/dist/components/widgets/motion/move.svelte +5 -3
  105. package/dist/components/widgets/motor/motor.svelte +12 -10
  106. package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +2 -2
  107. package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +2 -2
  108. package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +2 -2
  109. package/dist/components/widgets/movement-sensor/get-position-widget.svelte +2 -2
  110. package/dist/components/widgets/movement-sensor/movement-sensor.svelte +17 -18
  111. package/dist/components/widgets/power-sensor/get-current-widget.svelte +2 -2
  112. package/dist/components/widgets/power-sensor/get-power-widget.svelte +2 -2
  113. package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +2 -2
  114. package/dist/components/widgets/power-sensor/power-sensor.svelte +13 -11
  115. package/dist/components/widgets/sensor/sensor.svelte +4 -3
  116. package/dist/components/widgets/servo/servo.svelte +9 -4
  117. package/dist/components/widgets/slam/get-position-widget.svelte +2 -2
  118. package/dist/components/widgets/slam/move-on-map.svelte +3 -1
  119. package/dist/components/widgets/slam/slam.svelte +10 -5
  120. package/dist/components/widgets/switch/position-view.svelte +1 -1
  121. package/dist/components/widgets/switch/switch.svelte +1 -1
  122. package/dist/components/widgets/vision-service/detection-row.svelte +4 -2
  123. package/dist/components/widgets/vision-service/detection-row.svelte.d.ts +2 -1
  124. package/dist/components/widgets/vision-service/fonts/public-sans.json +1 -0
  125. package/dist/components/widgets/vision-service/fonts/public-sans.png +0 -0
  126. package/dist/components/widgets/vision-service/image.svelte +4 -4
  127. package/dist/components/widgets/vision-service/legend.svelte +4 -4
  128. package/dist/components/widgets/vision-service/public-sans-font.d.ts +5 -0
  129. package/dist/components/widgets/vision-service/public-sans-font.js +14 -0
  130. package/dist/components/widgets/vision-service/vision-service.svelte +2 -2
  131. package/dist/index.d.ts +1 -1
  132. package/dist/index.js +0 -1
  133. package/package.json +17 -4
  134. package/dist/components/board/pin-section.svelte +0 -28
  135. package/dist/components/board/pin-section.svelte.d.ts +0 -9
  136. package/dist/components/section-group.svelte +0 -64
  137. package/dist/components/section-group.svelte.d.ts +0 -14
@@ -15,10 +15,8 @@
15
15
  const { setValue }: Props = $props()
16
16
  </script>
17
17
 
18
- <PinSection
19
- title="Write pin"
20
- class="h-fit"
21
- >
18
+ <PinSection class="h-fit">
19
+ {#snippet title()}Write pin{/snippet}
22
20
  <div class="flex h-full max-h-18.5 w-full p-3">
23
21
  <Label cx="w-fit!">
24
22
  <h5>Value</h5>
@@ -32,7 +32,8 @@
32
32
  }
33
33
  </script>
34
34
 
35
- <PinSection title="Read pin">
35
+ <PinSection>
36
+ {#snippet title()}Read pin{/snippet}
36
37
  <section
37
38
  class="flex h-full max-h-18.5 w-full flex-col gap-1 p-3 text-xs"
38
39
  aria-labelledby={stateSectionId}
@@ -23,7 +23,8 @@
23
23
  }
24
24
  </script>
25
25
 
26
- <PinSection title="Write pin">
26
+ <PinSection>
27
+ {#snippet title()}Write pin{/snippet}
27
28
  <div class="flex w-full p-3 text-xs">
28
29
  <ToggleButtons
29
30
  cx="w-fit!"
@@ -1,11 +1,10 @@
1
1
  <script lang="ts">
2
2
  import type { Snippet } from 'svelte'
3
-
4
- import { twMerge } from 'tailwind-merge'
3
+ import type { ClassValue } from 'svelte/elements'
5
4
 
6
5
  interface Props {
7
- title: string
8
- class?: string
6
+ title: Snippet
7
+ class?: ClassValue
9
8
  children?: Snippet
10
9
  }
11
10
 
@@ -15,14 +14,14 @@
15
14
  </script>
16
15
 
17
16
  <section
18
- class={twMerge('border-light w-full max-w-50 gap-6 divide-y border', className)}
17
+ class={['border-light w-full max-w-50 gap-6 divide-y border', className]}
19
18
  aria-labelledby={headingID}
20
19
  >
21
20
  <h4
22
21
  id={headingID}
23
22
  class="bg-light font-roboto-mono text-subtle-1 px-3 py-1.25 text-center text-sm uppercase"
24
23
  >
25
- {title}
24
+ {@render title()}
26
25
  </h4>
27
26
  {@render children?.()}
28
27
  </section>
@@ -1,7 +1,8 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import type { ClassValue } from 'svelte/elements';
2
3
  interface Props {
3
- title: string;
4
- class?: string;
4
+ title: Snippet;
5
+ class?: ClassValue;
5
6
  children?: Snippet;
6
7
  }
7
8
  declare const PinSection: import("svelte").Component<Props, {}, "">;
@@ -15,6 +15,7 @@
15
15
  RefetchIntervals,
16
16
  } from '../../refetch-interval-store.svelte'
17
17
  import SectionTitle from '../../section-title.svelte'
18
+ import { ResourceTriplets } from '../../../resource-triplet'
18
19
 
19
20
  import PCDWidget from '../pcd/pcd-widget.svelte'
20
21
  import ExportScreenshot from './export-screenshot.svelte'
@@ -170,7 +171,7 @@
170
171
  <div class="flex flex-col gap-0.5 p-4 pb-0">
171
172
  <SectionTitle
172
173
  title="GetImages"
173
- api="rdk:component:camera"
174
+ api={ResourceTriplets.Camera}
174
175
  headingId={getImagesHeadingID}
175
176
  />
176
177
  </div>
@@ -339,7 +340,7 @@
339
340
  <div class="flex flex-col gap-0.5">
340
341
  <SectionTitle
341
342
  title="GetPointCloud"
342
- api="rdk:component:camera"
343
+ api={ResourceTriplets.Camera}
343
344
  headingId={getPointCloudHeadingID}
344
345
  />
345
346
  <p class="text-subtle-2 text-xs">
@@ -356,7 +357,7 @@
356
357
  {#if isShowingPointcloud}
357
358
  <Query
358
359
  query={pointcloudQuery}
359
- contentCx="h-6"
360
+ class="h-6"
360
361
  >
361
362
  {#if pointcloudQuery.data}
362
363
  <PCDWidget data={pointcloudQuery.data} />
@@ -15,6 +15,7 @@
15
15
  import { formatNumeric } from '../../../format'
16
16
  import { useMeasureFps } from '../../../fps.svelte'
17
17
  import { usePip } from '../../../pip/context.svelte'
18
+ import { ResourceTriplets } from '../../../resource-triplet'
18
19
 
19
20
  import { getBlobForViamDepth, VIAM_DEPTH_MIME_TYPE } from './decode-viam-depth'
20
21
  import { pickImageForSource } from './pick-image-for-source'
@@ -334,28 +335,27 @@
334
335
  })
335
336
  </script>
336
337
 
337
- <!-- This breaks out of using the <Query> component
338
- to merge live stream and TanStack query errors -->
339
- {#if lastError}
340
- <ContentRect
341
- {contentRect}
342
- cx="bg-medium/50 absolute flex h-64 w-80 max-w-full items-center justify-center"
343
- >
344
- <ErrorDisplay
345
- class="pb-4"
346
- {lastError}
347
- />
348
- </ContentRect>
349
- {:else if isLive ? isStreamLoading : isLoading}
350
- <ContentRect
351
- {contentRect}
352
- cx="absolute h-64 w-80 max-w-full"
353
- >
354
- <Progress />
355
- </ContentRect>
356
- {/if}
357
-
358
338
  <div class="relative">
339
+ <!-- This breaks out of using the <Query> component
340
+ to merge live stream and TanStack query errors -->
341
+ {#if lastError}
342
+ <ContentRect
343
+ {contentRect}
344
+ class="bg-medium/50 absolute top-0 left-0 flex h-64 w-80 max-w-full items-center justify-center"
345
+ >
346
+ <ErrorDisplay
347
+ class="pb-4"
348
+ {lastError}
349
+ />
350
+ </ContentRect>
351
+ {:else if isLive ? isStreamLoading : isLoading}
352
+ <ContentRect
353
+ {contentRect}
354
+ class="absolute top-0 left-0 h-64 w-80 max-w-full"
355
+ >
356
+ <Progress />
357
+ </ContentRect>
358
+ {/if}
359
359
  <div
360
360
  class="absolute bottom-2 left-2 z-10 rounded-[3px] bg-black/30 px-1 py-0.5 text-right font-mono text-xs text-white"
361
361
  >
@@ -400,7 +400,7 @@
400
400
  {#if showResolutionOptions && isLive}
401
401
  <MutationSection
402
402
  title="SetStreamOptions"
403
- api="rdk:component:camera"
403
+ api={ResourceTriplets.Camera}
404
404
  description="Change the resolution of the live stream video feed"
405
405
  lastError={resolutionMutation.error}
406
406
  class="-m-4 mt-4"
@@ -15,6 +15,7 @@
15
15
  createRefetchIntervalStore,
16
16
  RefetchIntervals,
17
17
  } from '../../refetch-interval-store.svelte'
18
+ import { ResourceTriplets } from '../../../resource-triplet'
18
19
 
19
20
  import type { ComponentPreviews, ComponentPreviewSnippet } from './component-preview'
20
21
 
@@ -135,12 +136,12 @@
135
136
 
136
137
  <ApiSection
137
138
  title="DiscoverResources"
138
- api="rdk:service:discovery"
139
- class="relative"
139
+ api={ResourceTriplets.Discovery}
140
+ class="relative grow flex-col gap-4"
140
141
  >
141
142
  <Query
142
143
  query={discoveryQuery}
143
- contentCx="h-6"
144
+ class="h-6"
144
145
  >
145
146
  {#if discoveryQuery.data !== undefined}
146
147
  <ResourcesList
@@ -13,6 +13,7 @@
13
13
  import Queries from '../../queries.svelte'
14
14
  import RefetchController from '../../refetch-controller.svelte'
15
15
  import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
16
+ import { ResourceTriplets } from '../../../resource-triplet'
16
17
 
17
18
  import { getEncoderPositionArgs } from './encoder-position-type'
18
19
  import Position from './position.svelte'
@@ -65,9 +66,9 @@
65
66
  <div class="grid w-full grid-cols-1 divide-y @lg:grid-cols-2 @lg:divide-x @lg:divide-y-0">
66
67
  <ApiSection
67
68
  title="GetPosition"
68
- api="rdk:component:encoder"
69
+ api={ResourceTriplets.Encoder}
69
70
  tooltip="Relative encoders return ticks since last zeroing. Absolute encoders return degrees."
70
- class="gap-3"
71
+ class="grow flex-col gap-3"
71
72
  >
72
73
  <Queries queries={[propertiesQuery, positionQuery]}>
73
74
  {#if positionQuery.data !== undefined}
@@ -83,8 +84,9 @@
83
84
  </ApiSection>
84
85
 
85
86
  <ApiSection
87
+ class="grow flex-col gap-4"
86
88
  title="ResetPosition"
87
- api="rdk:component:encoder"
89
+ api={ResourceTriplets.Encoder}
88
90
  description="Set the current position as the new zero position"
89
91
  >
90
92
  <Button
@@ -38,7 +38,7 @@
38
38
  title="GetPosition"
39
39
  tooltip="Relative encoders return ticks since last zeroing. Absolute encoders return degrees."
40
40
  bottomText="Updates automatically"
41
- class="grow"
41
+ class="grow flex-col gap-4"
42
42
  >
43
43
  <Queries queries={[propertiesQuery, positionQuery]}>
44
44
  {#if positionQuery.data !== undefined}
@@ -13,6 +13,7 @@
13
13
  import Queries from '../../queries.svelte'
14
14
  import Query from '../../query.svelte'
15
15
  import StopButton from '../../stop-button.svelte'
16
+ import { ResourceTriplets } from '../../../resource-triplet'
16
17
 
17
18
  import Home from './home.svelte'
18
19
  import MoveToPosition from './move-to-position.svelte'
@@ -50,6 +51,7 @@
50
51
  <div class="@container grow">
51
52
  <div class="flex flex-col divide-y @2xl:flex-row @2xl:divide-x @2xl:divide-y-0">
52
53
  <ApiSection
54
+ class="grow flex-col gap-4"
53
55
  bottomText="Updates automatically"
54
56
  aria-labelledby={positionHeadingID}
55
57
  >
@@ -58,7 +60,7 @@
58
60
  id={positionHeadingID}
59
61
  >
60
62
  <a
61
- href={apiDocsHref('rdk:component:gantry', 'getPosition')}
63
+ href={apiDocsHref(ResourceTriplets.Gantry, 'getPosition')}
62
64
  target="_blank"
63
65
  rel="noopener noreferrer external"
64
66
  class="decoration-gray-5 hover:decoration-default text-default font-mono font-semibold underline underline-offset-3"
@@ -67,7 +69,7 @@
67
69
  </a>
68
70
  and
69
71
  <a
70
- href={apiDocsHref('rdk:component:gantry', 'getLengths')}
72
+ href={apiDocsHref(ResourceTriplets.Gantry, 'getLengths')}
71
73
  target="_blank"
72
74
  rel="noopener noreferrer external"
73
75
  class="decoration-gray-5 hover:decoration-default text-default font-mono font-semibold underline underline-offset-3"
@@ -87,8 +89,9 @@
87
89
  </Queries>
88
90
  </ApiSection>
89
91
  <ApiSection
92
+ class="grow flex-col gap-4"
90
93
  title="MoveToPosition"
91
- api="rdk:component:gantry"
94
+ api={ResourceTriplets.Gantry}
92
95
  >
93
96
  <Query query={positionQuery}>
94
97
  {@const positions = positionQuery.data}
@@ -105,12 +108,13 @@
105
108
  </ApiSection>
106
109
  <div class="flex grow flex-col divide-y">
107
110
  <ApiSection
111
+ class="grow flex-col gap-4"
108
112
  title="Quick move"
109
113
  bottomText="Press a button to execute"
110
114
  >
111
115
  <Query
112
116
  query={positionQuery}
113
- contentCx="h-6"
117
+ class="h-6"
114
118
  >
115
119
  {@const positions = positionQuery.data}
116
120
  {#if positions !== undefined}
@@ -125,8 +129,9 @@
125
129
  </Query>
126
130
  </ApiSection>
127
131
  <ApiSection
132
+ class="grow flex-col gap-4"
128
133
  title="Home"
129
- api="rdk:component:gantry"
134
+ api={ResourceTriplets.Gantry}
130
135
  description="Run the homing sequence"
131
136
  >
132
137
  <Home
@@ -139,8 +144,9 @@
139
144
  </div>
140
145
  <div class="flex flex-col divide-y @4xl:ml-auto @4xl:w-full @4xl:max-w-40">
141
146
  <ApiSection
147
+ class="grow flex-col gap-4"
142
148
  title="Stop"
143
- api="rdk:component:gantry"
149
+ api={ResourceTriplets.Gantry}
144
150
  >
145
151
  <StopButton
146
152
  error={stopMutation.error}
@@ -151,7 +157,7 @@
151
157
  </ApiSection>
152
158
  <IsMoving
153
159
  client={GantryClient}
154
- api="rdk:component:gantry"
160
+ api={ResourceTriplets.Gantry}
155
161
  {partID}
156
162
  {resourceName}
157
163
  />
@@ -28,7 +28,7 @@
28
28
  <ApiSection
29
29
  title="GetPosition"
30
30
  bottomText="Updates automatically"
31
- class="grow"
31
+ class="grow flex-col gap-4"
32
32
  >
33
33
  <Queries queries={[positionQuery, lengthsQuery]}>
34
34
  {@const positions = positionQuery.data}
@@ -32,7 +32,7 @@
32
32
 
33
33
  <Query
34
34
  query={positionQuery}
35
- contentCx="h-6"
35
+ class="h-6"
36
36
  >
37
37
  {@const positions = positionQuery.data}
38
38
  {#if positions !== undefined}
@@ -2,6 +2,7 @@
2
2
  import { ResourceName } from '@viamrobotics/sdk'
3
3
 
4
4
  import SectionTitle from '../../section-title.svelte'
5
+ import { ResourceTriplets } from '../../../resource-triplet'
5
6
 
6
7
  import DoCommand from '../do-command/do-command.svelte'
7
8
 
@@ -13,7 +14,9 @@
13
14
 
14
15
  const { partID, resourceName, isComponent }: Props = $props()
15
16
 
16
- const api = $derived(`rdk:${isComponent ? 'component' : 'service'}:generic`)
17
+ const api = $derived(
18
+ isComponent ? ResourceTriplets.GenericComponent : ResourceTriplets.GenericService
19
+ )
17
20
 
18
21
  const genericResourceName = $derived<ResourceName>({
19
22
  namespace: 'rdk',
@@ -6,6 +6,7 @@
6
6
  import ConnectionStatus from '../../connection-status.svelte'
7
7
  import IsMoving from '../../is-moving.svelte'
8
8
  import StopButton from '../../stop-button.svelte'
9
+ import { ResourceTriplets } from '../../../resource-triplet'
9
10
 
10
11
  import Grab from './grab.svelte'
11
12
  import IsHoldingSomething from './is-holding-something.svelte'
@@ -34,8 +35,8 @@
34
35
  <span class="flex grow flex-wrap gap-4">
35
36
  <ApiSection
36
37
  title="Open"
37
- api="rdk:component:gripper"
38
- class="grow-0 gap-3 @xs:pr-0"
38
+ api={ResourceTriplets.Gripper}
39
+ class="grow-0 flex-col gap-3 @xs:pr-0"
39
40
  >
40
41
  <Open
41
42
  {partID}
@@ -44,8 +45,8 @@
44
45
  </ApiSection>
45
46
  <ApiSection
46
47
  title="Grab"
47
- api="rdk:component:gripper"
48
- class="grow-0 gap-3 @xs:pl-0"
48
+ api={ResourceTriplets.Gripper}
49
+ class="grow-0 flex-col gap-3 @xs:pl-0"
49
50
  >
50
51
  <Grab
51
52
  {partID}
@@ -55,8 +56,9 @@
55
56
  </span>
56
57
  <div class="flex flex-col divide-y">
57
58
  <ApiSection
59
+ class="grow flex-col gap-4"
58
60
  title="Stop"
59
- api="rdk:component:gripper"
61
+ api={ResourceTriplets.Gripper}
60
62
  >
61
63
  <StopButton
62
64
  error={stopMutation.error}
@@ -67,7 +69,7 @@
67
69
  </ApiSection>
68
70
  <IsMoving
69
71
  client={GripperClient}
70
- api="rdk:component:gripper"
72
+ api={ResourceTriplets.Gripper}
71
73
  {partID}
72
74
  {resourceName}
73
75
  />
@@ -6,6 +6,7 @@
6
6
  import ApiSection from '../../api-section.svelte'
7
7
  import Query from '../../query.svelte'
8
8
  import StatusPill from '../../status-pill.svelte'
9
+ import { ResourceTriplets } from '../../../resource-triplet'
9
10
 
10
11
  import ClosedGripperSvg from './closed-gripper-svg.svelte'
11
12
  import OpenGripperSvg from './open-gripper-svg.svelte'
@@ -30,9 +31,9 @@
30
31
 
31
32
  <ApiSection
32
33
  title="IsHoldingSomething"
33
- api="rdk:component:gripper"
34
+ api={ResourceTriplets.Gripper}
34
35
  bottomText="Updates automatically"
35
- class="grow"
36
+ class="grow flex-col gap-4"
36
37
  >
37
38
  <Query {query}>
38
39
  <div class="flex items-center gap-2">
@@ -8,6 +8,7 @@
8
8
  import ReadingsList from '../../readings-list.svelte'
9
9
  import RefetchController from '../../refetch-controller.svelte'
10
10
  import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
11
+ import { ResourceTriplets } from '../../../resource-triplet'
11
12
 
12
13
  import Webgamepad from './webgamepad.svelte'
13
14
 
@@ -55,12 +56,12 @@
55
56
 
56
57
  <ApiSection
57
58
  title="GetEvents"
58
- api="rdk:component:input_controller"
59
- class="relative"
59
+ api={ResourceTriplets.InputController}
60
+ class="relative grow flex-col gap-4"
60
61
  >
61
62
  <Query
62
63
  query={eventsQuery}
63
- contentCx="h-4"
64
+ class="h-4"
64
65
  >
65
66
  {#if eventsQuery.data !== undefined}
66
67
  <ReadingsList
@@ -53,7 +53,7 @@
53
53
 
54
54
  <Queries
55
55
  queries={[metadataQuery]}
56
- contentCx="p-4 h-14"
56
+ class="h-14 p-4"
57
57
  >
58
58
  {#if metadata !== undefined}
59
59
  <div class="p-4">
@@ -1,10 +1,12 @@
1
1
  <script lang="ts">
2
+ import type { Snippet } from 'svelte'
3
+
2
4
  import { Label, Select } from '@viamrobotics/prime-core'
3
5
 
4
6
  interface Props {
5
7
  value: string
6
8
  options: string[]
7
- label: string
9
+ label: Snippet
8
10
  onChange: (value: string) => void
9
11
  }
10
12
 
@@ -12,7 +14,7 @@
12
14
  </script>
13
15
 
14
16
  <Label>
15
- {label}
17
+ {@render label()}
16
18
 
17
19
  <Select
18
20
  slot="input"
@@ -1,7 +1,8 @@
1
+ import type { Snippet } from 'svelte';
1
2
  interface Props {
2
3
  value: string;
3
4
  options: string[];
4
- label: string;
5
+ label: Snippet;
5
6
  onChange: (value: string) => void;
6
7
  }
7
8
  declare const FrameSelect: import("svelte").Component<Props, {}, "">;
@@ -3,6 +3,7 @@
3
3
 
4
4
  import ApiSection from '../../api-section.svelte'
5
5
  import ConnectionStatus from '../../connection-status.svelte'
6
+ import { ResourceTriplets } from '../../../resource-triplet'
6
7
 
7
8
  import FrameSelect from './frame-select.svelte'
8
9
  import { movableFrameNames, parentFrame, referenceFrameNames } from './frame-system-config'
@@ -33,12 +34,12 @@
33
34
  <ConnectionStatus {partID}>
34
35
  {#snippet connected()}
35
36
  <ApiSection
37
+ class="grow flex-col gap-4"
36
38
  title="Move"
37
- api="rdk:service:motion"
39
+ api={ResourceTriplets.Motion}
38
40
  >
39
41
  <div class="flex min-w-0 flex-col gap-4">
40
42
  <FrameSelect
41
- label="Component"
42
43
  value={frameName}
43
44
  options={frameNames}
44
45
  onChange={(value) => {
@@ -46,15 +47,18 @@
46
47
  // reset the destination to the newly selected frame's parent
47
48
  selectedDestination = undefined
48
49
  }}
49
- />
50
+ >
51
+ {#snippet label()}Component{/snippet}
52
+ </FrameSelect>
50
53
  <FrameSelect
51
- label="Destination frame"
52
54
  value={destination}
53
55
  options={destinationOptions}
54
56
  onChange={(value) => {
55
57
  selectedDestination = value
56
58
  }}
57
- />
59
+ >
60
+ {#snippet label()}Destination frame{/snippet}
61
+ </FrameSelect>
58
62
  <MoveWidget
59
63
  {partID}
60
64
  {resourceName}
@@ -60,9 +60,11 @@
60
60
  onPoseChange={(next) => {
61
61
  edit = { key: editKey, pose: next }
62
62
  }}
63
- title="Destination pose"
64
- description="The target pose expressed in the selected reference frame. Translations are in millimeters."
65
- />
63
+ >
64
+ {#snippet heading()}Destination pose{/snippet}
65
+ {#snippet description()}The target pose expressed in the selected reference frame. Translations
66
+ are in millimeters.{/snippet}
67
+ </PoseEditor>
66
68
 
67
69
  <div class="flex flex-col gap-2">
68
70
  <span class="flex flex-row gap-2">
@@ -13,6 +13,7 @@
13
13
  import Query from '../../query.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'
@@ -87,7 +88,7 @@
87
88
  </MutationSection>
88
89
  <MutationSection
89
90
  title="SetPower"
90
- api="rdk:component:motor"
91
+ api={ResourceTriplets.Motor}
91
92
  description="Move continuously"
92
93
  lastError={setPowerMutation.error}
93
94
  >
@@ -96,7 +97,7 @@
96
97
  {#if propertiesQuery.data?.positionReporting}
97
98
  <MutationSection
98
99
  title="SetRPM"
99
- api="rdk:component:motor"
100
+ api={ResourceTriplets.Motor}
100
101
  description="Move indefinitely at a specified speed."
101
102
  lastError={setRPMMutation.error}
102
103
  >
@@ -104,7 +105,7 @@
104
105
  </MutationSection>
105
106
  <MutationSection
106
107
  title="GoFor"
107
- api="rdk:component:motor"
108
+ api={ResourceTriplets.Motor}
108
109
  description="Move a specified number of revolutions"
109
110
  lastError={goForMutation.error}
110
111
  >
@@ -112,7 +113,7 @@
112
113
  </MutationSection>
113
114
  <MutationSection
114
115
  title="GoTo"
115
- api="rdk:component:motor"
116
+ api={ResourceTriplets.Motor}
116
117
  description="Turn to a specified position"
117
118
  lastError={goToMutation.error}
118
119
  >
@@ -123,8 +124,9 @@
123
124
 
124
125
  <div class="flex w-full flex-col divide-y @2xl:ml-auto @2xl:max-w-1/2 @4xl:max-w-1/3">
125
126
  <ApiSection
127
+ class="grow flex-col gap-4"
126
128
  title="Stop"
127
- api="rdk:component:motor"
129
+ api={ResourceTriplets.Motor}
128
130
  >
129
131
  <StopButton
130
132
  error={stopMutation.error}
@@ -135,15 +137,15 @@
135
137
  </ApiSection>
136
138
  <IsMoving
137
139
  client={MotorClient}
138
- api="rdk:component:motor"
140
+ api={ResourceTriplets.Motor}
139
141
  {partID}
140
142
  {resourceName}
141
143
  >
142
144
  <div class="flex flex-col gap-6 pt-2">
143
145
  <ApiSection
144
146
  title="IsPowered"
145
- api="rdk:component:motor"
146
- class="gap-3 p-0"
147
+ api={ResourceTriplets.Motor}
148
+ class="grow flex-col gap-3 p-0!"
147
149
  tooltip="Returns whether or not the motor is running and the current portion of max power.
148
150
 
149
151
  Stepper motors will report ”true” if they are being powered while holding
@@ -165,8 +167,8 @@
165
167
  {#if propertiesQuery.data?.positionReporting === true}
166
168
  <ApiSection
167
169
  title="GetPosition"
168
- api="rdk:component:motor"
169
- class="gap-3 p-0"
170
+ api={ResourceTriplets.Motor}
171
+ class="grow flex-col gap-3 p-0!"
170
172
  tooltip="Reports the position of an encoded motor in revolutions from zero/home."
171
173
  >
172
174
  <Query query={positionQuery}>
@@ -25,11 +25,11 @@
25
25
 
26
26
  <ApiSection
27
27
  title="GetAccuracy"
28
- class="grow"
28
+ class="grow flex-col gap-4"
29
29
  >
30
30
  <Query
31
31
  {query}
32
- contentCx="h-6"
32
+ class="h-6"
33
33
  >
34
34
  {#if query.data !== undefined}
35
35
  <Accuracy data={query.data} />