@viamrobotics/test-widgets 0.16.0 → 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/dist/components/api-section.svelte +58 -50
- package/dist/components/api-section.svelte.d.ts +24 -11
- package/dist/components/content-rect.svelte +6 -0
- package/dist/components/content-rect.svelte.d.ts +1 -0
- package/dist/components/error.svelte +9 -0
- package/dist/components/error.svelte.d.ts +6 -0
- package/dist/components/index.d.ts +4 -2
- package/dist/components/index.js +4 -2
- package/dist/components/is-moving.svelte +26 -34
- package/dist/components/is-moving.svelte.d.ts +4 -5
- package/dist/components/progress.svelte +1 -0
- package/dist/components/queries.svelte +7 -0
- package/dist/components/queries.svelte.d.ts +4 -0
- package/dist/components/query.svelte +7 -0
- package/dist/components/query.svelte.d.ts +4 -0
- package/dist/components/section/index.d.ts +2 -0
- package/dist/components/section/index.js +2 -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 +132 -5
- package/dist/components/section/section.svelte +7 -1
- package/dist/components/section/section.svelte.d.ts +3 -0
- package/dist/components/section/use-section-errors.svelte.d.ts +1 -0
- package/dist/components/section/use-section-errors.svelte.js +11 -1
- package/dist/components/stop-button.svelte +1 -5
- package/dist/components/stop-button.svelte.d.ts +0 -1
- package/dist/components/stop.svelte +2 -2
- package/dist/components/widgets/arm/arm.svelte +24 -32
- package/dist/components/widgets/arm/get-joint-positions-widget.svelte +9 -8
- package/dist/components/widgets/arm/manual-mode-widget.svelte +13 -4
- 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 +10 -4
- package/dist/components/widgets/arm/move-to-joint-positions.svelte +1 -11
- package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/move-to-position-control.svelte +22 -18
- package/dist/components/widgets/arm/move-to-position.svelte +0 -4
- package/dist/components/widgets/arm/move-to-position.svelte.d.ts +0 -1
- 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/audio-input/audio-input.svelte +76 -74
- package/dist/components/widgets/audio-input/get-properties-widget.svelte +15 -15
- package/dist/components/widgets/audio-output/audio-output.svelte +83 -81
- package/dist/components/widgets/audio-output/get-properties-widget.svelte +15 -15
- package/dist/components/widgets/base/base.svelte +70 -37
- 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/set-power-widget.svelte +20 -8
- package/dist/components/widgets/base/set-velocity-widget.svelte +20 -8
- package/dist/components/widgets/base/spin-widget.svelte +20 -8
- 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 +15 -23
- package/dist/components/widgets/camera/live-or-polling-video.svelte +12 -9
- 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 +10 -15
- package/dist/components/widgets/encoder/encoder.svelte +20 -18
- package/dist/components/widgets/encoder/get-position-widget.svelte +18 -15
- package/dist/components/widgets/gantry/gantry.svelte +50 -74
- package/dist/components/widgets/gantry/get-position-widget.svelte +14 -13
- 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 +2 -1
- 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 +7 -5
- 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 +10 -12
- package/dist/components/widgets/gripper/is-holding-something.svelte +18 -19
- 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 +7 -14
- package/dist/components/widgets/input-controller/webgamepad.svelte +2 -2
- package/dist/components/widgets/motion/motion.svelte +27 -35
- 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 +1 -13
- 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 +88 -54
- 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 +7 -10
- package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/get-position-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/movement-sensor.svelte +55 -56
- package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +2 -1
- package/dist/components/widgets/power-sensor/get-current-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/get-power-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/power-sensor.svelte +26 -38
- package/dist/components/widgets/sensor/sensor.svelte +5 -10
- 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 +44 -33
- package/dist/components/widgets/slam/get-position-widget.svelte +7 -10
- package/dist/components/widgets/slam/move-on-map.svelte +6 -5
- package/dist/components/widgets/slam/move-on-map.svelte.d.ts +2 -1
- package/dist/components/widgets/slam/slam.svelte +64 -79
- package/dist/components/widgets/switch/position.svelte +2 -2
- package/package.json +3 -2
- package/dist/components/mutation-section.svelte +0 -75
- package/dist/components/mutation-section.svelte.d.ts +0 -18
- package/dist/components/mutation-view.svelte +0 -29
- package/dist/components/mutation-view.svelte.d.ts +0 -10
- package/dist/components/section-title.svelte +0 -65
- package/dist/components/section-title.svelte.d.ts +0 -15
|
@@ -1,68 +1,76 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte'
|
|
3
|
-
import type {
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
4
|
|
|
5
5
|
import type { ResourceTriplet } from '../resource-triplet'
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import { Section } from './section'
|
|
8
|
+
import {
|
|
9
|
+
type SectionMutation,
|
|
10
|
+
type SectionQuery,
|
|
11
|
+
useSectionErrors,
|
|
12
|
+
} from './section/use-section-errors.svelte'
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
}
|
|
20
34
|
|
|
21
35
|
const {
|
|
22
|
-
|
|
23
|
-
tooltip,
|
|
24
|
-
description,
|
|
25
|
-
bottomText,
|
|
36
|
+
method,
|
|
26
37
|
api,
|
|
27
|
-
|
|
38
|
+
queries = [],
|
|
39
|
+
mutations = [],
|
|
40
|
+
subheading,
|
|
41
|
+
tooltip,
|
|
42
|
+
skeleton = false,
|
|
28
43
|
children,
|
|
29
44
|
...rest
|
|
30
45
|
}: Props = $props()
|
|
31
46
|
|
|
32
|
-
const
|
|
47
|
+
const sectionErrors = useSectionErrors(() => ({ queries, mutations }))
|
|
33
48
|
</script>
|
|
34
49
|
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
aria-labelledby={title ? headingID : undefined}
|
|
50
|
+
<Section
|
|
51
|
+
errorReporter={sectionErrors}
|
|
38
52
|
{...rest}
|
|
39
53
|
>
|
|
40
|
-
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
</h3>
|
|
56
|
-
{/if}
|
|
57
|
-
{#if description}
|
|
58
|
-
<p class="text-subtle-2 text-xs">{description}</p>
|
|
59
|
-
{/if}
|
|
60
|
-
</div>
|
|
61
|
-
{/if}
|
|
62
|
-
|
|
63
|
-
<Boundary {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>
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
<Section.Body
|
|
71
|
+
isLoading={sectionErrors.isLoading}
|
|
72
|
+
{skeleton}
|
|
73
|
+
>
|
|
74
|
+
{@render children?.()}
|
|
75
|
+
</Section.Body>
|
|
76
|
+
</Section>
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
import type {
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { ResourceTriplet } from '../resource-triplet';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
};
|
|
14
27
|
declare const ApiSection: import("svelte").Component<Props, {}, "">;
|
|
15
28
|
type ApiSection = ReturnType<typeof ApiSection>;
|
|
16
29
|
export default ApiSection;
|
|
@@ -1,3 +1,9 @@
|
|
|
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
9
|
import type { ClassValue } from 'svelte/elements'
|
|
@@ -5,6 +5,7 @@ interface Props {
|
|
|
5
5
|
class?: ClassValue;
|
|
6
6
|
children?: Snippet;
|
|
7
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. */
|
|
8
9
|
declare const ContentRect: import("svelte").Component<Props, {}, "">;
|
|
9
10
|
type ContentRect = ReturnType<typeof ContentRect>;
|
|
10
11
|
export default ContentRect;
|
|
@@ -1,3 +1,12 @@
|
|
|
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">
|
|
2
11
|
import type { ClassValue } from 'svelte/elements'
|
|
3
12
|
|
|
@@ -4,6 +4,12 @@ interface Props {
|
|
|
4
4
|
id?: string;
|
|
5
5
|
class?: ClassValue;
|
|
6
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
|
+
*/
|
|
7
13
|
declare const Error: import("svelte").Component<Props, {}, "">;
|
|
8
14
|
type Error = ReturnType<typeof Error>;
|
|
9
15
|
export default Error;
|
|
@@ -36,11 +36,11 @@ export { default as GantryHomeWidget } from './widgets/gantry/home.svelte';
|
|
|
36
36
|
export { default as GantryMoveToPositionWidget } from './widgets/gantry/move-to-position-widget.svelte';
|
|
37
37
|
export { default as GantryQuickMoveWidget } from './widgets/gantry/quick-move-widget.svelte';
|
|
38
38
|
export { default as GenericWidget } from './widgets/generic/generic.svelte';
|
|
39
|
-
export { default as GripperGrabWidget } from './widgets/gripper/grab.svelte';
|
|
39
|
+
export { default as GripperGrabWidget } from './widgets/gripper/grab-widget.svelte';
|
|
40
40
|
export { default as GripperWidget } from './widgets/gripper/gripper.svelte';
|
|
41
41
|
export { default as GripperIsHoldingSomethingWidget } from './widgets/gripper/is-holding-something.svelte';
|
|
42
42
|
export { default as GripperIsMovingWidget } from './widgets/gripper/is-moving-widget.svelte';
|
|
43
|
-
export { default as GripperOpenWidget } from './widgets/gripper/open.svelte';
|
|
43
|
+
export { default as GripperOpenWidget } from './widgets/gripper/open-widget.svelte';
|
|
44
44
|
export { default as InputControllerWidget } from './widgets/input-controller/input-controller.svelte';
|
|
45
45
|
export { default as MLModelServiceWidget } from './widgets/ml-model-service/ml-model-service.svelte';
|
|
46
46
|
export { default as MotionServiceWidget } from './widgets/motion/motion.svelte';
|
|
@@ -79,3 +79,5 @@ export { default as VisionServiceWidget } from './widgets/vision-service/vision-
|
|
|
79
79
|
export { default as RefetchController } from './refetch-controller.svelte';
|
|
80
80
|
export { NavigationMap, NavigationTab, type NavigationTabType, type Shapes, type CapsuleGeometry, type SphereGeometry, type BoxGeometry, type Geometry, type Obstacle, type Path, } from './navigation-map';
|
|
81
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
|
@@ -35,11 +35,11 @@ export { default as GantryHomeWidget } from './widgets/gantry/home.svelte';
|
|
|
35
35
|
export { default as GantryMoveToPositionWidget } from './widgets/gantry/move-to-position-widget.svelte';
|
|
36
36
|
export { default as GantryQuickMoveWidget } from './widgets/gantry/quick-move-widget.svelte';
|
|
37
37
|
export { default as GenericWidget } from './widgets/generic/generic.svelte';
|
|
38
|
-
export { default as GripperGrabWidget } from './widgets/gripper/grab.svelte';
|
|
38
|
+
export { default as GripperGrabWidget } from './widgets/gripper/grab-widget.svelte';
|
|
39
39
|
export { default as GripperWidget } from './widgets/gripper/gripper.svelte';
|
|
40
40
|
export { default as GripperIsHoldingSomethingWidget } from './widgets/gripper/is-holding-something.svelte';
|
|
41
41
|
export { default as GripperIsMovingWidget } from './widgets/gripper/is-moving-widget.svelte';
|
|
42
|
-
export { default as GripperOpenWidget } from './widgets/gripper/open.svelte';
|
|
42
|
+
export { default as GripperOpenWidget } from './widgets/gripper/open-widget.svelte';
|
|
43
43
|
export { default as InputControllerWidget } from './widgets/input-controller/input-controller.svelte';
|
|
44
44
|
export { default as MLModelServiceWidget } from './widgets/ml-model-service/ml-model-service.svelte';
|
|
45
45
|
export { default as MotionServiceWidget } from './widgets/motion/motion.svelte';
|
|
@@ -78,3 +78,5 @@ export { default as VisionServiceWidget } from './widgets/vision-service/vision-
|
|
|
78
78
|
export { default as RefetchController } from './refetch-controller.svelte';
|
|
79
79
|
export { NavigationMap, NavigationTab, } from './navigation-map';
|
|
80
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";
|
|
@@ -1,48 +1,43 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
|
|
4
|
-
ArmClient,
|
|
5
|
-
Base,
|
|
6
|
-
BaseClient,
|
|
7
|
-
Gantry,
|
|
8
|
-
GantryClient,
|
|
9
|
-
Gripper,
|
|
10
|
-
GripperClient,
|
|
11
|
-
Motor,
|
|
12
|
-
MotorClient,
|
|
13
|
-
Servo,
|
|
14
|
-
ServoClient,
|
|
15
|
-
} from '@viamrobotics/sdk'
|
|
16
|
-
import type { Snippet } from 'svelte'
|
|
2
|
+
import type * as SDK from '@viamrobotics/sdk'
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
17
4
|
|
|
18
5
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
19
6
|
|
|
20
7
|
import type { ResourceTriplet } from '../resource-triplet'
|
|
21
8
|
|
|
22
9
|
import ApiSection from './api-section.svelte'
|
|
23
|
-
import
|
|
10
|
+
import { Section } from './section'
|
|
24
11
|
import StatusPill from './status-pill.svelte'
|
|
25
12
|
|
|
26
13
|
type Client =
|
|
27
|
-
| typeof ArmClient
|
|
28
|
-
| typeof BaseClient
|
|
29
|
-
| typeof GantryClient
|
|
30
|
-
| typeof GripperClient
|
|
31
|
-
| typeof MotorClient
|
|
32
|
-
| typeof ServoClient
|
|
14
|
+
| typeof SDK.ArmClient
|
|
15
|
+
| typeof SDK.BaseClient
|
|
16
|
+
| typeof SDK.GantryClient
|
|
17
|
+
| typeof SDK.GripperClient
|
|
18
|
+
| typeof SDK.MotorClient
|
|
19
|
+
| typeof SDK.ServoClient
|
|
33
20
|
|
|
34
|
-
|
|
21
|
+
type Resource = SDK.Arm | SDK.Base | SDK.Gantry | SDK.Gripper | SDK.Motor | SDK.Servo
|
|
22
|
+
|
|
23
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
35
24
|
client: Client
|
|
36
25
|
partID: string
|
|
37
26
|
resourceName: string
|
|
38
27
|
api: ResourceTriplet
|
|
39
|
-
children?: Snippet
|
|
40
28
|
}
|
|
41
29
|
|
|
42
|
-
const {
|
|
30
|
+
const {
|
|
31
|
+
client: clientClass,
|
|
32
|
+
partID,
|
|
33
|
+
resourceName,
|
|
34
|
+
api,
|
|
35
|
+
children,
|
|
36
|
+
class: className,
|
|
37
|
+
}: Props = $props()
|
|
43
38
|
|
|
44
39
|
const client = $derived(
|
|
45
|
-
createResourceClient<
|
|
40
|
+
createResourceClient<Resource>(
|
|
46
41
|
clientClass,
|
|
47
42
|
() => partID,
|
|
48
43
|
() => resourceName
|
|
@@ -53,15 +48,12 @@
|
|
|
53
48
|
</script>
|
|
54
49
|
|
|
55
50
|
<ApiSection
|
|
56
|
-
|
|
51
|
+
class={['grow flex-col gap-4', className]}
|
|
52
|
+
method="IsMoving"
|
|
53
|
+
queries={[query]}
|
|
57
54
|
{api}
|
|
58
|
-
bottomText="Updates automatically"
|
|
59
|
-
class="grow flex-col gap-4"
|
|
60
55
|
>
|
|
61
|
-
<
|
|
62
|
-
<StatusPill isActive={query.data ?? false} />
|
|
63
|
-
</Query>
|
|
64
|
-
|
|
65
|
-
<!-- slot for additional actuation info Ex: Motor's IsPowered & GetPosition -->
|
|
56
|
+
<StatusPill isActive={query.data ?? false} />
|
|
66
57
|
{@render children?.()}
|
|
58
|
+
<Section.Text class="mt-auto">Updates automatically</Section.Text>
|
|
67
59
|
</ApiSection>
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
1
|
+
import type * as SDK from '@viamrobotics/sdk';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { ResourceTriplet } from '../resource-triplet';
|
|
4
|
-
type Client = typeof ArmClient | typeof BaseClient | typeof GantryClient | typeof GripperClient | typeof MotorClient | typeof ServoClient;
|
|
5
|
-
interface Props {
|
|
4
|
+
type Client = typeof SDK.ArmClient | typeof SDK.BaseClient | typeof SDK.GantryClient | typeof SDK.GripperClient | typeof SDK.MotorClient | typeof SDK.ServoClient;
|
|
5
|
+
interface Props extends HTMLAttributes<HTMLElement> {
|
|
6
6
|
client: Client;
|
|
7
7
|
partID: string;
|
|
8
8
|
resourceName: string;
|
|
9
9
|
api: ResourceTriplet;
|
|
10
|
-
children?: Snippet;
|
|
11
10
|
}
|
|
12
11
|
declare const IsMoving: import("svelte").Component<Props, {}, "">;
|
|
13
12
|
type IsMoving = ReturnType<typeof IsMoving>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
|
|
4
|
+
@deprecated A section owns its async state now. Pass the queries to `ApiSection` as `queries`, or to a
|
|
5
|
+
`Section` control's `useSectionErrors` call, and guard `query.data` in the children. Kept for the sectionless files until their resource PRs.
|
|
6
|
+
-->
|
|
7
|
+
|
|
1
8
|
<script lang="ts">
|
|
2
9
|
import type { QueryObserverResult } from '@tanstack/svelte-query'
|
|
3
10
|
import type { Snippet } from 'svelte'
|
|
@@ -8,6 +8,10 @@ interface Props {
|
|
|
8
8
|
data: unknown[];
|
|
9
9
|
}]>;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated A section owns its async state now. Pass the queries to `ApiSection` as `queries`, or to a
|
|
13
|
+
* `Section` control's `useSectionErrors` call, and guard `query.data` in the children. Kept for the sectionless files until their resource PRs.
|
|
14
|
+
*/
|
|
11
15
|
declare const Queries: import("svelte").Component<Props, {}, "">;
|
|
12
16
|
type Queries = ReturnType<typeof Queries>;
|
|
13
17
|
export default Queries;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
|
|
4
|
+
@deprecated A section owns its async state now. Pass the query to `ApiSection` as `queries`, or to a
|
|
5
|
+
`Section` control's `useSectionErrors` call, and guard `query.data` in the children. Kept for the sectionless files until their resource PRs.
|
|
6
|
+
-->
|
|
7
|
+
|
|
1
8
|
<script lang="ts">
|
|
2
9
|
import type { QueryObserverResult } from '@tanstack/svelte-query'
|
|
3
10
|
import type { Snippet } from 'svelte'
|
|
@@ -6,6 +6,10 @@ interface Props {
|
|
|
6
6
|
class?: ClassValue;
|
|
7
7
|
children?: Snippet;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated A section owns its async state now. Pass the query to `ApiSection` as `queries`, or to a
|
|
11
|
+
* `Section` control's `useSectionErrors` call, and guard `query.data` in the children. Kept for the sectionless files until their resource PRs.
|
|
12
|
+
*/
|
|
9
13
|
declare const Query: import("svelte").Component<Props, {}, "">;
|
|
10
14
|
type Query = ReturnType<typeof Query>;
|
|
11
15
|
export default Query;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import SectionBody from './section-body.svelte';
|
|
2
|
+
import SectionError from './section-error.svelte';
|
|
2
3
|
import SectionErrors from './section-errors.svelte';
|
|
3
4
|
import SectionHeading from './section-heading.svelte';
|
|
4
5
|
import SectionMethod from './section-method.svelte';
|
|
@@ -10,6 +11,7 @@ export { useSectionLoading } from './section-loading';
|
|
|
10
11
|
export { dedupeErrors, useSectionErrors, type SectionMutation, type SectionQuery, type SectionSources, } from './use-section-errors.svelte';
|
|
11
12
|
export declare const Section: typeof Root & {
|
|
12
13
|
Body: typeof SectionBody;
|
|
14
|
+
Error: typeof SectionError;
|
|
13
15
|
Errors: typeof SectionErrors;
|
|
14
16
|
Heading: typeof SectionHeading;
|
|
15
17
|
Method: typeof SectionMethod;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import SectionBody from './section-body.svelte';
|
|
2
|
+
import SectionError from './section-error.svelte';
|
|
2
3
|
import SectionErrors from './section-errors.svelte';
|
|
3
4
|
import SectionHeading from './section-heading.svelte';
|
|
4
5
|
import SectionMethod from './section-method.svelte';
|
|
@@ -10,6 +11,7 @@ export { useSectionLoading } from './section-loading';
|
|
|
10
11
|
export { dedupeErrors, useSectionErrors, } from './use-section-errors.svelte';
|
|
11
12
|
export const Section = Object.assign(Root, {
|
|
12
13
|
Body: SectionBody,
|
|
14
|
+
Error: SectionError,
|
|
13
15
|
Errors: SectionErrors,
|
|
14
16
|
Heading: SectionHeading,
|
|
15
17
|
Method: SectionMethod,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Lets a part inside a section add an error to the section's indicator. */
|
|
2
|
+
export interface SectionErrorReporter {
|
|
3
|
+
/** Adds the error `getError` returns to the section's errors. Returns a function that removes it. */
|
|
4
|
+
report: (getError: () => Error | null) => () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const provideSectionErrorReporter: (getReporter: () => SectionErrorReporter | undefined) => void;
|
|
7
|
+
/** The enclosing section's reporter, or undefined outside a section that shows errors. */
|
|
8
|
+
export declare const useSectionErrorReporter: () => (() => SectionErrorReporter | undefined) | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
const SECTION_ERROR_REPORTER_KEY = Symbol('section-error-reporter');
|
|
3
|
+
export const provideSectionErrorReporter = (getReporter) => {
|
|
4
|
+
setContext(SECTION_ERROR_REPORTER_KEY, getReporter);
|
|
5
|
+
};
|
|
6
|
+
/** The enclosing section's reporter, or undefined outside a section that shows errors. */
|
|
7
|
+
export const useSectionErrorReporter = () => getContext(SECTION_ERROR_REPORTER_KEY);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ClassValue } from 'svelte/elements'
|
|
3
|
+
|
|
4
|
+
import { untrack } from 'svelte'
|
|
5
|
+
|
|
6
|
+
import ErrorDisplay from '../error.svelte'
|
|
7
|
+
import { useSectionErrorReporter } from './section-error-reporter'
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
error: Error | null | undefined
|
|
11
|
+
/** Classes for the inline line rendered outside a section. */
|
|
12
|
+
class?: ClassValue
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { error, class: className }: Props = $props()
|
|
16
|
+
|
|
17
|
+
const getReporter = useSectionErrorReporter()
|
|
18
|
+
const reporter = $derived(getReporter?.())
|
|
19
|
+
|
|
20
|
+
$effect(() => {
|
|
21
|
+
const current = reporter
|
|
22
|
+
// Registering writes the section's error set, so it must not subscribe this effect to it.
|
|
23
|
+
return untrack(() => current?.report(() => error ?? null))
|
|
24
|
+
})
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<!--
|
|
28
|
+
Adds `error` to the enclosing section's indicator. Outside a section that shows errors, such as
|
|
29
|
+
a form rendered on its own, it falls back to an inline error line.
|
|
30
|
+
-->
|
|
31
|
+
{#if !reporter}
|
|
32
|
+
<ErrorDisplay
|
|
33
|
+
lastError={error}
|
|
34
|
+
class={className}
|
|
35
|
+
/>
|
|
36
|
+
{/if}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClassValue } from 'svelte/elements';
|
|
2
|
+
interface Props {
|
|
3
|
+
error: Error | null | undefined;
|
|
4
|
+
/** Classes for the inline line rendered outside a section. */
|
|
5
|
+
class?: ClassValue;
|
|
6
|
+
}
|
|
7
|
+
declare const SectionError: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type SectionError = ReturnType<typeof SectionError>;
|
|
9
|
+
export default SectionError;
|