@viamrobotics/motion-tools 0.3.5 → 0.3.6

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.
@@ -153,7 +153,7 @@
153
153
  >
154
154
  {#if rootChildren.length === 0}
155
155
  <p class="text-subtle-2 px-2 py-4">No objects displayed</p>
156
- {:else}
156
+ {:else if rootChildren.length > 200}
157
157
  <VirtualList
158
158
  class="w-full"
159
159
  style="height:{Math.min(8, Math.max(rootChildren.length, 5)) * 32}px;"
@@ -163,6 +163,15 @@
163
163
  {@render treeNode({ node: item, indexPath: [Number(index)], api })}
164
164
  {/snippet}
165
165
  </VirtualList>
166
+ {:else}
167
+ <div
168
+ style="height:{Math.min(8, Math.max(rootChildren.length, 5)) * 32}px;"
169
+ class="overflow-auto"
170
+ >
171
+ {#each rootChildren as node, index (node.id)}
172
+ {@render treeNode({ node, indexPath: [Number(index)], api })}
173
+ {/each}
174
+ </div>
166
175
  {/if}
167
176
  </div>
168
177
  </div>
@@ -1 +0,0 @@
1
- export { provideConnectionConfigs, useConnectionConfigs, useActiveConnectionConfig, } from './useConnectionConfigs.svelte';
@@ -1 +1 @@
1
- export { provideConnectionConfigs, useConnectionConfigs, useActiveConnectionConfig, } from './useConnectionConfigs.svelte';
1
+ "use strict";
@@ -29,7 +29,7 @@ export const provideFrames = (partID) => {
29
29
  }
30
30
  for (const { frame } of query.current.data ?? []) {
31
31
  if (frame) {
32
- objects.push(new WorldObject(frame.referenceFrame, frame.poseInObserverFrame?.pose, frame.poseInObserverFrame?.referenceFrame, frame.physicalObject?.geometryType));
32
+ objects.push(new WorldObject(frame.referenceFrame ?? 'Unnamed frame', frame.poseInObserverFrame?.pose, frame.poseInObserverFrame?.referenceFrame, frame.physicalObject?.geometryType));
33
33
  }
34
34
  }
35
35
  return objects;
@@ -8,6 +8,7 @@ import { WorldObject } from '../WorldObject';
8
8
  import { usePersistentUUIDs } from './usePersistentUUIDs.svelte';
9
9
  import { useLogs } from './useLogs.svelte';
10
10
  const key = Symbol('geometries-context');
11
+ let index = 0;
11
12
  export const provideGeometries = (partID) => {
12
13
  const logs = useLogs();
13
14
  const refreshRates = useRefreshRates();
@@ -45,7 +46,7 @@ export const provideGeometries = (partID) => {
45
46
  if (!query.data)
46
47
  continue;
47
48
  for (const { center, label, geometryType } of query.data.geometries) {
48
- results.push(new WorldObject(label, center, query.data.name, geometryType));
49
+ results.push(new WorldObject(label ? label : `Unnamed geometry ${++index}`, center, query.data.name, geometryType));
49
50
  }
50
51
  }
51
52
  updateUUIDs(results);
@@ -1,13 +1,12 @@
1
1
  export const usePersistentUUIDs = () => {
2
2
  const uuids = new Map();
3
3
  const updateUUIDs = (objects) => {
4
- if (uuids.size === 0) {
5
- for (const object of objects) {
6
- uuids.set(object.name, object.uuid);
7
- }
8
- }
9
4
  for (const object of objects) {
10
- object.uuid = uuids.get(object.name) ?? object.uuid;
5
+ const ref = `${object.referenceFrame}-${object.name}`;
6
+ if (uuids.has(ref) === false) {
7
+ uuids.set(ref, object.uuid);
8
+ }
9
+ object.uuid = uuids.get(ref) ?? object.uuid;
11
10
  }
12
11
  };
13
12
  return { uuids, updateUUIDs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/motion-tools",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Motion visualization with Viam",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -20,20 +20,20 @@
20
20
  "@sveltejs/package": "^2.3.11",
21
21
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
22
22
  "@tailwindcss/forms": "^0.5.10",
23
- "@tailwindcss/vite": "^4.1.7",
24
- "@tanstack/svelte-query": "^5.77.2",
25
- "@tanstack/svelte-query-devtools": "^5.77.2",
23
+ "@tailwindcss/vite": "^4.1.8",
24
+ "@tanstack/svelte-query": "^5.79.0",
25
+ "@tanstack/svelte-query-devtools": "^5.79.0",
26
26
  "@testing-library/jest-dom": "^6.6.3",
27
27
  "@testing-library/svelte": "^5.2.8",
28
28
  "@threlte/core": "^8.0.4",
29
29
  "@threlte/extras": "^9.2.1",
30
30
  "@threlte/rapier": "^3.1.4",
31
31
  "@threlte/xr": "^1.0.5",
32
- "@types/bun": "^1.2.14",
32
+ "@types/bun": "^1.2.15",
33
33
  "@types/lodash-es": "^4.17.12",
34
34
  "@types/three": "^0.176.0",
35
- "@typescript-eslint/eslint-plugin": "^8.32.1",
36
- "@typescript-eslint/parser": "^8.32.1",
35
+ "@typescript-eslint/eslint-plugin": "^8.33.0",
36
+ "@typescript-eslint/parser": "^8.33.0",
37
37
  "@viamrobotics/prime-core": "^0.1.5",
38
38
  "@viamrobotics/sdk": "0.42.0",
39
39
  "@viamrobotics/svelte-sdk": "0.1.4",
@@ -55,15 +55,15 @@
55
55
  "prettier-plugin-tailwindcss": "^0.6.11",
56
56
  "publint": "^0.3.12",
57
57
  "runed": "^0.28.0",
58
- "svelte": "5.33.4",
58
+ "svelte": "5.33.8",
59
59
  "svelte-check": "^4.2.1",
60
60
  "svelte-virtuallists": "^1.4.2",
61
- "tailwindcss": "^4.1.7",
61
+ "tailwindcss": "^4.1.8",
62
62
  "three": "^0.176.0",
63
63
  "threlte-uikit": "^1.0.0",
64
64
  "tsx": "^4.19.4",
65
65
  "typescript": "^5.8.3",
66
- "typescript-eslint": "^8.32.1",
66
+ "typescript-eslint": "^8.33.0",
67
67
  "vite": "^6.3.5",
68
68
  "vite-plugin-mkcert": "^1.17.8",
69
69
  "vitest": "^3.1.4"
@@ -1,20 +0,0 @@
1
- interface ConnectionConfig {
2
- host: string;
3
- partId: string;
4
- apiKeyId: string;
5
- apiKeyValue: string;
6
- signalingAddress: string;
7
- }
8
- interface Context {
9
- current: ConnectionConfig[];
10
- add: () => void;
11
- remove: (index: number) => void;
12
- isEnvConfig: (config: ConnectionConfig) => boolean;
13
- }
14
- export declare const provideConnectionConfigs: () => void;
15
- export declare const useConnectionConfigs: () => Context;
16
- export declare const useActiveConnectionConfig: () => {
17
- readonly current: ConnectionConfig | undefined;
18
- set(index: number | undefined): void;
19
- };
20
- export {};
@@ -1,59 +0,0 @@
1
- import { get, set } from 'idb-keyval';
2
- import { PersistedState } from 'runed';
3
- import { getContext, setContext } from 'svelte';
4
- import { envConfigs } from '../../routes/lib/configs';
5
- import { isEqual } from 'lodash-es';
6
- const key = Symbol('connection-config-context');
7
- const activeConfig = new PersistedState('active-connection-config', 0);
8
- export const provideConnectionConfigs = () => {
9
- let connectionConfigs = $state([]);
10
- get('connection-configs').then((response) => {
11
- if (Array.isArray(response)) {
12
- connectionConfigs = response;
13
- }
14
- });
15
- $effect(() => {
16
- set('connection-configs', $state.snapshot(connectionConfigs));
17
- });
18
- const merged = $derived([...envConfigs, ...connectionConfigs]);
19
- const add = () => {
20
- connectionConfigs.push({
21
- host: '',
22
- partId: '',
23
- apiKeyId: '',
24
- apiKeyValue: '',
25
- signalingAddress: '',
26
- });
27
- };
28
- const remove = (index) => {
29
- connectionConfigs.splice(index - envConfigs.length, 1);
30
- };
31
- const isEnvConfig = (config) => {
32
- return envConfigs.some((value) => isEqual(config, value));
33
- };
34
- setContext(key, {
35
- get current() {
36
- return merged;
37
- },
38
- add,
39
- remove,
40
- isEnvConfig,
41
- });
42
- };
43
- export const useConnectionConfigs = () => {
44
- return getContext(key);
45
- };
46
- export const useActiveConnectionConfig = () => {
47
- const connectionConfigs = useConnectionConfigs();
48
- return {
49
- get current() {
50
- if (activeConfig.current === -1) {
51
- return undefined;
52
- }
53
- return connectionConfigs.current.at(activeConfig.current);
54
- },
55
- set(index) {
56
- activeConfig.current = index ?? -1;
57
- },
58
- };
59
- };