@viamrobotics/test-widgets 0.3.1 → 0.4.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/client-map.d.ts +1 -1
- package/dist/client-map.js +1 -1
- package/dist/components/refetch-interval-store.svelte.d.ts +1 -1
- package/dist/components/widgets/do-command/do-command.svelte +2 -1
- package/dist/components/widgets/gripper/gripper.svelte +5 -0
- package/dist/components/widgets/gripper/is-holding-something.svelte +57 -0
- package/dist/components/widgets/gripper/is-holding-something.svelte.d.ts +7 -0
- package/dist/get-resource-api.d.ts +2 -0
- package/dist/get-resource-api.js +1 -0
- package/dist/get-resource-key.d.ts +2 -0
- package/dist/get-resource-key.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/resource.d.ts +0 -2
- package/dist/resource.js +1 -2
- package/package.json +6 -4
package/dist/client-map.d.ts
CHANGED
|
@@ -30,5 +30,5 @@ export declare const clientMap: {
|
|
|
30
30
|
readonly 'rdk:service:world_state_store': typeof WorldStateStoreClient;
|
|
31
31
|
readonly 'rdk:service:video': typeof VideoClient;
|
|
32
32
|
};
|
|
33
|
-
export declare const clientForResource: (resource: ResourceName) => typeof ArmClient | typeof
|
|
33
|
+
export declare const clientForResource: (resource: ResourceName) => typeof ArmClient | typeof AudioInClient | typeof AudioOutClient | typeof BaseClient | typeof BoardClient | typeof ButtonClient | typeof CameraClient | typeof EncoderClient | typeof GantryClient | typeof GenericComponentClient | typeof GripperClient | typeof InputControllerClient | typeof MotorClient | typeof MovementSensorClient | typeof PoseTrackerClient | typeof PowerSensorClient | typeof SensorClient | typeof ServoClient | typeof SwitchClient | typeof DataManagerClient | typeof DiscoveryClient | typeof GenericServiceClient | typeof MLModelClient | typeof MotionClient | typeof NavigationClient | typeof SlamClient | typeof VisionClient | typeof WorldStateStoreClient | typeof VideoClient | undefined;
|
|
34
34
|
export declare const supportsDoCommand: (resource: ResourceName) => boolean;
|
package/dist/client-map.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArmClient, AudioInClient, AudioOutClient, BaseClient, BoardClient, ButtonClient, CameraClient, DataManagerClient, DiscoveryClient, EncoderClient, GantryClient, GenericComponentClient, GenericServiceClient, GripperClient, InputControllerClient, MLModelClient, MotionClient, MotorClient, MovementSensorClient, NavigationClient, PoseTrackerClient, PowerSensorClient, SensorClient, ServoClient, SlamClient, SwitchClient, VideoClient, VisionClient, WorldStateStoreClient, } from '@viamrobotics/sdk';
|
|
2
|
-
import { getResourceAPI } from "./resource.js";
|
|
2
|
+
import { getResourceAPI } from "./get-resource-api.js";
|
|
3
3
|
export const clientMap = {
|
|
4
4
|
'rdk:component:arm': ArmClient,
|
|
5
5
|
'rdk:component:audio_in': AudioInClient,
|
|
@@ -14,5 +14,5 @@ export declare const RefetchIntervals: {
|
|
|
14
14
|
};
|
|
15
15
|
export type RefetchRate = ValueOf<typeof RefetchRates>;
|
|
16
16
|
export type RefetchInterval = ValueOf<typeof RefetchIntervals>;
|
|
17
|
-
export declare const RefetchRateToInterval: ["Live" | "Refresh every second" | "Refresh every 5 seconds" | "Manual refresh", false | 33.3333 |
|
|
17
|
+
export declare const RefetchRateToInterval: ["Live" | "Refresh every second" | "Refresh every 5 seconds" | "Manual refresh", false | 1000 | 33.3333 | 5000][];
|
|
18
18
|
export declare const createRefetchIntervalStore: (partID: () => string, resourceName: () => string, scope: string, defaultInterval?: RefetchInterval) => PersistedState<RefetchInterval>;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
import { PersistedState } from 'runed'
|
|
7
7
|
|
|
8
8
|
import { supportsDoCommand } from '../../../client-map'
|
|
9
|
-
import { getResourceAPI
|
|
9
|
+
import { getResourceAPI } from '../../../get-resource-api'
|
|
10
|
+
import { getResourceKey } from '../../../get-resource-key'
|
|
10
11
|
|
|
11
12
|
import ErrorDisplay from '../../error.svelte'
|
|
12
13
|
import { createDoCommandClient } from './create-do-command-client.svelte'
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import StopButton from '../../stop-button.svelte'
|
|
9
9
|
|
|
10
10
|
import Grab from './grab.svelte'
|
|
11
|
+
import IsHoldingSomething from './is-holding-something.svelte'
|
|
11
12
|
import Open from './open.svelte'
|
|
12
13
|
|
|
13
14
|
interface Props {
|
|
@@ -63,6 +64,10 @@
|
|
|
63
64
|
{partID}
|
|
64
65
|
{resourceName}
|
|
65
66
|
/>
|
|
67
|
+
<IsHoldingSomething
|
|
68
|
+
{partID}
|
|
69
|
+
{resourceName}
|
|
70
|
+
/>
|
|
66
71
|
</div>
|
|
67
72
|
</div>
|
|
68
73
|
{/snippet}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Pill } from '@viamrobotics/prime-core'
|
|
3
|
+
import { GripperClient } from '@viamrobotics/sdk'
|
|
4
|
+
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
5
|
+
|
|
6
|
+
import ApiSection from '../../api-section.svelte'
|
|
7
|
+
import Query from '../../query.svelte'
|
|
8
|
+
import StatusPill from '../../status-pill.svelte'
|
|
9
|
+
|
|
10
|
+
import ClosedGripperSvg from './closed-gripper-svg.svelte'
|
|
11
|
+
import OpenGripperSvg from './open-gripper-svg.svelte'
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
partID: string
|
|
15
|
+
resourceName: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { partID, resourceName }: Props = $props()
|
|
19
|
+
|
|
20
|
+
const client = createResourceClient(
|
|
21
|
+
GripperClient,
|
|
22
|
+
() => partID,
|
|
23
|
+
() => resourceName
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
const query = createResourceQuery(client, 'isHoldingSomething', {
|
|
27
|
+
refetchInterval: 500,
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<ApiSection
|
|
32
|
+
title="IsHoldingSomething"
|
|
33
|
+
bottomText="Updates automatically"
|
|
34
|
+
class="grow"
|
|
35
|
+
>
|
|
36
|
+
<Query
|
|
37
|
+
{query}
|
|
38
|
+
contentCx="h-5"
|
|
39
|
+
>
|
|
40
|
+
<div class="flex items-center gap-2">
|
|
41
|
+
{#if query.data !== undefined}
|
|
42
|
+
{#if query.data}
|
|
43
|
+
<ClosedGripperSvg />
|
|
44
|
+
{:else}
|
|
45
|
+
<OpenGripperSvg />
|
|
46
|
+
{/if}
|
|
47
|
+
<StatusPill
|
|
48
|
+
isActive={query.data}
|
|
49
|
+
activeText="Holding"
|
|
50
|
+
inactiveText="Empty"
|
|
51
|
+
/>
|
|
52
|
+
{:else}
|
|
53
|
+
<Pill value="Loading" />
|
|
54
|
+
{/if}
|
|
55
|
+
</div>
|
|
56
|
+
</Query>
|
|
57
|
+
</ApiSection>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const getResourceAPI = ({ namespace, type, subtype }) => `${namespace}:${type}:${subtype}`;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createAddImageToDatasetContext, type ImageData, useAddImageToDataset, } from './add-image-to-dataset';
|
|
2
2
|
export { clientForResource } from './client-map';
|
|
3
3
|
export * from './components';
|
|
4
|
+
export { getResourceAPI } from './get-resource-api';
|
|
4
5
|
export { providePip, usePip } from './pip/context.svelte';
|
|
5
|
-
export {
|
|
6
|
+
export { hasWidget, showResourceWidget, widgetForResource } from './resource';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createAddImageToDatasetContext, useAddImageToDataset, } from './add-image-to-dataset';
|
|
2
2
|
export { clientForResource } from './client-map';
|
|
3
3
|
export * from './components';
|
|
4
|
+
export { getResourceAPI } from './get-resource-api';
|
|
4
5
|
export { providePip, usePip } from './pip/context.svelte';
|
|
5
|
-
export {
|
|
6
|
+
export { hasWidget, showResourceWidget, widgetForResource } from './resource';
|
package/dist/resource.d.ts
CHANGED
|
@@ -16,8 +16,6 @@ export declare const ResourceStatusText: {
|
|
|
16
16
|
1: string;
|
|
17
17
|
4: string;
|
|
18
18
|
};
|
|
19
|
-
export declare const getResourceAPI: ({ namespace, type, subtype }: ResourceName) => string;
|
|
20
|
-
export declare const getResourceKey: (name: ResourceName) => string;
|
|
21
19
|
export declare const sortResourceNames: (names: ResourceName[]) => ResourceName[];
|
|
22
20
|
export declare const hasWidget: (resource: ResourceName) => boolean;
|
|
23
21
|
export declare const widgetForResource: (resource: ResourceName) => Component<ResourceWidget> | undefined;
|
package/dist/resource.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { robotApi } from '@viamrobotics/sdk';
|
|
2
2
|
import { clientMap } from "./client-map.js";
|
|
3
3
|
import { ArmWidget, AudioInputWidget, AudioOutputWidget, BaseWidget, BoardWidget, ButtonWidget, CameraWidget, DiscoveryWidget, EncoderWidget, GantryWidget, GripperWidget, InputControllerWidget, MLModelServiceWidget, MotorWidget, MovementSensorWidget, NavigationServiceWidget, PowerSensorWidget, SensorWidget, ServoWidget, SlamWidget, SwitchWidget, VisionServiceWidget, } from './components';
|
|
4
|
+
import { getResourceAPI } from "./get-resource-api.js";
|
|
4
5
|
export const ResourceStatusText = {
|
|
5
6
|
[robotApi.ResourceStatus_State.UNSPECIFIED]: 'unspecified',
|
|
6
7
|
[robotApi.ResourceStatus_State.READY]: 'ready',
|
|
@@ -63,8 +64,6 @@ const resourceMap =
|
|
|
63
64
|
'rdk:service:world_state_store': [clientMap['rdk:service:world_state_store'], undefined, true],
|
|
64
65
|
'rdk:service:video': [clientMap['rdk:service:video'], undefined, true],
|
|
65
66
|
};
|
|
66
|
-
export const getResourceAPI = ({ namespace, type, subtype }) => `${namespace}:${type}:${subtype}`;
|
|
67
|
-
export const getResourceKey = (name) => `${getResourceAPI(name)}/${name.name}`;
|
|
68
67
|
// sorts resource names by local/remote -> type -> name (alphabetical) to produce a list like
|
|
69
68
|
// component a
|
|
70
69
|
// component z
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viamrobotics/test-widgets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"prettier-plugin-tailwindcss": "^0.7.4",
|
|
91
91
|
"publint": "^0.3.18",
|
|
92
92
|
"runed": "^0.37.1",
|
|
93
|
-
"svelte": "^5.55.
|
|
93
|
+
"svelte": "^5.55.7",
|
|
94
94
|
"svelte-check": "^4.4.6",
|
|
95
95
|
"svelte-splitpanes": "^8.0.12",
|
|
96
96
|
"tailwind-merge": "^3.5.0",
|
|
@@ -115,8 +115,10 @@
|
|
|
115
115
|
"preview": "vite preview",
|
|
116
116
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --fail-on-warnings",
|
|
117
117
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
118
|
-
"lint": "
|
|
119
|
-
"
|
|
118
|
+
"lint": "eslint .",
|
|
119
|
+
"lint:fix": "eslint . --fix",
|
|
120
|
+
"format": "prettier --check .",
|
|
121
|
+
"format:fix": "prettier --write .",
|
|
120
122
|
"test:unit": "vitest",
|
|
121
123
|
"test": "pnpm test:unit -- --run",
|
|
122
124
|
"test:e2e": "playwright test",
|