@viamrobotics/test-widgets 0.15.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +58 -49
- package/dist/components/api-section.svelte.d.ts +24 -10
- 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 +10 -5
- package/dist/components/content-rect.svelte.d.ts +3 -1
- package/dist/components/error.svelte +15 -5
- package/dist/components/error.svelte.d.ts +8 -1
- package/dist/components/index.d.ts +4 -3
- package/dist/components/index.js +4 -3
- package/dist/components/is-moving.svelte +29 -35
- package/dist/components/is-moving.svelte.d.ts +6 -6
- package/dist/components/maplibre/index.svelte +5 -6
- package/dist/components/maplibre/index.svelte.d.ts +3 -1
- package/dist/components/pose-editor.svelte +83 -15
- package/dist/components/pose-editor.svelte.d.ts +11 -4
- package/dist/components/progress.svelte +1 -0
- package/dist/components/queries.svelte +14 -4
- package/dist/components/queries.svelte.d.ts +6 -1
- package/dist/components/query.svelte +11 -3
- package/dist/components/query.svelte.d.ts +6 -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 +21 -0
- package/dist/components/section/index.js +21 -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-error-reporter.d.ts +8 -0
- package/dist/components/section/section-error-reporter.js +7 -0
- package/dist/components/section/section-error.svelte +36 -0
- package/dist/components/section/section-error.svelte.d.ts +9 -0
- package/dist/components/section/section-errors.svelte +145 -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 +23 -0
- package/dist/components/section/section.svelte.d.ts +11 -0
- package/dist/components/section/use-section-errors.svelte.d.ts +19 -0
- package/dist/components/section/use-section-errors.svelte.js +49 -0
- package/dist/components/stop-button.svelte +1 -5
- package/dist/components/stop-button.svelte.d.ts +0 -1
- package/dist/components/stop.svelte +31 -14
- package/dist/components/stop.svelte.d.ts +6 -1
- package/dist/components/widgets/arm/arm.svelte +43 -40
- package/dist/components/widgets/arm/get-joint-positions-widget.svelte +10 -9
- 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 +16 -6
- package/dist/components/widgets/arm/manual-mode.svelte +1 -5
- package/dist/components/widgets/arm/manual-mode.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +22 -8
- package/dist/components/widgets/arm/move-to-joint-positions.svelte +15 -17
- package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/move-to-position-control.svelte +45 -33
- package/dist/components/widgets/arm/move-to-position.svelte +97 -34
- package/dist/components/widgets/arm/move-to-position.svelte.d.ts +3 -2
- package/dist/components/widgets/arm/quick-move-widget.svelte +10 -4
- package/dist/components/widgets/arm/quick-move.svelte +1 -4
- package/dist/components/widgets/arm/quick-move.svelte.d.ts +0 -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 +80 -77
- package/dist/components/widgets/audio-input/get-properties-widget.svelte +16 -16
- package/dist/components/widgets/audio-output/audio-output.svelte +87 -84
- package/dist/components/widgets/audio-output/get-properties-widget.svelte +16 -16
- package/dist/components/widgets/base/base.svelte +78 -43
- package/dist/components/widgets/base/move-straight-widget.svelte +16 -4
- package/dist/components/widgets/base/quick-move-widget.svelte +25 -9
- package/dist/components/widgets/base/quick-move.svelte +5 -6
- package/dist/components/widgets/base/set-power-widget.svelte +20 -8
- package/dist/components/widgets/base/set-power.svelte +6 -4
- package/dist/components/widgets/base/set-velocity-widget.svelte +20 -8
- package/dist/components/widgets/base/set-velocity.svelte +6 -4
- package/dist/components/widgets/base/spin-widget.svelte +20 -8
- 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/board/read-write-pins.svelte +2 -2
- package/dist/components/widgets/button/push.svelte +2 -2
- package/dist/components/widgets/camera/camera.svelte +17 -24
- package/dist/components/widgets/camera/live-or-polling-video.svelte +33 -30
- package/dist/components/widgets/custom-control/__tests__/__fixtures__/with-sibling.svelte +10 -0
- package/dist/components/widgets/custom-control/control-frame.svelte +60 -0
- package/dist/components/widgets/custom-control/control-frame.svelte.d.ts +10 -0
- package/dist/components/widgets/custom-control/create-control-host.svelte.d.ts +19 -0
- package/dist/components/widgets/custom-control/create-control-host.svelte.js +26 -0
- package/dist/components/widgets/custom-control/custom-control.d.ts +35 -0
- package/dist/components/widgets/custom-control/custom-control.js +85 -0
- package/dist/components/widgets/custom-control/custom-control.svelte +45 -0
- package/dist/components/widgets/custom-control/custom-control.svelte.d.ts +14 -0
- package/dist/components/widgets/discovery/discovery.svelte +13 -17
- package/dist/components/widgets/encoder/encoder.svelte +25 -21
- package/dist/components/widgets/encoder/get-position-widget.svelte +19 -16
- package/dist/components/widgets/gantry/gantry.svelte +58 -76
- package/dist/components/widgets/gantry/get-position-widget.svelte +15 -14
- package/dist/components/widgets/gantry/home.svelte +21 -10
- package/dist/components/widgets/gantry/move-to-position-widget.svelte +2 -1
- package/dist/components/widgets/gantry/move-to-position.svelte +1 -4
- package/dist/components/widgets/gantry/move-to-position.svelte.d.ts +0 -1
- package/dist/components/widgets/gantry/quick-move-widget.svelte +3 -2
- package/dist/components/widgets/gantry/quick-move.svelte +1 -5
- package/dist/components/widgets/gantry/quick-move.svelte.d.ts +0 -1
- package/dist/components/widgets/generic/generic.svelte +11 -6
- package/dist/components/widgets/gripper/grab-widget.svelte +26 -0
- package/dist/components/widgets/gripper/grab-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/grab.svelte +3 -19
- package/dist/components/widgets/gripper/grab.svelte.d.ts +1 -2
- package/dist/components/widgets/gripper/gripper.svelte +18 -18
- package/dist/components/widgets/gripper/is-holding-something.svelte +21 -21
- package/dist/components/widgets/gripper/open-widget.svelte +26 -0
- package/dist/components/widgets/gripper/open-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/open.svelte +3 -19
- package/dist/components/widgets/gripper/open.svelte.d.ts +1 -2
- package/dist/components/widgets/input-controller/input-controller.svelte +10 -16
- package/dist/components/widgets/input-controller/webgamepad.svelte +2 -2
- 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 +27 -31
- package/dist/components/widgets/motion/move-widget.svelte +32 -12
- package/dist/components/widgets/motion/move-widget.svelte.d.ts +6 -0
- package/dist/components/widgets/motion/move.svelte +6 -16
- package/dist/components/widgets/motion/move.svelte.d.ts +0 -1
- package/dist/components/widgets/motor/go-for-view.svelte +16 -8
- package/dist/components/widgets/motor/go-to-view.svelte +12 -4
- package/dist/components/widgets/motor/motor.svelte +100 -64
- package/dist/components/widgets/motor/quick-move-widget.svelte +16 -8
- package/dist/components/widgets/motor/set-power-widget.svelte +12 -4
- package/dist/components/widgets/motor/set-rpm-widget.svelte +12 -4
- package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +8 -11
- package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +8 -11
- package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +8 -11
- package/dist/components/widgets/movement-sensor/get-position-widget.svelte +8 -11
- package/dist/components/widgets/movement-sensor/movement-sensor.svelte +64 -66
- package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +2 -1
- package/dist/components/widgets/power-sensor/get-current-widget.svelte +8 -11
- package/dist/components/widgets/power-sensor/get-power-widget.svelte +8 -11
- package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +8 -11
- package/dist/components/widgets/power-sensor/power-sensor.svelte +35 -45
- package/dist/components/widgets/sensor/sensor.svelte +8 -12
- package/dist/components/widgets/servo/move-widget.svelte +2 -1
- package/dist/components/widgets/servo/move.svelte +1 -4
- package/dist/components/widgets/servo/move.svelte.d.ts +0 -1
- package/dist/components/widgets/servo/quick-move-widget.svelte +2 -1
- package/dist/components/widgets/servo/quick-move.svelte +1 -5
- package/dist/components/widgets/servo/quick-move.svelte.d.ts +0 -1
- package/dist/components/widgets/servo/servo.svelte +53 -37
- package/dist/components/widgets/slam/get-position-widget.svelte +8 -11
- package/dist/components/widgets/slam/move-on-map.svelte +9 -6
- package/dist/components/widgets/slam/move-on-map.svelte.d.ts +2 -1
- package/dist/components/widgets/slam/slam.svelte +65 -75
- package/dist/components/widgets/switch/position-view.svelte +1 -1
- package/dist/components/widgets/switch/position.svelte +2 -2
- 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 +19 -5
- package/dist/components/board/pin-section.svelte +0 -28
- package/dist/components/board/pin-section.svelte.d.ts +0 -9
- package/dist/components/mutation-section.svelte +0 -73
- package/dist/components/mutation-section.svelte.d.ts +0 -16
- package/dist/components/mutation-view.svelte +0 -29
- package/dist/components/mutation-view.svelte.d.ts +0 -10
- package/dist/components/section-group.svelte +0 -64
- package/dist/components/section-group.svelte.d.ts +0 -14
- package/dist/components/section-title.svelte +0 -63
- package/dist/components/section-title.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) => {
|
|
@@ -2,66 +2,75 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte'
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import type { ResourceTriplet } from '../resource-triplet'
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { Section } from './section'
|
|
8
|
+
import {
|
|
9
|
+
type SectionMutation,
|
|
10
|
+
type SectionQuery,
|
|
11
|
+
useSectionErrors,
|
|
12
|
+
} from './section/use-section-errors.svelte'
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
/**
|
|
15
|
+
* What the section reads or writes. At least one list is required, so every section's errors
|
|
16
|
+
* reach its indicator. Query errors are distinct per query, mutation errors per mutation.
|
|
17
|
+
*/
|
|
18
|
+
type Sources =
|
|
19
|
+
| { queries: SectionQuery[]; mutations?: SectionMutation[] }
|
|
20
|
+
| { queries?: SectionQuery[]; mutations: SectionMutation[] }
|
|
21
|
+
|
|
22
|
+
type Props = HTMLAttributes<HTMLElement> &
|
|
23
|
+
Sources & {
|
|
24
|
+
/** RDK method name in PascalCase. */
|
|
25
|
+
method: string
|
|
26
|
+
api: ResourceTriplet
|
|
27
|
+
subheading?: Snippet
|
|
28
|
+
tooltip?: Snippet
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Exists only for the migration. Removed once every section passes it.
|
|
31
|
+
*/
|
|
32
|
+
skeleton?: boolean
|
|
33
|
+
}
|
|
19
34
|
|
|
20
35
|
const {
|
|
21
|
-
|
|
22
|
-
tooltip,
|
|
23
|
-
description,
|
|
24
|
-
bottomText,
|
|
36
|
+
method,
|
|
25
37
|
api,
|
|
26
|
-
|
|
38
|
+
queries = [],
|
|
39
|
+
mutations = [],
|
|
40
|
+
subheading,
|
|
41
|
+
tooltip,
|
|
42
|
+
skeleton = false,
|
|
27
43
|
children,
|
|
28
44
|
...rest
|
|
29
45
|
}: Props = $props()
|
|
30
46
|
|
|
31
|
-
const
|
|
47
|
+
const sectionErrors = useSectionErrors(() => ({ queries, mutations }))
|
|
32
48
|
</script>
|
|
33
49
|
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
aria-labelledby={title ? headingID : undefined}
|
|
50
|
+
<Section
|
|
51
|
+
errorReporter={sectionErrors}
|
|
37
52
|
{...rest}
|
|
38
53
|
>
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
</h3>
|
|
55
|
-
{/if}
|
|
56
|
-
{#if description}
|
|
57
|
-
<p class="text-subtle-2 text-xs">{description}</p>
|
|
58
|
-
{/if}
|
|
59
|
-
</div>
|
|
60
|
-
{/if}
|
|
61
|
-
|
|
62
|
-
{@render children?.()}
|
|
54
|
+
<div class="flex flex-col gap-0.5">
|
|
55
|
+
<Section.Heading>
|
|
56
|
+
<Section.Method
|
|
57
|
+
{method}
|
|
58
|
+
{api}
|
|
59
|
+
/>
|
|
60
|
+
{#snippet aside()}
|
|
61
|
+
<Section.Errors errors={sectionErrors.errors} />
|
|
62
|
+
{#if tooltip}
|
|
63
|
+
<Section.Tooltip>{@render tooltip()}</Section.Tooltip>
|
|
64
|
+
{/if}
|
|
65
|
+
{/snippet}
|
|
66
|
+
</Section.Heading>
|
|
67
|
+
{@render subheading?.()}
|
|
68
|
+
</div>
|
|
63
69
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
<Section.Body
|
|
71
|
+
isLoading={sectionErrors.isLoading}
|
|
72
|
+
{skeleton}
|
|
73
|
+
>
|
|
74
|
+
{@render children?.()}
|
|
75
|
+
</Section.Body>
|
|
76
|
+
</Section>
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
3
|
+
import type { ResourceTriplet } from '../resource-triplet';
|
|
4
|
+
import { type SectionMutation, type SectionQuery } from './section/use-section-errors.svelte';
|
|
5
|
+
/**
|
|
6
|
+
* What the section reads or writes. At least one list is required, so every section's errors
|
|
7
|
+
* reach its indicator. Query errors are distinct per query, mutation errors per mutation.
|
|
8
|
+
*/
|
|
9
|
+
type Sources = {
|
|
10
|
+
queries: SectionQuery[];
|
|
11
|
+
mutations?: SectionMutation[];
|
|
12
|
+
} | {
|
|
13
|
+
queries?: SectionQuery[];
|
|
14
|
+
mutations: SectionMutation[];
|
|
15
|
+
};
|
|
16
|
+
type Props = HTMLAttributes<HTMLElement> & Sources & {
|
|
17
|
+
/** RDK method name in PascalCase. */
|
|
18
|
+
method: string;
|
|
19
|
+
api: ResourceTriplet;
|
|
20
|
+
subheading?: Snippet;
|
|
21
|
+
tooltip?: Snippet;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Exists only for the migration. Removed once every section passes it.
|
|
24
|
+
*/
|
|
25
|
+
skeleton?: boolean;
|
|
26
|
+
};
|
|
13
27
|
declare const ApiSection: import("svelte").Component<Props, {}, "">;
|
|
14
28
|
type ApiSection = ReturnType<typeof ApiSection>;
|
|
15
29
|
export default ApiSection;
|
|
@@ -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,24 @@
|
|
|
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
|
+
|
|
1
7
|
<script lang="ts">
|
|
2
8
|
import type { Snippet } from 'svelte'
|
|
3
|
-
|
|
4
|
-
import { twMerge } from 'tailwind-merge'
|
|
9
|
+
import type { ClassValue } from 'svelte/elements'
|
|
5
10
|
|
|
6
11
|
interface Props {
|
|
7
12
|
contentRect: DOMRect | undefined
|
|
8
|
-
|
|
13
|
+
class?: ClassValue
|
|
9
14
|
children?: Snippet
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
const { contentRect,
|
|
17
|
+
const { contentRect, class: classNames = 'h-full w-full', children }: Props = $props()
|
|
13
18
|
</script>
|
|
14
19
|
|
|
15
20
|
<div
|
|
16
|
-
class={
|
|
21
|
+
class={classNames}
|
|
17
22
|
style:width={contentRect ? `${contentRect.width.toString()}px` : undefined}
|
|
18
23
|
style:height={contentRect ? `${contentRect.height.toString()}px` : undefined}
|
|
19
24
|
>
|
|
@@ -1,9 +1,11 @@
|
|
|
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
|
}
|
|
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. */
|
|
7
9
|
declare const ContentRect: import("svelte").Component<Props, {}, "">;
|
|
8
10
|
type ContentRect = ReturnType<typeof ContentRect>;
|
|
9
11
|
export default ContentRect;
|
|
@@ -1,11 +1,21 @@
|
|
|
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
|
+
|
|
1
10
|
<script lang="ts">
|
|
11
|
+
import type { ClassValue } from 'svelte/elements'
|
|
12
|
+
|
|
2
13
|
import { IconButton, Tooltip } from '@viamrobotics/prime-core'
|
|
3
|
-
import { twMerge } from 'tailwind-merge'
|
|
4
14
|
|
|
5
15
|
interface Props {
|
|
6
16
|
lastError: Error | null | undefined
|
|
7
17
|
id?: string
|
|
8
|
-
class?:
|
|
18
|
+
class?: ClassValue
|
|
9
19
|
}
|
|
10
20
|
|
|
11
21
|
const defaultId = $props.id()
|
|
@@ -39,10 +49,10 @@
|
|
|
39
49
|
<div class="flex items-center justify-between gap-1">
|
|
40
50
|
<p
|
|
41
51
|
{id}
|
|
42
|
-
class={
|
|
52
|
+
class={[
|
|
43
53
|
'font-roboto-mono text-danger-dark min-w-0 overflow-auto text-xs wrap-break-word',
|
|
44
|
-
className
|
|
45
|
-
|
|
54
|
+
className,
|
|
55
|
+
]}
|
|
46
56
|
>
|
|
47
57
|
{errorText}
|
|
48
58
|
</p>
|
|
@@ -1,8 +1,15 @@
|
|
|
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
|
}
|
|
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
|
+
*/
|
|
6
13
|
declare const Error: import("svelte").Component<Props, {}, "">;
|
|
7
14
|
type Error = ReturnType<typeof Error>;
|
|
8
15
|
export default 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';
|
|
@@ -37,11 +36,11 @@ export { default as GantryHomeWidget } from './widgets/gantry/home.svelte';
|
|
|
37
36
|
export { default as GantryMoveToPositionWidget } from './widgets/gantry/move-to-position-widget.svelte';
|
|
38
37
|
export { default as GantryQuickMoveWidget } from './widgets/gantry/quick-move-widget.svelte';
|
|
39
38
|
export { default as GenericWidget } from './widgets/generic/generic.svelte';
|
|
40
|
-
export { default as GripperGrabWidget } from './widgets/gripper/grab.svelte';
|
|
39
|
+
export { default as GripperGrabWidget } from './widgets/gripper/grab-widget.svelte';
|
|
41
40
|
export { default as GripperWidget } from './widgets/gripper/gripper.svelte';
|
|
42
41
|
export { default as GripperIsHoldingSomethingWidget } from './widgets/gripper/is-holding-something.svelte';
|
|
43
42
|
export { default as GripperIsMovingWidget } from './widgets/gripper/is-moving-widget.svelte';
|
|
44
|
-
export { default as GripperOpenWidget } from './widgets/gripper/open.svelte';
|
|
43
|
+
export { default as GripperOpenWidget } from './widgets/gripper/open-widget.svelte';
|
|
45
44
|
export { default as InputControllerWidget } from './widgets/input-controller/input-controller.svelte';
|
|
46
45
|
export { default as MLModelServiceWidget } from './widgets/ml-model-service/ml-model-service.svelte';
|
|
47
46
|
export { default as MotionServiceWidget } from './widgets/motion/motion.svelte';
|
|
@@ -80,3 +79,5 @@ export { default as VisionServiceWidget } from './widgets/vision-service/vision-
|
|
|
80
79
|
export { default as RefetchController } from './refetch-controller.svelte';
|
|
81
80
|
export { NavigationMap, NavigationTab, type NavigationTabType, type Shapes, type CapsuleGeometry, type SphereGeometry, type BoxGeometry, type Geometry, type Obstacle, type Path, } from './navigation-map';
|
|
82
81
|
export { MapLibre, MapLibreMarker, CenterControls, FollowControls, NavigationControls, SatelliteControls, DirectionalMarker, LngLatInput, MapProviders, type MapProvider, GeoPose, Waypoint, useMapLibre, useMapLibreEvent, useMapLibreThreeRaycast, useMapLibreThreeRenderer, lngLatToMercator, mercatorToCartesian, lngLatToCartesian, cartesianToMercator, cartesianToLngLat, } from './maplibre';
|
|
82
|
+
export { default as CustomControlWidget } from './widgets/custom-control/custom-control.svelte';
|
|
83
|
+
export { CUSTOM_CONTROL_COMMAND, CUSTOM_CONTROL_CSP, type CustomControlArtifact, loadCustomControl, prepareArtifact, } from './widgets/custom-control/custom-control.ts';
|
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';
|
|
@@ -36,11 +35,11 @@ export { default as GantryHomeWidget } from './widgets/gantry/home.svelte';
|
|
|
36
35
|
export { default as GantryMoveToPositionWidget } from './widgets/gantry/move-to-position-widget.svelte';
|
|
37
36
|
export { default as GantryQuickMoveWidget } from './widgets/gantry/quick-move-widget.svelte';
|
|
38
37
|
export { default as GenericWidget } from './widgets/generic/generic.svelte';
|
|
39
|
-
export { default as GripperGrabWidget } from './widgets/gripper/grab.svelte';
|
|
38
|
+
export { default as GripperGrabWidget } from './widgets/gripper/grab-widget.svelte';
|
|
40
39
|
export { default as GripperWidget } from './widgets/gripper/gripper.svelte';
|
|
41
40
|
export { default as GripperIsHoldingSomethingWidget } from './widgets/gripper/is-holding-something.svelte';
|
|
42
41
|
export { default as GripperIsMovingWidget } from './widgets/gripper/is-moving-widget.svelte';
|
|
43
|
-
export { default as GripperOpenWidget } from './widgets/gripper/open.svelte';
|
|
42
|
+
export { default as GripperOpenWidget } from './widgets/gripper/open-widget.svelte';
|
|
44
43
|
export { default as InputControllerWidget } from './widgets/input-controller/input-controller.svelte';
|
|
45
44
|
export { default as MLModelServiceWidget } from './widgets/ml-model-service/ml-model-service.svelte';
|
|
46
45
|
export { default as MotionServiceWidget } from './widgets/motion/motion.svelte';
|
|
@@ -79,3 +78,5 @@ export { default as VisionServiceWidget } from './widgets/vision-service/vision-
|
|
|
79
78
|
export { default as RefetchController } from './refetch-controller.svelte';
|
|
80
79
|
export { NavigationMap, NavigationTab, } from './navigation-map';
|
|
81
80
|
export { MapLibre, MapLibreMarker, CenterControls, FollowControls, NavigationControls, SatelliteControls, DirectionalMarker, LngLatInput, MapProviders, GeoPose, Waypoint, useMapLibre, useMapLibreEvent, useMapLibreThreeRaycast, useMapLibreThreeRenderer, lngLatToMercator, mercatorToCartesian, lngLatToCartesian, cartesianToMercator, cartesianToLngLat, } from './maplibre';
|
|
81
|
+
export { default as CustomControlWidget } from './widgets/custom-control/custom-control.svelte';
|
|
82
|
+
export { CUSTOM_CONTROL_COMMAND, CUSTOM_CONTROL_CSP, loadCustomControl, prepareArtifact, } from "./widgets/custom-control/custom-control.js";
|