@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
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { BaseClient, type Vector3 } from '@viamrobotics/sdk'
|
|
3
3
|
import { createResourceClient, createResourceMutation } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import ApiSection from '../../api-section.svelte'
|
|
6
|
+
import { Section } from '../../section'
|
|
7
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
6
8
|
|
|
7
9
|
import SetVelocity from './set-velocity.svelte'
|
|
8
10
|
|
|
@@ -22,10 +24,20 @@
|
|
|
22
24
|
const setVelocityMutation = createResourceMutation(client, 'setVelocity')
|
|
23
25
|
</script>
|
|
24
26
|
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
<ApiSection
|
|
28
|
+
class="flex-row flex-wrap gap-2"
|
|
29
|
+
method="SetVelocity"
|
|
30
|
+
api={ResourceTriplets.Base}
|
|
31
|
+
mutations={[setVelocityMutation]}
|
|
32
|
+
>
|
|
33
|
+
{#snippet subheading()}
|
|
34
|
+
<Section.Text>Move continually at a given velocity</Section.Text>
|
|
35
|
+
{/snippet}
|
|
36
|
+
<div class="flex grow flex-wrap justify-between gap-2">
|
|
37
|
+
<SetVelocity
|
|
38
|
+
setVelocity={(linear: Vector3, angular: Vector3) => {
|
|
39
|
+
setVelocityMutation.mutate([linear, angular], {})
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</ApiSection>
|
|
@@ -17,17 +17,19 @@
|
|
|
17
17
|
|
|
18
18
|
<div class="flex flex-wrap gap-4">
|
|
19
19
|
<Vec3Builder
|
|
20
|
-
title="Linear velocity"
|
|
21
20
|
titleUnits="(mm/s)"
|
|
22
21
|
yTooltip="Only Y is used for a wheeled base, since Viam’s coordinate system considers +Y to be the forward axis."
|
|
23
22
|
bind:vector={linearVelocity}
|
|
24
|
-
|
|
23
|
+
>
|
|
24
|
+
{#snippet title()}Linear velocity{/snippet}
|
|
25
|
+
</Vec3Builder>
|
|
25
26
|
<Vec3Builder
|
|
26
|
-
title="Angular velocity"
|
|
27
27
|
titleUnits="(º/s)"
|
|
28
28
|
zTooltip="Only Z is used for a wheeled base, since Viam’s coordinate system considers +Z to point up and the angular velocity to rotate around the Z axis."
|
|
29
29
|
bind:vector={angularVelocity}
|
|
30
|
-
|
|
30
|
+
>
|
|
31
|
+
{#snippet title()}Angular velocity{/snippet}
|
|
32
|
+
</Vec3Builder>
|
|
31
33
|
</div>
|
|
32
34
|
|
|
33
35
|
<Button
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { BaseClient } from '@viamrobotics/sdk'
|
|
3
3
|
import { createResourceClient, createResourceMutation } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import ApiSection from '../../api-section.svelte'
|
|
6
|
+
import { Section } from '../../section'
|
|
7
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
6
8
|
|
|
7
9
|
import Spin from './spin.svelte'
|
|
8
10
|
|
|
@@ -22,10 +24,20 @@
|
|
|
22
24
|
const spinMutation = createResourceMutation(client, 'spin')
|
|
23
25
|
</script>
|
|
24
26
|
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
<ApiSection
|
|
28
|
+
class="flex-row flex-wrap gap-2"
|
|
29
|
+
method="Spin"
|
|
30
|
+
api={ResourceTriplets.Base}
|
|
31
|
+
mutations={[spinMutation]}
|
|
32
|
+
>
|
|
33
|
+
{#snippet subheading()}
|
|
34
|
+
<Section.Text>Turn to a given angle at a given velocity</Section.Text>
|
|
35
|
+
{/snippet}
|
|
36
|
+
<div class="flex grow flex-wrap justify-between gap-2">
|
|
37
|
+
<Spin
|
|
38
|
+
spin={(angleDeg: number, degsPerSec: number) => {
|
|
39
|
+
spinMutation.mutate([angleDeg, degsPerSec], {})
|
|
40
|
+
}}
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</ApiSection>
|
|
@@ -5,13 +5,14 @@ I'd be wary of using this elsewhere unless the use case & styling is identitcal
|
|
|
5
5
|
-->
|
|
6
6
|
<script lang="ts">
|
|
7
7
|
import type { Vector3 } from '@viamrobotics/sdk'
|
|
8
|
+
import type { Snippet } from 'svelte'
|
|
8
9
|
|
|
9
10
|
import { Icon, Label, NumericInput, Tooltip } from '@viamrobotics/prime-core'
|
|
10
11
|
|
|
11
12
|
import { numberValueFromEvent } from '../../../event-handlers'
|
|
12
13
|
|
|
13
14
|
interface Props {
|
|
14
|
-
title:
|
|
15
|
+
title: Snippet
|
|
15
16
|
titleUnits?: string | undefined
|
|
16
17
|
titleTooltip?: string | undefined
|
|
17
18
|
vector: Vector3
|
|
@@ -41,7 +42,7 @@ I'd be wary of using this elsewhere unless the use case & styling is identitcal
|
|
|
41
42
|
class="bg-light flex flex-row place-content-center gap-1 px-2 py-1.5"
|
|
42
43
|
id={builderID}
|
|
43
44
|
>
|
|
44
|
-
{title}
|
|
45
|
+
{@render title()}
|
|
45
46
|
{#if titleUnits}
|
|
46
47
|
<abbr class="text-disabled">{titleUnits}</abbr>
|
|
47
48
|
{/if}
|
|
@@ -16,10 +16,8 @@
|
|
|
16
16
|
const getButtonId = `${id}-get`
|
|
17
17
|
</script>
|
|
18
18
|
|
|
19
|
-
<PinSection
|
|
20
|
-
title
|
|
21
|
-
class="h-fit"
|
|
22
|
-
>
|
|
19
|
+
<PinSection class="h-fit">
|
|
20
|
+
{#snippet title()}Read pin{/snippet}
|
|
23
21
|
<section
|
|
24
22
|
class="flex h-full max-h-18.5 w-full flex-col gap-1 p-3 text-xs"
|
|
25
23
|
aria-labelledby={sectionId}
|
|
@@ -15,10 +15,8 @@
|
|
|
15
15
|
const { setValue }: Props = $props()
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<PinSection
|
|
19
|
-
title
|
|
20
|
-
class="h-fit"
|
|
21
|
-
>
|
|
18
|
+
<PinSection class="h-fit">
|
|
19
|
+
{#snippet title()}Write pin{/snippet}
|
|
22
20
|
<div class="flex h-full max-h-18.5 w-full p-3">
|
|
23
21
|
<Label cx="w-fit!">
|
|
24
22
|
<h5>Value</h5>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte'
|
|
3
|
-
|
|
4
|
-
import { twMerge } from 'tailwind-merge'
|
|
3
|
+
import type { ClassValue } from 'svelte/elements'
|
|
5
4
|
|
|
6
5
|
interface Props {
|
|
7
|
-
title:
|
|
8
|
-
class?:
|
|
6
|
+
title: Snippet
|
|
7
|
+
class?: ClassValue
|
|
9
8
|
children?: Snippet
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -15,14 +14,14 @@
|
|
|
15
14
|
</script>
|
|
16
15
|
|
|
17
16
|
<section
|
|
18
|
-
class={
|
|
17
|
+
class={['border-light w-full max-w-50 gap-6 divide-y border', className]}
|
|
19
18
|
aria-labelledby={headingID}
|
|
20
19
|
>
|
|
21
20
|
<h4
|
|
22
21
|
id={headingID}
|
|
23
22
|
class="bg-light font-roboto-mono text-subtle-1 px-3 py-1.25 text-center text-sm uppercase"
|
|
24
23
|
>
|
|
25
|
-
{title}
|
|
24
|
+
{@render title()}
|
|
26
25
|
</h4>
|
|
27
26
|
{@render children?.()}
|
|
28
27
|
</section>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'svelte/elements';
|
|
2
3
|
interface Props {
|
|
3
|
-
title:
|
|
4
|
-
class?:
|
|
4
|
+
title: Snippet;
|
|
5
|
+
class?: ClassValue;
|
|
5
6
|
children?: Snippet;
|
|
6
7
|
}
|
|
7
8
|
declare const PinSection: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { Section } from '../../section'
|
|
3
3
|
|
|
4
4
|
import AnalogReadWrapper from './analog-read-wrapper.svelte'
|
|
5
5
|
import AnalogWriteWrapper from './analog-write-wrapper.svelte'
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
/>
|
|
69
69
|
{/if}
|
|
70
70
|
</div>
|
|
71
|
-
<
|
|
71
|
+
<Section.Error error={currentError} />
|
|
72
72
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { ButtonClient } from '@viamrobotics/sdk'
|
|
4
4
|
import { createResourceClient, createResourceMutation } from '@viamrobotics/svelte-sdk'
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { Section } from '../../section'
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
partID: string
|
|
@@ -29,4 +29,4 @@
|
|
|
29
29
|
>
|
|
30
30
|
Push
|
|
31
31
|
</Button>
|
|
32
|
-
<
|
|
32
|
+
<Section.Error error={pushMutation.error} />
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
createRefetchIntervalStore,
|
|
15
15
|
RefetchIntervals,
|
|
16
16
|
} from '../../refetch-interval-store.svelte'
|
|
17
|
-
import
|
|
17
|
+
import { Section } from '../../section'
|
|
18
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
18
19
|
|
|
19
20
|
import PCDWidget from '../pcd/pcd-widget.svelte'
|
|
20
21
|
import ExportScreenshot from './export-screenshot.svelte'
|
|
@@ -155,24 +156,18 @@
|
|
|
155
156
|
const setMousePostionTooltip = (event: CustomEvent<string>) => {
|
|
156
157
|
mousePostionTooltip = event.detail as 'On' | 'Off'
|
|
157
158
|
}
|
|
158
|
-
|
|
159
|
-
const headingID = $props.id()
|
|
160
|
-
const getImagesHeadingID = `${headingID}-images`
|
|
161
|
-
const getPointCloudHeadingID = `${headingID}-point-cloud`
|
|
162
159
|
</script>
|
|
163
160
|
|
|
164
161
|
<ConnectionStatus {partID}>
|
|
165
162
|
{#snippet connected()}
|
|
166
|
-
<section
|
|
167
|
-
class="flex flex-col"
|
|
168
|
-
aria-labelledby={getImagesHeadingID}
|
|
169
|
-
>
|
|
163
|
+
<section class="flex flex-col">
|
|
170
164
|
<div class="flex flex-col gap-0.5 p-4 pb-0">
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
<Section.Heading>
|
|
166
|
+
<Section.Method
|
|
167
|
+
method="GetImages"
|
|
168
|
+
api={ResourceTriplets.Camera}
|
|
169
|
+
/>
|
|
170
|
+
</Section.Heading>
|
|
176
171
|
</div>
|
|
177
172
|
<div class="p-4">
|
|
178
173
|
{#if isPlaying}
|
|
@@ -332,16 +327,14 @@
|
|
|
332
327
|
</div>
|
|
333
328
|
</section>
|
|
334
329
|
|
|
335
|
-
<section
|
|
336
|
-
class="flex flex-col gap-4 p-4"
|
|
337
|
-
aria-labelledby={getPointCloudHeadingID}
|
|
338
|
-
>
|
|
330
|
+
<section class="flex flex-col gap-4 p-4">
|
|
339
331
|
<div class="flex flex-col gap-0.5">
|
|
340
|
-
<
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
332
|
+
<Section.Heading>
|
|
333
|
+
<Section.Method
|
|
334
|
+
method="GetPointCloud"
|
|
335
|
+
api={ResourceTriplets.Camera}
|
|
336
|
+
/>
|
|
337
|
+
</Section.Heading>
|
|
345
338
|
<p class="text-subtle-2 text-xs">
|
|
346
339
|
Get depth measurement data from cameras with depth sensing support
|
|
347
340
|
</p>
|
|
@@ -356,7 +349,7 @@
|
|
|
356
349
|
{#if isShowingPointcloud}
|
|
357
350
|
<Query
|
|
358
351
|
query={pointcloudQuery}
|
|
359
|
-
|
|
352
|
+
class="h-6"
|
|
360
353
|
>
|
|
361
354
|
{#if pointcloudQuery.data}
|
|
362
355
|
<PCDWidget data={pointcloudQuery.data} />
|
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
import { untrack } from 'svelte'
|
|
9
9
|
|
|
10
10
|
import { assertExists } from '../../../assert'
|
|
11
|
+
import ApiSection from '../../api-section.svelte'
|
|
11
12
|
import ContentRect from '../../content-rect.svelte'
|
|
12
13
|
import ErrorDisplay from '../../error.svelte'
|
|
13
|
-
import MutationSection from '../../mutation-section.svelte'
|
|
14
14
|
import Progress from '../../progress.svelte'
|
|
15
|
+
import { Section } from '../../section'
|
|
15
16
|
import { formatNumeric } from '../../../format'
|
|
16
17
|
import { useMeasureFps } from '../../../fps.svelte'
|
|
17
18
|
import { usePip } from '../../../pip/context.svelte'
|
|
19
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
18
20
|
|
|
19
21
|
import { getBlobForViamDepth, VIAM_DEPTH_MIME_TYPE } from './decode-viam-depth'
|
|
20
22
|
import { pickImageForSource } from './pick-image-for-source'
|
|
@@ -334,28 +336,27 @@
|
|
|
334
336
|
})
|
|
335
337
|
</script>
|
|
336
338
|
|
|
337
|
-
<!-- This breaks out of using the <Query> component
|
|
338
|
-
to merge live stream and TanStack query errors -->
|
|
339
|
-
{#if lastError}
|
|
340
|
-
<ContentRect
|
|
341
|
-
{contentRect}
|
|
342
|
-
cx="bg-medium/50 absolute flex h-64 w-80 max-w-full items-center justify-center"
|
|
343
|
-
>
|
|
344
|
-
<ErrorDisplay
|
|
345
|
-
class="pb-4"
|
|
346
|
-
{lastError}
|
|
347
|
-
/>
|
|
348
|
-
</ContentRect>
|
|
349
|
-
{:else if isLive ? isStreamLoading : isLoading}
|
|
350
|
-
<ContentRect
|
|
351
|
-
{contentRect}
|
|
352
|
-
cx="absolute h-64 w-80 max-w-full"
|
|
353
|
-
>
|
|
354
|
-
<Progress />
|
|
355
|
-
</ContentRect>
|
|
356
|
-
{/if}
|
|
357
|
-
|
|
358
339
|
<div class="relative">
|
|
340
|
+
<!-- This breaks out of using the Query component
|
|
341
|
+
to merge live stream and TanStack query errors -->
|
|
342
|
+
{#if lastError}
|
|
343
|
+
<ContentRect
|
|
344
|
+
{contentRect}
|
|
345
|
+
class="bg-medium/50 absolute top-0 left-0 flex h-64 w-80 max-w-full items-center justify-center"
|
|
346
|
+
>
|
|
347
|
+
<ErrorDisplay
|
|
348
|
+
class="pb-4"
|
|
349
|
+
{lastError}
|
|
350
|
+
/>
|
|
351
|
+
</ContentRect>
|
|
352
|
+
{:else if isLive ? isStreamLoading : isLoading}
|
|
353
|
+
<ContentRect
|
|
354
|
+
{contentRect}
|
|
355
|
+
class="absolute top-0 left-0 h-64 w-80 max-w-full"
|
|
356
|
+
>
|
|
357
|
+
<Progress />
|
|
358
|
+
</ContentRect>
|
|
359
|
+
{/if}
|
|
359
360
|
<div
|
|
360
361
|
class="absolute bottom-2 left-2 z-10 rounded-[3px] bg-black/30 px-1 py-0.5 text-right font-mono text-xs text-white"
|
|
361
362
|
>
|
|
@@ -398,14 +399,16 @@
|
|
|
398
399
|
{/if}
|
|
399
400
|
|
|
400
401
|
{#if showResolutionOptions && isLive}
|
|
401
|
-
<
|
|
402
|
-
|
|
403
|
-
api=
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
class="-m-4 mt-4"
|
|
402
|
+
<ApiSection
|
|
403
|
+
method="SetStreamOptions"
|
|
404
|
+
api={ResourceTriplets.Camera}
|
|
405
|
+
mutations={[resolutionMutation]}
|
|
406
|
+
class={['flex-row flex-wrap gap-2', '-m-4 mt-4']}
|
|
407
407
|
>
|
|
408
|
-
|
|
408
|
+
{#snippet subheading()}
|
|
409
|
+
<Section.Text>Change the resolution of the live stream video feed</Section.Text>
|
|
410
|
+
{/snippet}
|
|
411
|
+
<div class="flex grow flex-wrap justify-between gap-2">
|
|
409
412
|
<Label cx="max-w-[96px] gap-1 text-xs">
|
|
410
413
|
<span class="flex gap-1 whitespace-nowrap">
|
|
411
414
|
Resolution
|
|
@@ -447,5 +450,5 @@
|
|
|
447
450
|
</Button>
|
|
448
451
|
</div>
|
|
449
452
|
</div>
|
|
450
|
-
</
|
|
453
|
+
</ApiSection>
|
|
451
454
|
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from 'svelte'
|
|
3
|
+
|
|
4
|
+
import Subject from '../../custom-control.svelte'
|
|
5
|
+
|
|
6
|
+
const { ...props }: ComponentProps<typeof Subject> = $props()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<p data-testid="sibling">Beside the control</p>
|
|
10
|
+
<Subject {...props} />
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
|
|
4
|
+
import { useRobotClient } from '@viamrobotics/svelte-sdk'
|
|
5
|
+
|
|
6
|
+
import Progress from '../../progress.svelte'
|
|
7
|
+
|
|
8
|
+
import { createControlHost } from './create-control-host.svelte'
|
|
9
|
+
import { prepareArtifact } from './custom-control'
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
partID: string
|
|
13
|
+
resourceName: string
|
|
14
|
+
html: string
|
|
15
|
+
loading?: Snippet
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { partID, resourceName, html, loading }: Props = $props()
|
|
19
|
+
|
|
20
|
+
const robot = useRobotClient(() => partID)
|
|
21
|
+
const srcdoc = $derived(prepareArtifact(html))
|
|
22
|
+
|
|
23
|
+
let iframe = $state<HTMLIFrameElement | null>(null)
|
|
24
|
+
let height = $state<number>()
|
|
25
|
+
|
|
26
|
+
const controlHost = createControlHost({
|
|
27
|
+
getRobot: () => robot.current,
|
|
28
|
+
getIframe: () => iframe ?? undefined,
|
|
29
|
+
resourceName: () => resourceName,
|
|
30
|
+
onHeight: (px) => {
|
|
31
|
+
height = px
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
$effect(() => {
|
|
36
|
+
controlHost.start()
|
|
37
|
+
return controlHost.stop
|
|
38
|
+
})
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<div class="relative w-full">
|
|
42
|
+
<iframe
|
|
43
|
+
bind:this={iframe}
|
|
44
|
+
sandbox="allow-scripts"
|
|
45
|
+
title="Custom control for {resourceName}"
|
|
46
|
+
class="block h-40 max-h-[80vh] min-h-px w-full border-0"
|
|
47
|
+
style:height={height === undefined ? undefined : `${height}px`}
|
|
48
|
+
{srcdoc}
|
|
49
|
+
></iframe>
|
|
50
|
+
|
|
51
|
+
{#if height === undefined}
|
|
52
|
+
<div class="bg-extralight absolute inset-0">
|
|
53
|
+
{#if loading}
|
|
54
|
+
{@render loading()}
|
|
55
|
+
{:else}
|
|
56
|
+
<Progress />
|
|
57
|
+
{/if}
|
|
58
|
+
</div>
|
|
59
|
+
{/if}
|
|
60
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
partID: string;
|
|
4
|
+
resourceName: string;
|
|
5
|
+
html: string;
|
|
6
|
+
loading?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
declare const ControlFrame: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type ControlFrame = ReturnType<typeof ControlFrame>;
|
|
10
|
+
export default ControlFrame;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RobotClient } from '@viamrobotics/sdk';
|
|
2
|
+
interface Options {
|
|
3
|
+
getRobot: () => RobotClient | undefined;
|
|
4
|
+
getIframe: () => HTMLIFrameElement | undefined;
|
|
5
|
+
resourceName: () => string;
|
|
6
|
+
onHeight: (px: number) => void;
|
|
7
|
+
}
|
|
8
|
+
interface ControlHost {
|
|
9
|
+
/**
|
|
10
|
+
* Serves the iframe's guest from the robot once both exist, and does nothing until then.
|
|
11
|
+
*
|
|
12
|
+
* @throws If the iframe has no `contentWindow`.
|
|
13
|
+
*/
|
|
14
|
+
start: () => void;
|
|
15
|
+
/** Closes the host. Safe to call when none is running. */
|
|
16
|
+
stop: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const createControlHost: ({ getRobot, getIframe, resourceName, onHeight, }: Options) => ControlHost;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createHost } from '@viamrobotics/post-message-sdk/host';
|
|
2
|
+
export const createControlHost = ({ getRobot, getIframe, resourceName, onHeight, }) => {
|
|
3
|
+
let host;
|
|
4
|
+
const stop = () => {
|
|
5
|
+
host?.destroy();
|
|
6
|
+
host = undefined;
|
|
7
|
+
};
|
|
8
|
+
const start = () => {
|
|
9
|
+
stop();
|
|
10
|
+
const robot = getRobot();
|
|
11
|
+
const iframe = getIframe();
|
|
12
|
+
if (!robot || !iframe)
|
|
13
|
+
return;
|
|
14
|
+
host = createHost(robot, iframe, {
|
|
15
|
+
allow: ({ resource }) => resource === resourceName(),
|
|
16
|
+
onSize: (height) => {
|
|
17
|
+
// A non-finite value would reach the iframe's style as invalid CSS, which the browser
|
|
18
|
+
// drops, snapping the frame back to its class height. Bounds live in CSS on the frame.
|
|
19
|
+
if (!Number.isFinite(height))
|
|
20
|
+
return;
|
|
21
|
+
onHeight(height);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
return { start, stop };
|
|
26
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { JsonValue } from '@viamrobotics/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The `doCommand` that asks a resource for its custom control artifact.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated Transitional delivery path. A module declares its control per model in
|
|
6
|
+
* `meta.json` (`models[].custom_control`); serving the bytes over `doCommand` exists only until the
|
|
7
|
+
* machine or registry can serve the declared file. Do not build new integrations on it. Module
|
|
8
|
+
* authors keep their manifests and drop the handler when delivery moves.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CUSTOM_CONTROL_COMMAND = "get-custom-control";
|
|
11
|
+
export declare const CUSTOM_CONTROL_CSP: string;
|
|
12
|
+
export interface CustomControlArtifact {
|
|
13
|
+
html: string;
|
|
14
|
+
revision?: string;
|
|
15
|
+
/** The `custom_control` path the module declared for this model in its `meta.json`, when reported. */
|
|
16
|
+
path?: string;
|
|
17
|
+
}
|
|
18
|
+
interface DoCommandClient {
|
|
19
|
+
doCommand(command: Record<string, JsonValue>): Promise<JsonValue>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Asks a resource for its custom control artifact over `doCommand` and validates the reply.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Bound to the transitional `doCommand` delivery path ({@link CUSTOM_CONTROL_COMMAND}).
|
|
25
|
+
* The `CustomControlArtifact` it returns is the shape every delivery path will produce; the
|
|
26
|
+
* function is replaced when the machine or registry can serve the manifest-declared file.
|
|
27
|
+
*/
|
|
28
|
+
export declare const loadCustomControl: (client: DoCommandClient) => Promise<CustomControlArtifact>;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the artifact with the host's Content Security Policy injected as the first child of
|
|
31
|
+
* `<head>`, creating the head when the artifact has none, so the policy applies before any other
|
|
32
|
+
* element parses. An artifact whose head already opens with this exact meta is returned unchanged.
|
|
33
|
+
*/
|
|
34
|
+
export declare const prepareArtifact: (html: string) => string;
|
|
35
|
+
export {};
|