@viamrobotics/motion-tools 0.3.2 → 0.3.4

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.
@@ -22,6 +22,8 @@
22
22
  createPartIDContext(() => partID)
23
23
 
24
24
  const enableXR = new PersistedState('enable-xr', false)
25
+
26
+ let root: HTMLElement
25
27
  </script>
26
28
 
27
29
  <svelte:window
@@ -34,7 +36,7 @@
34
36
 
35
37
  <div
36
38
  class="relative h-full w-full"
37
- id="motion-tools-root"
39
+ bind:this={root}
38
40
  >
39
41
  <Canvas renderMode="always">
40
42
  <World>
@@ -48,12 +50,12 @@
48
50
  {/if}
49
51
  </Scene>
50
52
 
51
- <DomPortal>
53
+ <DomPortal element={root}>
52
54
  <Details />
53
55
  </DomPortal>
54
56
 
55
57
  {#if !focus}
56
- <DomPortal>
58
+ <DomPortal element={root}>
57
59
  <TreeContainer />
58
60
  </DomPortal>
59
61
  {/if}
@@ -2,16 +2,17 @@
2
2
  import type { Snippet } from 'svelte'
3
3
 
4
4
  interface Props {
5
- selector?: string
5
+ element?: HTMLElement
6
6
  children: Snippet
7
7
  }
8
8
 
9
- let { children, selector = 'body' }: Props = $props()
9
+ let { children, element }: Props = $props()
10
10
 
11
11
  let div: HTMLDivElement
12
12
 
13
13
  $effect(() => {
14
- document.querySelector(selector)?.append(div)
14
+ const parent = element ?? document.body
15
+ parent.append(div)
15
16
  return () => {
16
17
  // eslint-disable-next-line svelte/no-dom-manipulating
17
18
  div.remove()
@@ -1,6 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  interface Props {
3
- selector?: string;
3
+ element?: HTMLElement;
4
4
  children: Snippet;
5
5
  }
6
6
  declare const DomPortal: import("svelte").Component<Props, {}, "">;
@@ -7,7 +7,7 @@
7
7
  </script>
8
8
 
9
9
  <Drawer name="Logs">
10
- <div class="flex h-[250px] w-[240px] flex-col gap-2 overflow-auto p-3">
10
+ <div class="flex h-64 w-60 flex-col gap-2 overflow-auto p-3">
11
11
  {#each truncated as log (log.uuid)}
12
12
  <div>
13
13
  <div class="flex flex-wrap items-center gap-1.5">
@@ -149,7 +149,7 @@
149
149
 
150
150
  <div
151
151
  {...api.getTreeProps()}
152
- class="w-[240px]"
152
+ class="w-60"
153
153
  >
154
154
  {#if rootChildren.length === 0}
155
155
  <p class="text-subtle-2 px-2 py-4">No objects displayed</p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viamrobotics/motion-tools",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Motion visualization with Viam",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",