@viamrobotics/test-widgets 0.17.4 → 0.18.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.
- package/dist/components/boundary.svelte +6 -1
- package/dist/components/index.d.ts +8 -1
- package/dist/components/index.js +8 -1
- package/dist/components/section/section-error.svelte +52 -8
- package/dist/components/section/section-error.svelte.d.ts +2 -0
- package/dist/components/section/section-errors.svelte +10 -2
- package/dist/components/widgets/arm/arm.svelte +5 -14
- package/dist/components/widgets/arm/stop-widget.svelte +20 -0
- package/dist/components/widgets/arm/stop-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/base/base.svelte +32 -150
- package/dist/components/widgets/base/stop-widget.svelte +20 -0
- package/dist/components/widgets/base/stop-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/camera/camera.svelte +28 -10
- package/dist/components/widgets/camera/export-screenshot.svelte +12 -20
- package/dist/components/widgets/camera/export-screenshot.svelte.d.ts +2 -0
- package/dist/components/widgets/camera/live-or-polling-video.svelte +13 -12
- package/dist/components/widgets/camera/picture-in-picture-button.svelte +7 -15
- package/dist/components/widgets/custom-control/custom-control.svelte +2 -2
- package/dist/components/widgets/do-command/do-command.svelte +6 -6
- package/dist/components/widgets/gantry/move-to-position-widget.svelte +12 -8
- package/dist/components/widgets/gantry/quick-move-widget.svelte +29 -15
- package/dist/components/widgets/gripper/grab-widget.svelte +10 -3
- package/dist/components/widgets/gripper/gripper.svelte +15 -54
- package/dist/components/widgets/gripper/is-holding-something-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/open-grab-control.svelte +60 -0
- package/dist/components/widgets/gripper/open-grab-control.svelte.d.ts +9 -0
- package/dist/components/widgets/gripper/open-widget.svelte +10 -3
- package/dist/components/widgets/gripper/stop-widget.svelte +20 -0
- package/dist/components/widgets/gripper/stop-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/ml-model-service/metadata-widget.svelte +52 -0
- package/dist/components/widgets/ml-model-service/metadata-widget.svelte.d.ts +13 -0
- package/dist/components/widgets/ml-model-service/ml-model-service.svelte +9 -22
- package/dist/components/widgets/movement-sensor/movement-sensor.svelte +102 -125
- package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +11 -7
- package/dist/components/widgets/servo/get-position-widget.svelte +42 -0
- package/dist/components/widgets/servo/get-position-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/servo/move-widget.svelte +10 -5
- package/dist/components/widgets/servo/quick-move-widget.svelte +28 -10
- package/dist/components/widgets/servo/servo.svelte +22 -111
- package/dist/components/widgets/servo/stop-widget.svelte +20 -0
- package/dist/components/widgets/servo/stop-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/switch/position-view.svelte +8 -5
- package/dist/components/widgets/switch/position.svelte +1 -5
- package/dist/components/widgets/switch/position.svelte.d.ts +0 -1
- package/dist/components/widgets/switch/switch.svelte +18 -17
- package/dist/components/widgets/vision-service/vision-service.svelte +12 -7
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js +15 -5
- package/package.json +13 -13
- package/dist/components/content-rect.svelte +0 -26
- package/dist/components/content-rect.svelte.d.ts +0 -11
- package/dist/components/error.svelte +0 -71
- package/dist/components/error.svelte.d.ts +0 -15
- package/dist/components/queries.svelte +0 -97
- package/dist/components/queries.svelte.d.ts +0 -17
- package/dist/components/query.svelte +0 -29
- package/dist/components/query.svelte.d.ts +0 -15
- package/dist/components/widgets/gripper/is-holding-something.svelte.d.ts +0 -7
- /package/dist/components/widgets/gripper/{is-holding-something.svelte → is-holding-something-widget.svelte} +0 -0
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { ServoClient } from '@viamrobotics/sdk'
|
|
3
|
-
import {
|
|
4
|
-
createResourceClient,
|
|
5
|
-
createResourceMutation,
|
|
6
|
-
createResourceQuery,
|
|
7
|
-
} from '@viamrobotics/svelte-sdk'
|
|
8
|
-
|
|
9
|
-
import ApiSection from '../../api-section.svelte'
|
|
10
2
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
11
|
-
import IsMoving from '../../is-moving.svelte'
|
|
12
|
-
import { Section } from '../../section'
|
|
13
|
-
import { useSectionErrors } from '../../section/use-section-errors.svelte'
|
|
14
|
-
import StopButton from '../../stop-button.svelte'
|
|
15
|
-
import { formatNumeric } from '../../../format'
|
|
16
|
-
import { ResourceTriplets } from '../../../resource-triplet'
|
|
17
3
|
|
|
18
|
-
import
|
|
19
|
-
import
|
|
4
|
+
import GetPositionWidget from './get-position-widget.svelte'
|
|
5
|
+
import IsMovingWidget from './is-moving-widget.svelte'
|
|
6
|
+
import MoveWidget from './move-widget.svelte'
|
|
7
|
+
import QuickMoveWidget from './quick-move-widget.svelte'
|
|
8
|
+
import StopWidget from './stop-widget.svelte'
|
|
20
9
|
|
|
21
10
|
interface Props {
|
|
22
11
|
partID: string
|
|
@@ -24,33 +13,6 @@
|
|
|
24
13
|
}
|
|
25
14
|
|
|
26
15
|
const { partID, resourceName }: Props = $props()
|
|
27
|
-
|
|
28
|
-
const client = createResourceClient(
|
|
29
|
-
ServoClient,
|
|
30
|
-
() => partID,
|
|
31
|
-
() => resourceName
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const positionQuery = createResourceQuery(client, 'getPosition', {
|
|
35
|
-
refetchInterval: 500,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
const moveMutation = createResourceMutation(client, 'move')
|
|
39
|
-
const quickMoveMutation = createResourceMutation(client, 'move')
|
|
40
|
-
const stopMutation = createResourceMutation(client, 'stop')
|
|
41
|
-
|
|
42
|
-
const quickMoveErrors = useSectionErrors(() => ({
|
|
43
|
-
queries: [positionQuery],
|
|
44
|
-
mutations: [quickMoveMutation],
|
|
45
|
-
}))
|
|
46
|
-
|
|
47
|
-
const moveTo = (angle: number) => {
|
|
48
|
-
moveMutation.mutate([angle], {})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const quickMoveTo = (angle: number) => {
|
|
52
|
-
quickMoveMutation.mutate([angle], {})
|
|
53
|
-
}
|
|
54
16
|
</script>
|
|
55
17
|
|
|
56
18
|
<ConnectionStatus {partID}>
|
|
@@ -59,77 +21,26 @@
|
|
|
59
21
|
<div class="flex flex-col divide-y @4xl:flex-row @4xl:divide-x @4xl:divide-y-0">
|
|
60
22
|
<div class="@container grow">
|
|
61
23
|
<div class="grid grid-cols-1 divide-y @2xl:grid-cols-3 @2xl:divide-x @2xl:divide-y-0">
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
<abbr class="text-subtle-2">º</abbr>
|
|
75
|
-
</span>
|
|
76
|
-
{/if}
|
|
77
|
-
<Section.Text class="mt-auto">Updates automatically</Section.Text>
|
|
78
|
-
</ApiSection>
|
|
79
|
-
<ApiSection
|
|
80
|
-
class="grow flex-col gap-4"
|
|
81
|
-
method="Move"
|
|
82
|
-
api={ResourceTriplets.Servo}
|
|
83
|
-
queries={[positionQuery]}
|
|
84
|
-
mutations={[moveMutation]}
|
|
85
|
-
>
|
|
86
|
-
{#if positionQuery.data !== undefined}
|
|
87
|
-
<Move
|
|
88
|
-
currentPosition={positionQuery.data}
|
|
89
|
-
{moveTo}
|
|
90
|
-
/>
|
|
91
|
-
{/if}
|
|
92
|
-
</ApiSection>
|
|
93
|
-
<Section
|
|
94
|
-
errorReporter={quickMoveErrors}
|
|
95
|
-
class="grow flex-col gap-4"
|
|
96
|
-
>
|
|
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}>
|
|
106
|
-
{#if positionQuery.data !== undefined}
|
|
107
|
-
<QuickMove
|
|
108
|
-
currentPosition={positionQuery.data}
|
|
109
|
-
moveTo={quickMoveTo}
|
|
110
|
-
/>
|
|
111
|
-
{/if}
|
|
112
|
-
<Section.Text class="mt-auto">Press a button to execute</Section.Text>
|
|
113
|
-
</Section.Body>
|
|
114
|
-
</Section>
|
|
24
|
+
<GetPositionWidget
|
|
25
|
+
{partID}
|
|
26
|
+
{resourceName}
|
|
27
|
+
/>
|
|
28
|
+
<MoveWidget
|
|
29
|
+
{partID}
|
|
30
|
+
{resourceName}
|
|
31
|
+
/>
|
|
32
|
+
<QuickMoveWidget
|
|
33
|
+
{partID}
|
|
34
|
+
{resourceName}
|
|
35
|
+
/>
|
|
115
36
|
</div>
|
|
116
37
|
</div>
|
|
117
38
|
<div class="flex flex-col divide-y @4xl:ml-auto @4xl:w-full @4xl:max-w-40">
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
>
|
|
124
|
-
<StopButton
|
|
125
|
-
onStop={() => {
|
|
126
|
-
stopMutation.mutate([])
|
|
127
|
-
}}
|
|
128
|
-
/>
|
|
129
|
-
</ApiSection>
|
|
130
|
-
<IsMoving
|
|
131
|
-
client={ServoClient}
|
|
132
|
-
api={ResourceTriplets.Servo}
|
|
39
|
+
<StopWidget
|
|
40
|
+
{partID}
|
|
41
|
+
{resourceName}
|
|
42
|
+
/>
|
|
43
|
+
<IsMovingWidget
|
|
133
44
|
{partID}
|
|
134
45
|
{resourceName}
|
|
135
46
|
/>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ServoClient } from '@viamrobotics/sdk'
|
|
3
|
+
|
|
4
|
+
import Stop from '../../stop.svelte'
|
|
5
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
partID: string
|
|
9
|
+
resourceName: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { partID, resourceName }: Props = $props()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<Stop
|
|
16
|
+
client={ServoClient}
|
|
17
|
+
api={ResourceTriplets.Servo}
|
|
18
|
+
{partID}
|
|
19
|
+
{resourceName}
|
|
20
|
+
/>
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
createResourceQuery,
|
|
7
7
|
} from '@viamrobotics/svelte-sdk'
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import ApiSection from '../../api-section.svelte'
|
|
10
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
10
11
|
|
|
11
12
|
import Position from './position.svelte'
|
|
12
13
|
|
|
@@ -43,9 +44,12 @@
|
|
|
43
44
|
}
|
|
44
45
|
</script>
|
|
45
46
|
|
|
46
|
-
<
|
|
47
|
+
<ApiSection
|
|
48
|
+
class="flex-col gap-4"
|
|
49
|
+
method="SetPosition"
|
|
50
|
+
api={ResourceTriplets.Switch}
|
|
47
51
|
queries={[positionQuery, numPositionsQuery]}
|
|
48
|
-
|
|
52
|
+
mutations={[setPositionMutation]}
|
|
49
53
|
>
|
|
50
54
|
{#if positionQuery.data !== undefined && numPositionsQuery.data !== undefined}
|
|
51
55
|
<Position
|
|
@@ -53,7 +57,6 @@
|
|
|
53
57
|
labels={numPositionsQuery.data[1]}
|
|
54
58
|
currentPosition={positionQuery.data}
|
|
55
59
|
{onSelect}
|
|
56
|
-
lastError={setPositionMutation.error}
|
|
57
60
|
/>
|
|
58
61
|
{/if}
|
|
59
|
-
</
|
|
62
|
+
</ApiSection>
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { ToggleButtons } from '@viamrobotics/prime-core'
|
|
3
3
|
|
|
4
|
-
import { Section } from '../../section'
|
|
5
|
-
|
|
6
4
|
interface Props {
|
|
7
5
|
numPositions: number
|
|
8
6
|
labels: string[]
|
|
9
7
|
currentPosition: number
|
|
10
8
|
onSelect: (position: number) => void
|
|
11
|
-
lastError: Error | null
|
|
12
9
|
}
|
|
13
10
|
|
|
14
|
-
const { numPositions, labels, currentPosition, onSelect
|
|
11
|
+
const { numPositions, labels, currentPosition, onSelect }: Props = $props()
|
|
15
12
|
|
|
16
13
|
const hasLabels = $derived(labels.length > 0)
|
|
17
14
|
const options = $derived(
|
|
@@ -39,5 +36,4 @@
|
|
|
39
36
|
cx={[{ '[&>div>button]:w-12!': !hasLabels }, 'font-roboto-mono [&>div]:flex-wrap!']}
|
|
40
37
|
on:input={handleInput}
|
|
41
38
|
/>
|
|
42
|
-
<Section.Error error={lastError} />
|
|
43
39
|
</div>
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
createResourceQuery,
|
|
7
7
|
} from '@viamrobotics/svelte-sdk'
|
|
8
8
|
|
|
9
|
+
import ApiSection from '../../api-section.svelte'
|
|
9
10
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
10
|
-
import
|
|
11
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
11
12
|
|
|
12
13
|
import Position from './position.svelte'
|
|
13
14
|
|
|
@@ -42,21 +43,21 @@
|
|
|
42
43
|
|
|
43
44
|
<ConnectionStatus {partID}>
|
|
44
45
|
{#snippet connected()}
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
</
|
|
46
|
+
<ApiSection
|
|
47
|
+
class="flex-col gap-4"
|
|
48
|
+
method="SetPosition"
|
|
49
|
+
api={ResourceTriplets.Switch}
|
|
50
|
+
queries={[positionQuery, numPositionsQuery]}
|
|
51
|
+
mutations={[setPositionMutation]}
|
|
52
|
+
>
|
|
53
|
+
{#if positionQuery.data !== undefined && numPositionsQuery.data !== undefined}
|
|
54
|
+
<Position
|
|
55
|
+
numPositions={numPositionsQuery.data[0]}
|
|
56
|
+
labels={numPositionsQuery.data[1]}
|
|
57
|
+
currentPosition={positionQuery.data}
|
|
58
|
+
{onSelect}
|
|
59
|
+
/>
|
|
60
|
+
{/if}
|
|
61
|
+
</ApiSection>
|
|
61
62
|
{/snippet}
|
|
62
63
|
</ConnectionStatus>
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
} from '@viamrobotics/svelte-sdk'
|
|
9
9
|
|
|
10
10
|
import { useAddImageToDataset } from '../../../add-image-to-dataset'
|
|
11
|
+
import ApiSection from '../../api-section.svelte'
|
|
11
12
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
12
|
-
import Queries from '../../queries.svelte'
|
|
13
13
|
import RefetchController from '../../refetch-controller.svelte'
|
|
14
14
|
import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
|
|
15
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
15
16
|
|
|
16
17
|
import Image from './image.svelte'
|
|
17
18
|
import ObjectPointClouds from './object-point-clouds.svelte'
|
|
@@ -205,9 +206,11 @@
|
|
|
205
206
|
<p class="text-subtle-2 text-xs italic">This request is taking a long time to complete.</p>
|
|
206
207
|
{/if}
|
|
207
208
|
|
|
208
|
-
<
|
|
209
|
+
<ApiSection
|
|
210
|
+
class="flex-col gap-2 p-0!"
|
|
211
|
+
method="CaptureAllFromCamera"
|
|
212
|
+
api={ResourceTriplets.Vision}
|
|
209
213
|
queries={[propertiesQuery, captureAllQuery]}
|
|
210
|
-
class="h-14 p-4"
|
|
211
214
|
>
|
|
212
215
|
{#if detectionsSlow}
|
|
213
216
|
<p class="text-subtle-2 text-xs italic">
|
|
@@ -221,7 +224,7 @@
|
|
|
221
224
|
classificationsSupported={Boolean(propertiesQuery.data?.classificationsSupported)}
|
|
222
225
|
/>
|
|
223
226
|
{/if}
|
|
224
|
-
</
|
|
227
|
+
</ApiSection>
|
|
225
228
|
|
|
226
229
|
<h6 class="text-subtle-1 mt-4 font-semibold">Object point clouds</h6>
|
|
227
230
|
<div class="flex flex-wrap items-center gap-4">
|
|
@@ -245,9 +248,11 @@
|
|
|
245
248
|
{/if}
|
|
246
249
|
|
|
247
250
|
{#if showObjectPointClouds}
|
|
248
|
-
<
|
|
251
|
+
<ApiSection
|
|
252
|
+
class="flex-col gap-2 p-0!"
|
|
253
|
+
method="GetObjectPointClouds"
|
|
254
|
+
api={ResourceTriplets.Vision}
|
|
249
255
|
queries={[getObjectPointCloudsQuery]}
|
|
250
|
-
class="h-14 p-4"
|
|
251
256
|
>
|
|
252
257
|
{#if objectPointCloudsSlow.isSlow}
|
|
253
258
|
<p class="text-subtle-2 text-xs italic">
|
|
@@ -257,7 +262,7 @@
|
|
|
257
262
|
{#if getObjectPointCloudsQuery.data !== undefined}
|
|
258
263
|
<ObjectPointClouds objects={getObjectPointCloudsQuery.data} />
|
|
259
264
|
{/if}
|
|
260
|
-
</
|
|
265
|
+
</ApiSection>
|
|
261
266
|
{/if}
|
|
262
267
|
</div>
|
|
263
268
|
{/snippet}
|
package/dist/registry.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { type ResourceTriplet } from './resource-triplet.ts';
|
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* apiWidgetsForResource(gripperResourceName)
|
|
13
|
-
* // [{ id: 'open-grab', label: 'Open / Grab', widgets: [
|
|
13
|
+
* // [{ id: 'open-grab', label: 'Open / Grab', widgets: [GripperOpenGrabWidget] }, ...]
|
|
14
14
|
*/
|
|
15
15
|
export declare const apiWidgetsForResource: (resource: ResourceName) => ResourceAPIWidget[];
|
|
16
16
|
/**
|
|
@@ -20,7 +20,7 @@ export declare const apiWidgetsForResource: (resource: ResourceName) => Resource
|
|
|
20
20
|
*
|
|
21
21
|
* @example
|
|
22
22
|
* availableAPIWidgets()[ResourceTriplets.Gripper]
|
|
23
|
-
* // [{ id: 'open-grab', label: 'Open / Grab', widgets: [
|
|
23
|
+
* // [{ id: 'open-grab', label: 'Open / Grab', widgets: [GripperOpenGrabWidget] }, ...]
|
|
24
24
|
*/
|
|
25
25
|
export declare const availableAPIWidgets: () => Partial<Record<ResourceTriplet, ResourceAPIWidget[]>>;
|
|
26
26
|
/** Returns the full composite test card for a resource, or `undefined` if none exists. */
|
package/dist/registry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArmGetJointPositionsWidget, ArmIsMovingWidget, ArmManualModeWidget, ArmMoveToJointPositionsWidget, ArmMoveToPositionWidget, ArmQuickMoveWidget, ArmWidget, AudioInputGetPropertiesWidget, AudioInputWidget, AudioOutputGetPropertiesWidget, AudioOutputWidget, BaseIsMovingWidget, BaseMoveStraightWidget, BaseQuickMoveWidget, BaseSetPowerWidget, BaseSetVelocityWidget, BaseSpinWidget, BaseWidget, BoardWidget, ButtonWidget, CameraWidget, DiscoveryWidget, EncoderGetPositionWidget, EncoderWidget, GantryGetPositionWidget, GantryHomeWidget, GantryIsMovingWidget, GantryMoveToPositionWidget, GantryQuickMoveWidget, GantryWidget, GripperGrabWidget, GripperIsHoldingSomethingWidget, GripperIsMovingWidget, GripperOpenWidget, GripperWidget, InputControllerWidget, MLModelServiceWidget, MotionServiceWidget, MotorGoForWidget, MotorGoToWidget, MotorIsMovingWidget, MotorQuickMoveWidget, MotorSetPowerWidget, MotorSetRPMWidget, MotorWidget, MovementSensorGetAccuracyWidget, MovementSensorGetCompassHeadingWidget, MovementSensorGetOrientationWidget, MovementSensorGetPositionWidget, MovementSensorWidget, NavigationServiceWidget, PowerSensorGetCurrentWidget, PowerSensorGetPowerWidget, PowerSensorGetVoltageWidget, PowerSensorWidget, SensorWidget, ServoIsMovingWidget, ServoMoveWidget, ServoQuickMoveWidget, ServoWidget, SlamGetPositionWidget, SlamWidget, SwitchWidget, VisionServiceWidget, } from "./components/index.js";
|
|
1
|
+
import { ArmGetJointPositionsWidget, ArmIsMovingWidget, ArmManualModeWidget, ArmMoveToJointPositionsWidget, ArmMoveToPositionWidget, ArmQuickMoveWidget, ArmStopWidget, ArmWidget, AudioInputGetPropertiesWidget, AudioInputWidget, AudioOutputGetPropertiesWidget, AudioOutputWidget, BaseIsMovingWidget, BaseMoveStraightWidget, BaseQuickMoveWidget, BaseSetPowerWidget, BaseSetVelocityWidget, BaseSpinWidget, BaseStopWidget, BaseWidget, BoardWidget, ButtonWidget, CameraWidget, DiscoveryWidget, EncoderGetPositionWidget, EncoderWidget, GantryGetPositionWidget, GantryHomeWidget, GantryIsMovingWidget, GantryMoveToPositionWidget, GantryQuickMoveWidget, GantryWidget, GripperGrabWidget, GripperIsHoldingSomethingWidget, GripperIsMovingWidget, GripperOpenGrabWidget, GripperOpenWidget, GripperStopWidget, GripperWidget, InputControllerWidget, MLModelServiceMetadataWidget, MLModelServiceWidget, MotionServiceWidget, MotorGoForWidget, MotorGoToWidget, MotorIsMovingWidget, MotorQuickMoveWidget, MotorSetPowerWidget, MotorSetRPMWidget, MotorWidget, MovementSensorGetAccuracyWidget, MovementSensorGetCompassHeadingWidget, MovementSensorGetOrientationWidget, MovementSensorGetPositionWidget, MovementSensorWidget, NavigationServiceWidget, PowerSensorGetCurrentWidget, PowerSensorGetPowerWidget, PowerSensorGetVoltageWidget, PowerSensorWidget, SensorWidget, ServoGetPositionWidget, ServoIsMovingWidget, ServoMoveWidget, ServoQuickMoveWidget, ServoStopWidget, ServoWidget, SlamGetPositionWidget, SlamWidget, SwitchWidget, VisionServiceWidget, } from "./components/index.js";
|
|
2
2
|
import { getResourceAPI } from "./get-resource-api.js";
|
|
3
3
|
import { ResourceTriplets } from "./resource-triplet.js";
|
|
4
4
|
/**
|
|
@@ -25,6 +25,7 @@ const resourceWidgetRegistry = {
|
|
|
25
25
|
},
|
|
26
26
|
{ id: 'is-moving', label: 'IsMoving', widgets: [ArmIsMovingWidget] },
|
|
27
27
|
{ id: 'manual-mode', label: 'SetManualMode', widgets: [ArmManualModeWidget] },
|
|
28
|
+
{ id: 'stop', label: 'Stop', widgets: [ArmStopWidget] },
|
|
28
29
|
],
|
|
29
30
|
},
|
|
30
31
|
[ResourceTriplets.AudioInput]: {
|
|
@@ -52,6 +53,7 @@ const resourceWidgetRegistry = {
|
|
|
52
53
|
{ id: 'set-power', label: 'SetPower', widgets: [BaseSetPowerWidget] },
|
|
53
54
|
{ id: 'set-velocity', label: 'SetVelocity', widgets: [BaseSetVelocityWidget] },
|
|
54
55
|
{ id: 'is-moving', label: 'IsMoving', widgets: [BaseIsMovingWidget] },
|
|
56
|
+
{ id: 'stop', label: 'Stop', widgets: [BaseStopWidget] },
|
|
55
57
|
],
|
|
56
58
|
},
|
|
57
59
|
[ResourceTriplets.Board]: { widget: BoardWidget, apis: [] },
|
|
@@ -74,13 +76,16 @@ const resourceWidgetRegistry = {
|
|
|
74
76
|
[ResourceTriplets.Gripper]: {
|
|
75
77
|
widget: GripperWidget,
|
|
76
78
|
apis: [
|
|
77
|
-
{ id: 'open-grab', label: 'Open / Grab', widgets: [
|
|
79
|
+
{ id: 'open-grab', label: 'Open / Grab', widgets: [GripperOpenGrabWidget] },
|
|
78
80
|
{
|
|
79
81
|
id: 'is-holding-something',
|
|
80
82
|
label: 'IsHoldingSomething',
|
|
81
83
|
widgets: [GripperIsHoldingSomethingWidget],
|
|
82
84
|
},
|
|
83
85
|
{ id: 'is-moving', label: 'IsMoving', widgets: [GripperIsMovingWidget] },
|
|
86
|
+
{ id: 'open', label: 'Open', widgets: [GripperOpenWidget] },
|
|
87
|
+
{ id: 'grab', label: 'Grab', widgets: [GripperGrabWidget] },
|
|
88
|
+
{ id: 'stop', label: 'Stop', widgets: [GripperStopWidget] },
|
|
84
89
|
],
|
|
85
90
|
},
|
|
86
91
|
[ResourceTriplets.InputController]: { widget: InputControllerWidget, apis: [] },
|
|
@@ -127,12 +132,17 @@ const resourceWidgetRegistry = {
|
|
|
127
132
|
{ id: 'move', label: 'Move', widgets: [ServoMoveWidget] },
|
|
128
133
|
{ id: 'quick-move', label: 'Quick move', widgets: [ServoQuickMoveWidget] },
|
|
129
134
|
{ id: 'is-moving', label: 'IsMoving', widgets: [ServoIsMovingWidget] },
|
|
135
|
+
{ id: 'get-position', label: 'GetPosition', widgets: [ServoGetPositionWidget] },
|
|
136
|
+
{ id: 'stop', label: 'Stop', widgets: [ServoStopWidget] },
|
|
130
137
|
],
|
|
131
138
|
},
|
|
132
139
|
[ResourceTriplets.Switch]: { widget: SwitchWidget, apis: [] },
|
|
133
140
|
// services
|
|
134
141
|
[ResourceTriplets.Discovery]: { widget: DiscoveryWidget, apis: [] },
|
|
135
|
-
[ResourceTriplets.MLModel]: {
|
|
142
|
+
[ResourceTriplets.MLModel]: {
|
|
143
|
+
widget: MLModelServiceWidget,
|
|
144
|
+
apis: [{ id: 'metadata', label: 'Metadata', widgets: [MLModelServiceMetadataWidget] }],
|
|
145
|
+
},
|
|
136
146
|
[ResourceTriplets.Motion]: { widget: MotionServiceWidget, apis: [] },
|
|
137
147
|
[ResourceTriplets.Navigation]: { widget: NavigationServiceWidget, apis: [] },
|
|
138
148
|
[ResourceTriplets.Slam]: {
|
|
@@ -150,7 +160,7 @@ const resourceWidgetRegistry = {
|
|
|
150
160
|
*
|
|
151
161
|
* @example
|
|
152
162
|
* apiWidgetsForResource(gripperResourceName)
|
|
153
|
-
* // [{ id: 'open-grab', label: 'Open / Grab', widgets: [
|
|
163
|
+
* // [{ id: 'open-grab', label: 'Open / Grab', widgets: [GripperOpenGrabWidget] }, ...]
|
|
154
164
|
*/
|
|
155
165
|
export const apiWidgetsForResource = (resource) => resourceWidgetRegistry[getResourceAPI(resource)]?.apis ?? [];
|
|
156
166
|
/**
|
|
@@ -160,7 +170,7 @@ export const apiWidgetsForResource = (resource) => resourceWidgetRegistry[getRes
|
|
|
160
170
|
*
|
|
161
171
|
* @example
|
|
162
172
|
* availableAPIWidgets()[ResourceTriplets.Gripper]
|
|
163
|
-
* // [{ id: 'open-grab', label: 'Open / Grab', widgets: [
|
|
173
|
+
* // [{ id: 'open-grab', label: 'Open / Grab', widgets: [GripperOpenGrabWidget] }, ...]
|
|
164
174
|
*/
|
|
165
175
|
export const availableAPIWidgets = () => {
|
|
166
176
|
const result = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viamrobotics/test-widgets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"wireit": {
|
|
@@ -223,18 +223,18 @@
|
|
|
223
223
|
"@fontsource-variable/public-sans": "^5.2.7",
|
|
224
224
|
"@fontsource-variable/roboto-mono": "^5.2.8",
|
|
225
225
|
"@fontsource-variable/space-grotesk": "^5.2.10",
|
|
226
|
-
"@houserules/cli": "^0.
|
|
227
|
-
"@houserules/plugin-accessibility": "^0.1
|
|
228
|
-
"@houserules/plugin-changesets": "^0.2
|
|
229
|
-
"@houserules/plugin-design": "^0.
|
|
230
|
-
"@houserules/plugin-prose": "^0.2.
|
|
231
|
-
"@houserules/plugin-svelte": "^0.
|
|
232
|
-
"@houserules/plugin-testing": "^0.3.
|
|
233
|
-
"@houserules/plugin-three": "^0.2.
|
|
234
|
-
"@houserules/plugin-typescript": "^0.1.
|
|
235
|
-
"@playwright/test": "^1.
|
|
226
|
+
"@houserules/cli": "^0.12.1",
|
|
227
|
+
"@houserules/plugin-accessibility": "^0.2.1",
|
|
228
|
+
"@houserules/plugin-changesets": "^0.3.2",
|
|
229
|
+
"@houserules/plugin-design": "^0.4.2",
|
|
230
|
+
"@houserules/plugin-prose": "^0.2.2",
|
|
231
|
+
"@houserules/plugin-svelte": "^0.2.0",
|
|
232
|
+
"@houserules/plugin-testing": "^0.3.3",
|
|
233
|
+
"@houserules/plugin-three": "^0.2.2",
|
|
234
|
+
"@houserules/plugin-typescript": "^0.1.3",
|
|
235
|
+
"@playwright/test": "^1.65.1",
|
|
236
236
|
"@sentry/svelte": "^10.50.0",
|
|
237
|
-
"@sveltejs/adapter-static": "^3.0.
|
|
237
|
+
"@sveltejs/adapter-static": "^3.0.11",
|
|
238
238
|
"@sveltejs/kit": "^2.69.1",
|
|
239
239
|
"@sveltejs/package": "^2.5.7",
|
|
240
240
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
"globals": "^17.5.0",
|
|
269
269
|
"lodash-es": "^4.18.1",
|
|
270
270
|
"maplibre-gl": "^6.9.1",
|
|
271
|
-
"playwright": "^1.
|
|
271
|
+
"playwright": "^1.65.1",
|
|
272
272
|
"prettier": "^3.8.3",
|
|
273
273
|
"prettier-plugin-svelte": "^3.5.1",
|
|
274
274
|
"prettier-plugin-tailwindcss": "^0.7.4",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
|
|
4
|
-
@deprecated It sized the `Queries` wrapper and goes with it. A section sets its own layout class. Kept for the sectionless files until their resource PRs.
|
|
5
|
-
-->
|
|
6
|
-
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
import type { Snippet } from 'svelte'
|
|
9
|
-
import type { ClassValue } from 'svelte/elements'
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
contentRect: DOMRect | undefined
|
|
13
|
-
class?: ClassValue
|
|
14
|
-
children?: Snippet
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const { contentRect, class: classNames = 'h-full w-full', children }: Props = $props()
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<div
|
|
21
|
-
class={classNames}
|
|
22
|
-
style:width={contentRect ? `${contentRect.width.toString()}px` : undefined}
|
|
23
|
-
style:height={contentRect ? `${contentRect.height.toString()}px` : undefined}
|
|
24
|
-
>
|
|
25
|
-
{@render children?.()}
|
|
26
|
-
</div>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { ClassValue } from 'svelte/elements';
|
|
3
|
-
interface Props {
|
|
4
|
-
contentRect: DOMRect | undefined;
|
|
5
|
-
class?: ClassValue;
|
|
6
|
-
children?: Snippet;
|
|
7
|
-
}
|
|
8
|
-
/** @deprecated It sized the `Queries` wrapper and goes with it. A section sets its own layout class. Kept for the sectionless files until their resource PRs. */
|
|
9
|
-
declare const ContentRect: import("svelte").Component<Props, {}, "">;
|
|
10
|
-
type ContentRect = ReturnType<typeof ContentRect>;
|
|
11
|
-
export default ContentRect;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@component
|
|
3
|
-
|
|
4
|
-
@deprecated Errors show in the section heading's indicator. Pass the mutation to `ApiSection` as
|
|
5
|
-
`mutations` or to a `Section` control's `useSectionErrors` call. In a form that cannot reach its
|
|
6
|
-
section, use `Section.Error`, which reports to the indicator and falls back to an inline line
|
|
7
|
-
outside a section. Kept for the sectionless files until their resource PRs.
|
|
8
|
-
-->
|
|
9
|
-
|
|
10
|
-
<script lang="ts">
|
|
11
|
-
import type { ClassValue } from 'svelte/elements'
|
|
12
|
-
|
|
13
|
-
import { IconButton, Tooltip } from '@viamrobotics/prime-core'
|
|
14
|
-
|
|
15
|
-
interface Props {
|
|
16
|
-
lastError: Error | null | undefined
|
|
17
|
-
id?: string
|
|
18
|
-
class?: ClassValue
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const defaultId = $props.id()
|
|
22
|
-
|
|
23
|
-
const { lastError, id = `error_${defaultId}`, class: className = '' }: Props = $props()
|
|
24
|
-
|
|
25
|
-
const errorText = $derived(
|
|
26
|
-
lastError?.name && lastError.message ? `${lastError.name}: ${lastError.message}` : ''
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
let showCopySuccess = $state(false)
|
|
30
|
-
let copySuccessTimeoutId: ReturnType<typeof setTimeout> | undefined
|
|
31
|
-
|
|
32
|
-
const copyErrorToClipboard = async () => {
|
|
33
|
-
try {
|
|
34
|
-
await globalThis.navigator.clipboard.writeText(errorText)
|
|
35
|
-
showCopySuccess = true
|
|
36
|
-
clearTimeout(copySuccessTimeoutId)
|
|
37
|
-
copySuccessTimeoutId = setTimeout(() => {
|
|
38
|
-
showCopySuccess = false
|
|
39
|
-
}, 750)
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error('Failed to copy error to clipboard', error)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
$effect(() => () => clearTimeout(copySuccessTimeoutId))
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
{#if errorText}
|
|
49
|
-
<div class="flex items-center justify-between gap-1">
|
|
50
|
-
<p
|
|
51
|
-
{id}
|
|
52
|
-
class={[
|
|
53
|
-
'font-roboto-mono text-danger-dark min-w-0 overflow-auto text-xs wrap-break-word',
|
|
54
|
-
className,
|
|
55
|
-
]}
|
|
56
|
-
>
|
|
57
|
-
{errorText}
|
|
58
|
-
</p>
|
|
59
|
-
<div class="shrink-0">
|
|
60
|
-
<Tooltip let:tooltipID>
|
|
61
|
-
<IconButton
|
|
62
|
-
aria-describedby={tooltipID}
|
|
63
|
-
icon={showCopySuccess ? 'check' : 'content-copy'}
|
|
64
|
-
label="Copy error"
|
|
65
|
-
on:click={copyErrorToClipboard}
|
|
66
|
-
/>
|
|
67
|
-
<div slot="description">Copy error</div>
|
|
68
|
-
</Tooltip>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
{/if}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ClassValue } from 'svelte/elements';
|
|
2
|
-
interface Props {
|
|
3
|
-
lastError: Error | null | undefined;
|
|
4
|
-
id?: string;
|
|
5
|
-
class?: ClassValue;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Errors show in the section heading's indicator. Pass the mutation to `ApiSection` as
|
|
9
|
-
* `mutations` or to a `Section` control's `useSectionErrors` call. In a form that cannot reach its
|
|
10
|
-
* section, use `Section.Error`, which reports to the indicator and falls back to an inline line
|
|
11
|
-
* outside a section. Kept for the sectionless files until their resource PRs.
|
|
12
|
-
*/
|
|
13
|
-
declare const Error: import("svelte").Component<Props, {}, "">;
|
|
14
|
-
type Error = ReturnType<typeof Error>;
|
|
15
|
-
export default Error;
|