@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.
- package/README.md +15 -1
- package/dist/api-docs-href.d.ts +2 -2
- package/dist/api-docs-href.js +0 -1
- package/dist/components/api-section.svelte +7 -6
- package/dist/components/api-section.svelte.d.ts +4 -3
- package/dist/components/boundary.svelte +51 -0
- package/dist/components/boundary.svelte.d.ts +5 -0
- package/dist/components/connection-status.svelte +57 -61
- package/dist/components/connection-status.svelte.d.ts +5 -5
- package/dist/components/content-rect.svelte +4 -5
- package/dist/components/content-rect.svelte.d.ts +2 -1
- package/dist/components/error.svelte +6 -5
- package/dist/components/error.svelte.d.ts +2 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/components/is-moving.svelte +4 -2
- package/dist/components/is-moving.svelte.d.ts +2 -1
- package/dist/components/maplibre/index.svelte +5 -6
- package/dist/components/maplibre/index.svelte.d.ts +3 -1
- package/dist/components/mutation-section.svelte +7 -5
- package/dist/components/mutation-section.svelte.d.ts +4 -2
- package/dist/components/pose-editor.svelte +83 -15
- package/dist/components/pose-editor.svelte.d.ts +11 -4
- package/dist/components/queries.svelte +7 -4
- package/dist/components/queries.svelte.d.ts +2 -1
- package/dist/components/query.svelte +4 -3
- package/dist/components/query.svelte.d.ts +2 -1
- package/dist/components/section/error-key.d.ts +2 -0
- package/dist/components/section/error-key.js +2 -0
- package/dist/components/section/index.d.ts +19 -0
- package/dist/components/section/index.js +19 -0
- package/dist/components/section/section-body.svelte +36 -0
- package/dist/components/section/section-body.svelte.d.ts +13 -0
- package/dist/components/section/section-errors.svelte +18 -0
- package/dist/components/section/section-errors.svelte.d.ts +6 -0
- package/dist/components/section/section-heading.svelte +21 -0
- package/dist/components/section/section-heading.svelte.d.ts +9 -0
- package/dist/components/section/section-loading.d.ts +4 -0
- package/dist/components/section/section-loading.js +10 -0
- package/dist/components/section/section-method.svelte +29 -0
- package/dist/components/section/section-method.svelte.d.ts +9 -0
- package/dist/components/section/section-placeholder.svelte +29 -0
- package/dist/components/section/section-placeholder.svelte.d.ts +7 -0
- package/dist/components/section/section-text.svelte +17 -0
- package/dist/components/section/section-text.svelte.d.ts +8 -0
- package/dist/components/section/section-tooltip.svelte +25 -0
- package/dist/components/section/section-tooltip.svelte.d.ts +7 -0
- package/dist/components/section/section.svelte +17 -0
- package/dist/components/section/section.svelte.d.ts +8 -0
- package/dist/components/section/use-section-errors.svelte.d.ts +18 -0
- package/dist/components/section/use-section-errors.svelte.js +39 -0
- package/dist/components/section-title.svelte +3 -1
- package/dist/components/section-title.svelte.d.ts +2 -1
- package/dist/components/stop.svelte +31 -14
- package/dist/components/stop.svelte.d.ts +6 -1
- package/dist/components/widgets/arm/arm.svelte +22 -11
- package/dist/components/widgets/arm/get-joint-positions-widget.svelte +1 -1
- package/dist/components/widgets/arm/joint-position-editor.svelte +105 -27
- package/dist/components/widgets/arm/joint-position-editor.svelte.d.ts +4 -3
- package/dist/components/widgets/arm/joint-position-slider.svelte +6 -2
- package/dist/components/widgets/arm/joint-position-slider.svelte.d.ts +2 -1
- package/dist/components/widgets/arm/manual-mode-widget.svelte +3 -2
- package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +12 -4
- package/dist/components/widgets/arm/move-to-joint-positions.svelte +14 -6
- package/dist/components/widgets/arm/move-to-position-control.svelte +25 -17
- package/dist/components/widgets/arm/move-to-position.svelte +97 -30
- package/dist/components/widgets/arm/move-to-position.svelte.d.ts +3 -1
- package/dist/components/widgets/arm/use-arm-motion-tracking.svelte.d.ts +16 -0
- package/dist/components/widgets/arm/use-arm-motion-tracking.svelte.js +37 -0
- package/dist/components/widgets/arm/use-edited-targets.svelte.d.ts +9 -0
- package/dist/components/widgets/arm/use-edited-targets.svelte.js +24 -0
- package/dist/components/widgets/audio-input/audio-input.svelte +5 -4
- package/dist/components/widgets/audio-input/get-properties-widget.svelte +2 -2
- package/dist/components/widgets/audio-output/audio-output.svelte +5 -4
- package/dist/components/widgets/audio-output/get-properties-widget.svelte +2 -2
- package/dist/components/widgets/base/base.svelte +8 -6
- package/dist/components/widgets/base/quick-move.svelte +5 -6
- package/dist/components/widgets/base/set-power.svelte +6 -4
- package/dist/components/widgets/base/set-velocity.svelte +6 -4
- package/dist/components/widgets/base/vec3-builder.svelte +3 -2
- package/dist/components/widgets/base/vec3-builder.svelte.d.ts +2 -1
- package/dist/components/widgets/board/analog-read.svelte +2 -4
- package/dist/components/widgets/board/analog-write.svelte +2 -4
- package/dist/components/widgets/board/gpio-read.svelte +2 -1
- package/dist/components/widgets/board/gpio-write.svelte +2 -1
- package/dist/components/widgets/board/pin-section.svelte +5 -6
- package/dist/components/widgets/board/pin-section.svelte.d.ts +3 -2
- package/dist/components/widgets/camera/camera.svelte +4 -3
- package/dist/components/widgets/camera/live-or-polling-video.svelte +22 -22
- package/dist/components/widgets/discovery/discovery.svelte +4 -3
- package/dist/components/widgets/encoder/encoder.svelte +5 -3
- package/dist/components/widgets/encoder/get-position-widget.svelte +1 -1
- package/dist/components/widgets/gantry/gantry.svelte +13 -7
- package/dist/components/widgets/gantry/get-position-widget.svelte +1 -1
- package/dist/components/widgets/gantry/quick-move-widget.svelte +1 -1
- package/dist/components/widgets/generic/generic.svelte +4 -1
- package/dist/components/widgets/gripper/gripper.svelte +8 -6
- package/dist/components/widgets/gripper/is-holding-something.svelte +3 -2
- package/dist/components/widgets/input-controller/input-controller.svelte +4 -3
- package/dist/components/widgets/ml-model-service/ml-model-service.svelte +1 -1
- package/dist/components/widgets/motion/frame-select.svelte +4 -2
- package/dist/components/widgets/motion/frame-select.svelte.d.ts +2 -1
- package/dist/components/widgets/motion/motion.svelte +9 -5
- package/dist/components/widgets/motion/move.svelte +5 -3
- package/dist/components/widgets/motor/motor.svelte +12 -10
- package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +2 -2
- package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +2 -2
- package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +2 -2
- package/dist/components/widgets/movement-sensor/get-position-widget.svelte +2 -2
- package/dist/components/widgets/movement-sensor/movement-sensor.svelte +17 -18
- package/dist/components/widgets/power-sensor/get-current-widget.svelte +2 -2
- package/dist/components/widgets/power-sensor/get-power-widget.svelte +2 -2
- package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +2 -2
- package/dist/components/widgets/power-sensor/power-sensor.svelte +13 -11
- package/dist/components/widgets/sensor/sensor.svelte +4 -3
- package/dist/components/widgets/servo/servo.svelte +9 -4
- package/dist/components/widgets/slam/get-position-widget.svelte +2 -2
- package/dist/components/widgets/slam/move-on-map.svelte +3 -1
- package/dist/components/widgets/slam/slam.svelte +10 -5
- package/dist/components/widgets/switch/position-view.svelte +1 -1
- package/dist/components/widgets/switch/switch.svelte +1 -1
- package/dist/components/widgets/vision-service/detection-row.svelte +4 -2
- package/dist/components/widgets/vision-service/detection-row.svelte.d.ts +2 -1
- package/dist/components/widgets/vision-service/fonts/public-sans.json +1 -0
- package/dist/components/widgets/vision-service/fonts/public-sans.png +0 -0
- package/dist/components/widgets/vision-service/image.svelte +4 -4
- package/dist/components/widgets/vision-service/legend.svelte +4 -4
- package/dist/components/widgets/vision-service/public-sans-font.d.ts +5 -0
- package/dist/components/widgets/vision-service/public-sans-font.js +14 -0
- package/dist/components/widgets/vision-service/vision-service.svelte +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -1
- package/package.json +17 -4
- package/dist/components/board/pin-section.svelte +0 -28
- package/dist/components/board/pin-section.svelte.d.ts +0 -9
- package/dist/components/section-group.svelte +0 -64
- package/dist/components/section-group.svelte.d.ts +0 -14
package/README.md
CHANGED
|
@@ -36,7 +36,9 @@ The playground (`pnpm dev`) can be used to develop the test-cards against prod r
|
|
|
36
36
|
|
|
37
37
|
This is useful if you need to validate the sdk against specific behavior of modules or need to replicate a bug from another robot (why replicate locally when you could just develop directly against the robot with the bug?).
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
The sidebar lists your machines. The `?machine=<name>` search param picks which one the playground shows, and the first machine is the default.
|
|
40
|
+
|
|
41
|
+
A `.env.local` in the test-widgets directory is optional. It seeds the list with the following format (no need to create two robots):
|
|
40
42
|
|
|
41
43
|
```json
|
|
42
44
|
VITE_PLAYGROUND_ROBOTS='
|
|
@@ -70,3 +72,15 @@ VITE_PLAYGROUND_ROBOTS='
|
|
|
70
72
|
}
|
|
71
73
|
'
|
|
72
74
|
```
|
|
75
|
+
|
|
76
|
+
You can also add machines from the sidebar. Paste one machine config with a `name`, or a whole `VITE_PLAYGROUND_ROBOTS` value, into the form and submit. Machines added this way are kept in your browser's localStorage, and you can remove them from the sidebar. Machines from `.env.local` cannot be removed there.
|
|
77
|
+
|
|
78
|
+
### Hosted playground and docs
|
|
79
|
+
|
|
80
|
+
Every push to `main` deploys the docs site to `https://viamrobotics.github.io/test-widgets/` and the playground to `https://viamrobotics.github.io/test-widgets/playground/`. The docs live in `docs/`, a separate Astro Starlight project. Run them with `pnpm docs:dev`, or build them with the playground included using `pnpm docs:build`.
|
|
81
|
+
|
|
82
|
+
### PR previews
|
|
83
|
+
|
|
84
|
+
Each pull request from a branch in this repo deploys the playground to `https://viamrobotics.github.io/test-widgets/pr-preview/pr-<N>/`, and a bot comment links it. The preview has no machines built in, so paste a config into the sidebar form. Closing the pull request removes the preview. Pull requests from forks and Dependabot get no preview.
|
|
85
|
+
|
|
86
|
+
On GitHub Pages, every `viamrobotics` site shares the `viamrobotics.github.io` origin. Those sites can read the keys stored in localStorage. Use keys for test machines only.
|
package/dist/api-docs-href.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { ResourceTriplet } from './resource-triplet';
|
|
1
2
|
/**
|
|
2
3
|
* Returns the docs URL for a given resource API + method, or undefined
|
|
3
4
|
* when the method has no dedicated anchor (e.g. GetStatus, GetSourceNames).
|
|
4
5
|
*
|
|
5
|
-
* @param api - RDK API string, e.g. "rdk:component:movement_sensor"
|
|
6
6
|
* @param method - camelCase method name, e.g. "getPosition"
|
|
7
7
|
*/
|
|
8
|
-
export declare const apiDocsHref: (api:
|
|
8
|
+
export declare const apiDocsHref: (api: ResourceTriplet, method: string) => string | undefined;
|
package/dist/api-docs-href.js
CHANGED
|
@@ -3,7 +3,6 @@ const NO_LINK_METHODS = new Set(['getStatus', 'getSourceNames']);
|
|
|
3
3
|
* Returns the docs URL for a given resource API + method, or undefined
|
|
4
4
|
* when the method has no dedicated anchor (e.g. GetStatus, GetSourceNames).
|
|
5
5
|
*
|
|
6
|
-
* @param api - RDK API string, e.g. "rdk:component:movement_sensor"
|
|
7
6
|
* @param method - camelCase method name, e.g. "getPosition"
|
|
8
7
|
*/
|
|
9
8
|
export const apiDocsHref = (api, method) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte'
|
|
3
|
-
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { ResourceTriplet } from '../resource-triplet'
|
|
6
6
|
|
|
7
|
+
import Boundary from './boundary.svelte'
|
|
7
8
|
import SectionTitle from './section-title.svelte'
|
|
8
9
|
|
|
9
10
|
interface Props extends HTMLAttributes<HTMLElement> {
|
|
@@ -12,8 +13,8 @@
|
|
|
12
13
|
description?: string | undefined
|
|
13
14
|
bottomText?: string | undefined
|
|
14
15
|
/** RDK API string; presence renders the title as a linked monospace method name */
|
|
15
|
-
api?:
|
|
16
|
-
class?:
|
|
16
|
+
api?: ResourceTriplet | undefined
|
|
17
|
+
class?: ClassValue
|
|
17
18
|
children?: Snippet
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
35
|
<section
|
|
35
|
-
class={
|
|
36
|
+
class={['flex p-4', className]}
|
|
36
37
|
aria-labelledby={title ? headingID : undefined}
|
|
37
38
|
{...rest}
|
|
38
39
|
>
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
</div>
|
|
60
61
|
{/if}
|
|
61
62
|
|
|
62
|
-
{
|
|
63
|
+
<Boundary {children} />
|
|
63
64
|
|
|
64
65
|
{#if bottomText}
|
|
65
66
|
<p class="text-subtle-2 mt-auto text-xs">{bottomText}</p>
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { ClassValue, HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import type { ResourceTriplet } from '../resource-triplet';
|
|
3
4
|
interface Props extends HTMLAttributes<HTMLElement> {
|
|
4
5
|
title?: string | undefined;
|
|
5
6
|
tooltip?: string | undefined;
|
|
6
7
|
description?: string | undefined;
|
|
7
8
|
bottomText?: string | undefined;
|
|
8
9
|
/** RDK API string; presence renders the title as a linked monospace method name */
|
|
9
|
-
api?:
|
|
10
|
-
class?:
|
|
10
|
+
api?: ResourceTriplet | undefined;
|
|
11
|
+
class?: ClassValue;
|
|
11
12
|
children?: Snippet;
|
|
12
13
|
}
|
|
13
14
|
declare const ApiSection: import("svelte").Component<Props, {}, "">;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Sentry from '@sentry/svelte'
|
|
3
|
+
|
|
4
|
+
const { children } = $props()
|
|
5
|
+
|
|
6
|
+
let isErrorExpanded = $state(false)
|
|
7
|
+
|
|
8
|
+
const describeError = (error: unknown) => {
|
|
9
|
+
return error instanceof Error ? (error.stack ?? error.message) : String(error)
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<svelte:boundary
|
|
14
|
+
onerror={(error) => {
|
|
15
|
+
Sentry.captureException(error)
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
{@render children?.()}
|
|
19
|
+
|
|
20
|
+
{#snippet failed(error, reset)}
|
|
21
|
+
<div
|
|
22
|
+
role="alert"
|
|
23
|
+
class="bg-extralight flex h-full w-full flex-col items-center justify-center gap-2 p-4"
|
|
24
|
+
>
|
|
25
|
+
<div>Something went wrong</div>
|
|
26
|
+
<button
|
|
27
|
+
class="text-subtle-1 text-xs hover:underline"
|
|
28
|
+
type="button"
|
|
29
|
+
onclick={() => {
|
|
30
|
+
isErrorExpanded = false
|
|
31
|
+
reset()
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
Try again
|
|
35
|
+
</button>
|
|
36
|
+
<button
|
|
37
|
+
class="text-danger-dark text-xs hover:underline"
|
|
38
|
+
type="button"
|
|
39
|
+
aria-expanded={isErrorExpanded}
|
|
40
|
+
onclick={() => {
|
|
41
|
+
isErrorExpanded = !isErrorExpanded
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
{isErrorExpanded ? 'Hide' : 'Show'} error
|
|
45
|
+
</button>
|
|
46
|
+
{#if isErrorExpanded}
|
|
47
|
+
<pre class="text-danger-dark font-mono text-xs text-wrap">{describeError(error)}</pre>
|
|
48
|
+
{/if}
|
|
49
|
+
</div>
|
|
50
|
+
{/snippet}
|
|
51
|
+
</svelte:boundary>
|
|
@@ -1,85 +1,81 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte'
|
|
3
3
|
|
|
4
|
-
import { Progress } from '@viamrobotics/prime-core'
|
|
4
|
+
import { Icon, Progress } from '@viamrobotics/prime-core'
|
|
5
5
|
import { MachineConnectionEvent } from '@viamrobotics/sdk'
|
|
6
6
|
import { useConnectionStatus } from '@viamrobotics/svelte-sdk'
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import Boundary from './boundary.svelte'
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
partID: string
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
status?: MachineConnectionEvent
|
|
14
|
-
connected?: Snippet
|
|
12
|
+
connected: Snippet
|
|
13
|
+
dialing?: Snippet
|
|
15
14
|
connecting?: Snippet
|
|
15
|
+
reconnecting?: Snippet
|
|
16
|
+
reconnectionFailed?: Snippet
|
|
17
|
+
disconnecting?: Snippet
|
|
16
18
|
disconnected?: Snippet
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
const {
|
|
20
22
|
partID,
|
|
21
|
-
connectingClass = '',
|
|
22
|
-
disconnectedClass = '',
|
|
23
|
-
status,
|
|
24
23
|
connected,
|
|
24
|
+
dialing,
|
|
25
25
|
connecting,
|
|
26
|
+
reconnecting,
|
|
27
|
+
reconnectionFailed,
|
|
28
|
+
disconnecting,
|
|
26
29
|
disconnected,
|
|
27
30
|
}: Props = $props()
|
|
28
31
|
|
|
29
32
|
const connectionStatus = useConnectionStatus(() => partID)
|
|
30
|
-
const currentStatus = $derived(status ?? connectionStatus.current)
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
const views: Record<MachineConnectionEvent, Snippet> = $derived({
|
|
35
|
+
[MachineConnectionEvent.CONNECTED]: connected,
|
|
36
|
+
[MachineConnectionEvent.DIALING]: dialing ?? loader,
|
|
37
|
+
[MachineConnectionEvent.CONNECTING]: connecting ?? loader,
|
|
38
|
+
[MachineConnectionEvent.RECONNECTING]: reconnecting ?? loader,
|
|
39
|
+
[MachineConnectionEvent.RECONNECTION_FAILED]: reconnectionFailed ?? failed,
|
|
40
|
+
[MachineConnectionEvent.DISCONNECTING]: disconnecting ?? loader,
|
|
41
|
+
[MachineConnectionEvent.DISCONNECTED]: disconnected ?? offline,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const view = $derived(views[connectionStatus.current ?? MachineConnectionEvent.DISCONNECTED])
|
|
33
45
|
</script>
|
|
34
46
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</div>
|
|
64
|
-
{/if}
|
|
65
|
-
{/if}
|
|
47
|
+
{#snippet loader()}
|
|
48
|
+
<div
|
|
49
|
+
class="bg-extralight text-disabled flex h-full min-h-40 w-full items-center justify-center gap-2"
|
|
50
|
+
>
|
|
51
|
+
<Progress />
|
|
52
|
+
<div class="capitalize">{connectionStatus.current}...</div>
|
|
53
|
+
</div>
|
|
54
|
+
{/snippet}
|
|
55
|
+
|
|
56
|
+
{#snippet failed()}
|
|
57
|
+
<div
|
|
58
|
+
class="bg-extralight text-disabled flex h-full min-h-40 w-full items-center justify-center gap-2"
|
|
59
|
+
>
|
|
60
|
+
<Icon
|
|
61
|
+
name="alert"
|
|
62
|
+
cx="text-danger-dark"
|
|
63
|
+
aria-hidden="true"
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
Could not connect to the machine.
|
|
67
|
+
</div>
|
|
68
|
+
{/snippet}
|
|
69
|
+
|
|
70
|
+
{#snippet offline()}
|
|
71
|
+
<div class="bg-extralight text-disabled flex h-full min-h-40 w-full items-center justify-center">
|
|
72
|
+
This machine is offline
|
|
73
|
+
</div>
|
|
74
|
+
{/snippet}
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
>
|
|
74
|
-
<button
|
|
75
|
-
class="text-disabled text-xs hover:underline"
|
|
76
|
-
onclick={() => {
|
|
77
|
-
isErrorExpanded = !isErrorExpanded
|
|
78
|
-
}}>{isErrorExpanded ? 'Hide' : 'Show'} error</button
|
|
79
|
-
>
|
|
80
|
-
{#if isErrorExpanded}
|
|
81
|
-
<pre class="font-mono text-xs text-wrap">{error}</pre>
|
|
82
|
-
{/if}
|
|
83
|
-
</div>
|
|
84
|
-
{/snippet}
|
|
85
|
-
</svelte:boundary>
|
|
76
|
+
{#key connectionStatus.current}
|
|
77
|
+
<!-- fallback outer boundary -->
|
|
78
|
+
<Boundary>
|
|
79
|
+
{@render view()}
|
|
80
|
+
</Boundary>
|
|
81
|
+
{/key}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import { MachineConnectionEvent } from '@viamrobotics/sdk';
|
|
3
2
|
interface Props {
|
|
4
3
|
partID: string;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
status?: MachineConnectionEvent;
|
|
8
|
-
connected?: Snippet;
|
|
4
|
+
connected: Snippet;
|
|
5
|
+
dialing?: Snippet;
|
|
9
6
|
connecting?: Snippet;
|
|
7
|
+
reconnecting?: Snippet;
|
|
8
|
+
reconnectionFailed?: Snippet;
|
|
9
|
+
disconnecting?: Snippet;
|
|
10
10
|
disconnected?: Snippet;
|
|
11
11
|
}
|
|
12
12
|
declare const ConnectionStatus: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,19 +1,18 @@
|
|
|
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
6
|
contentRect: DOMRect | undefined
|
|
8
|
-
|
|
7
|
+
class?: ClassValue
|
|
9
8
|
children?: Snippet
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
const { contentRect,
|
|
11
|
+
const { contentRect, class: classNames = 'h-full w-full', children }: Props = $props()
|
|
13
12
|
</script>
|
|
14
13
|
|
|
15
14
|
<div
|
|
16
|
-
class={
|
|
15
|
+
class={classNames}
|
|
17
16
|
style:width={contentRect ? `${contentRect.width.toString()}px` : undefined}
|
|
18
17
|
style:height={contentRect ? `${contentRect.height.toString()}px` : undefined}
|
|
19
18
|
>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
2
3
|
interface Props {
|
|
3
4
|
contentRect: DOMRect | undefined;
|
|
4
|
-
|
|
5
|
+
class?: ClassValue;
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
}
|
|
7
8
|
declare const ContentRect: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { ClassValue } from 'svelte/elements'
|
|
3
|
+
|
|
2
4
|
import { IconButton, Tooltip } from '@viamrobotics/prime-core'
|
|
3
|
-
import { twMerge } from 'tailwind-merge'
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
lastError: Error | null | undefined
|
|
7
8
|
id?: string
|
|
8
|
-
class?:
|
|
9
|
+
class?: ClassValue
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
const defaultId = $props.id()
|
|
@@ -39,10 +40,10 @@
|
|
|
39
40
|
<div class="flex items-center justify-between gap-1">
|
|
40
41
|
<p
|
|
41
42
|
{id}
|
|
42
|
-
class={
|
|
43
|
+
class={[
|
|
43
44
|
'font-roboto-mono text-danger-dark min-w-0 overflow-auto text-xs wrap-break-word',
|
|
44
|
-
className
|
|
45
|
-
|
|
45
|
+
className,
|
|
46
|
+
]}
|
|
46
47
|
>
|
|
47
48
|
{errorText}
|
|
48
49
|
</p>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ClassValue } from 'svelte/elements';
|
|
1
2
|
interface Props {
|
|
2
3
|
lastError: Error | null | undefined;
|
|
3
4
|
id?: string;
|
|
4
|
-
class?:
|
|
5
|
+
class?: ClassValue;
|
|
5
6
|
}
|
|
6
7
|
declare const Error: import("svelte").Component<Props, {}, "">;
|
|
7
8
|
type Error = ReturnType<typeof Error>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as ConnectionStatus } from './connection-status.svelte';
|
|
2
|
-
export { default as SectionTitle } from './section-title.svelte';
|
|
3
2
|
export { default as ArmWidget } from './widgets/arm/arm.svelte';
|
|
4
3
|
export { default as ArmGetJointPositionsWidget } from './widgets/arm/get-joint-positions-widget.svelte';
|
|
5
4
|
export { default as ArmIsMovingWidget } from './widgets/arm/is-moving-widget.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as ConnectionStatus } from './connection-status.svelte';
|
|
2
|
-
export { default as SectionTitle } from './section-title.svelte';
|
|
3
2
|
export { default as ArmWidget } from './widgets/arm/arm.svelte';
|
|
4
3
|
export { default as ArmGetJointPositionsWidget } from './widgets/arm/get-joint-positions-widget.svelte';
|
|
5
4
|
export { default as ArmIsMovingWidget } from './widgets/arm/is-moving-widget.svelte';
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
19
19
|
|
|
20
|
+
import type { ResourceTriplet } from '../resource-triplet'
|
|
21
|
+
|
|
20
22
|
import ApiSection from './api-section.svelte'
|
|
21
23
|
import Query from './query.svelte'
|
|
22
24
|
import StatusPill from './status-pill.svelte'
|
|
@@ -33,7 +35,7 @@
|
|
|
33
35
|
client: Client
|
|
34
36
|
partID: string
|
|
35
37
|
resourceName: string
|
|
36
|
-
api:
|
|
38
|
+
api: ResourceTriplet
|
|
37
39
|
children?: Snippet
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -54,7 +56,7 @@
|
|
|
54
56
|
title="IsMoving"
|
|
55
57
|
{api}
|
|
56
58
|
bottomText="Updates automatically"
|
|
57
|
-
class="grow"
|
|
59
|
+
class="grow flex-col gap-4"
|
|
58
60
|
>
|
|
59
61
|
<Query {query}>
|
|
60
62
|
<StatusPill isActive={query.data ?? false} />
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ArmClient, BaseClient, GantryClient, GripperClient, MotorClient, ServoClient } from '@viamrobotics/sdk';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { ResourceTriplet } from '../resource-triplet';
|
|
3
4
|
type Client = typeof ArmClient | typeof BaseClient | typeof GantryClient | typeof GripperClient | typeof MotorClient | typeof ServoClient;
|
|
4
5
|
interface Props {
|
|
5
6
|
client: Client;
|
|
6
7
|
partID: string;
|
|
7
8
|
resourceName: string;
|
|
8
|
-
api:
|
|
9
|
+
api: ResourceTriplet;
|
|
9
10
|
children?: Snippet;
|
|
10
11
|
}
|
|
11
12
|
declare const IsMoving: import("svelte").Component<Props, {}, "">;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Creates a maplibre-gl map that will fill its parent.
|
|
5
5
|
|
|
6
|
-
Children will mount once the map is fully loaded.
|
|
6
|
+
Children will mount once the map is fully loaded. They render inside the
|
|
7
|
+
map's own positioned, isolated box, so absolutely positioned overlays sit
|
|
8
|
+
relative to the map and their z-index never competes with the host page.
|
|
7
9
|
|
|
8
10
|
```svelte
|
|
9
11
|
<MapLibre mapProvider="open-street">
|
|
@@ -220,12 +222,8 @@
|
|
|
220
222
|
})
|
|
221
223
|
</script>
|
|
222
224
|
|
|
223
|
-
{#if created}
|
|
224
|
-
{@render children?.()}
|
|
225
|
-
{/if}
|
|
226
|
-
|
|
227
225
|
<div
|
|
228
|
-
class={['h-full', className]}
|
|
226
|
+
class={['relative isolate h-full', className]}
|
|
229
227
|
{...rest}
|
|
230
228
|
>
|
|
231
229
|
<div
|
|
@@ -234,6 +232,7 @@
|
|
|
234
232
|
></div>
|
|
235
233
|
|
|
236
234
|
{#if created}
|
|
235
|
+
{@render children?.()}
|
|
237
236
|
{@render layer?.()}
|
|
238
237
|
{/if}
|
|
239
238
|
</div>
|
|
@@ -56,7 +56,9 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
56
56
|
/**
|
|
57
57
|
* Creates a maplibre-gl map that will fill its parent.
|
|
58
58
|
*
|
|
59
|
-
* Children will mount once the map is fully loaded.
|
|
59
|
+
* Children will mount once the map is fully loaded. They render inside the
|
|
60
|
+
* map's own positioned, isolated box, so absolutely positioned overlays sit
|
|
61
|
+
* relative to the map and their z-index never competes with the host page.
|
|
60
62
|
*
|
|
61
63
|
* ```svelte
|
|
62
64
|
* <MapLibre mapProvider="open-street">
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { ClassValue } from 'svelte/elements'
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import type { ResourceTriplet } from '../resource-triplet'
|
|
5
6
|
|
|
7
|
+
import Boundary from './boundary.svelte'
|
|
6
8
|
import ErrorDisplay from './error.svelte'
|
|
7
9
|
import SectionTitle from './section-title.svelte'
|
|
8
10
|
|
|
@@ -12,8 +14,8 @@
|
|
|
12
14
|
description?: string | undefined
|
|
13
15
|
lastError: Error | null
|
|
14
16
|
/** RDK API string; presence renders the title as a linked monospace method name */
|
|
15
|
-
api?:
|
|
16
|
-
class?:
|
|
17
|
+
api?: ResourceTriplet | undefined
|
|
18
|
+
class?: ClassValue
|
|
17
19
|
titleInput?: Snippet
|
|
18
20
|
error?: Snippet
|
|
19
21
|
children?: Snippet
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
class="flex w-full flex-col gap-2 p-4"
|
|
39
41
|
aria-labelledby={headingID}
|
|
40
42
|
>
|
|
41
|
-
<div class={
|
|
43
|
+
<div class={['flex grow flex-row flex-wrap gap-2', className]}>
|
|
42
44
|
<div class="flex max-w-50 grow flex-col gap-0.5 pr-4">
|
|
43
45
|
{#if api}
|
|
44
46
|
<SectionTitle
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
</div>
|
|
63
65
|
|
|
64
66
|
<div class="flex grow flex-wrap justify-between gap-2">
|
|
65
|
-
{
|
|
67
|
+
<Boundary {children} />
|
|
66
68
|
</div>
|
|
67
69
|
</div>
|
|
68
70
|
{#if error}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
3
|
+
import type { ResourceTriplet } from '../resource-triplet';
|
|
2
4
|
interface Props {
|
|
3
5
|
title: string;
|
|
4
6
|
tooltip?: string | undefined;
|
|
5
7
|
description?: string | undefined;
|
|
6
8
|
lastError: Error | null;
|
|
7
9
|
/** RDK API string; presence renders the title as a linked monospace method name */
|
|
8
|
-
api?:
|
|
9
|
-
class?:
|
|
10
|
+
api?: ResourceTriplet | undefined;
|
|
11
|
+
class?: ClassValue;
|
|
10
12
|
titleInput?: Snippet;
|
|
11
13
|
error?: Snippet;
|
|
12
14
|
children?: Snippet;
|