@viamrobotics/motion-tools 1.9.0 → 1.10.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/HoverUpdater.svelte.d.ts +19 -0
- package/dist/HoverUpdater.svelte.js +120 -0
- package/dist/components/App.svelte +34 -35
- package/dist/components/CameraControls.svelte +1 -1
- package/dist/components/Focus.svelte +1 -1
- package/dist/components/Frame.svelte +1 -1
- package/dist/components/Geometry2.svelte +8 -5
- package/dist/components/Label.svelte +1 -1
- package/dist/components/MeasureTool/MeasurePoint.svelte +5 -3
- package/dist/components/MeasureTool/MeasureTool.svelte +11 -11
- package/dist/components/SceneProviders.svelte +2 -0
- package/dist/components/hover/HoveredEntities.svelte +23 -0
- package/dist/components/hover/HoveredEntity.svelte +15 -0
- package/dist/components/hover/HoveredEntity.svelte.d.ts +3 -0
- package/dist/components/hover/HoveredEntityTooltip.svelte +70 -0
- package/dist/components/{HoveredEntityTooltip.svelte.d.ts → hover/HoveredEntityTooltip.svelte.d.ts} +2 -2
- package/dist/components/hover/LinkedHoveredEntity.svelte +55 -0
- package/dist/components/hover/LinkedHoveredEntity.svelte.d.ts +9 -0
- package/dist/components/overlay/AddRelationship.svelte +131 -0
- package/dist/components/overlay/AddRelationship.svelte.d.ts +7 -0
- package/dist/components/{Details.svelte → overlay/Details.svelte} +44 -11
- package/dist/components/overlay/FloatingPanel.svelte +78 -0
- package/dist/components/overlay/FloatingPanel.svelte.d.ts +13 -0
- package/dist/components/{LiveUpdatesBanner.svelte → overlay/LiveUpdatesBanner.svelte} +2 -2
- package/dist/components/{RefreshRate.svelte → overlay/RefreshRate.svelte} +1 -1
- package/dist/components/overlay/ToggleGroup.svelte +56 -0
- package/dist/components/{Overlay → overlay}/ToggleGroup.svelte.d.ts +6 -7
- package/dist/components/{__tests__ → overlay/__tests__}/__fixtures__/entity.js +1 -1
- package/dist/components/{dashboard → overlay/dashboard}/Button.svelte +1 -1
- package/dist/components/{dashboard → overlay/dashboard}/Dashboard.svelte +2 -2
- package/dist/components/{Tree → overlay/left-pane}/AddFrames.svelte +2 -2
- package/dist/components/{Tree → overlay/left-pane}/Logs.svelte +1 -1
- package/dist/components/{Tree → overlay/left-pane}/Tree.svelte +3 -3
- package/dist/components/{Tree → overlay/left-pane}/TreeContainer.svelte +8 -10
- package/dist/components/{Tree → overlay/left-pane}/Widgets.svelte +3 -3
- package/dist/components/{Tree → overlay/left-pane}/buildTree.js +1 -1
- package/dist/components/overlay/settings/Settings.svelte +279 -0
- package/dist/components/overlay/settings/Tabs.svelte +54 -0
- package/dist/components/overlay/settings/Tabs.svelte.d.ts +12 -0
- package/dist/components/{widgets → overlay/widgets}/ArmPositions.svelte +4 -4
- package/dist/components/{widgets → overlay/widgets}/Camera.svelte +5 -5
- package/dist/ecs/index.d.ts +1 -0
- package/dist/ecs/index.js +1 -0
- package/dist/ecs/relations.d.ts +7 -0
- package/dist/ecs/relations.js +7 -0
- package/dist/ecs/traits.d.ts +8 -2
- package/dist/ecs/traits.js +11 -5
- package/dist/hooks/useDrawAPI.svelte.js +1 -1
- package/dist/hooks/useFrames.svelte.js +1 -0
- package/dist/hooks/useGeometries.svelte.js +1 -1
- package/dist/hooks/useLinked.svelte.d.ts +7 -0
- package/dist/hooks/useLinked.svelte.js +35 -0
- package/dist/hooks/useObjectEvents.svelte.js +35 -16
- package/dist/hooks/usePointcloudObjects.svelte.js +1 -1
- package/dist/hooks/usePointclouds.svelte.js +30 -43
- package/dist/hooks/usePose.svelte.js +1 -1
- package/dist/hooks/useWorldState.svelte.js +1 -1
- package/package.json +4 -1
- package/dist/components/DotSprite.svelte +0 -59
- package/dist/components/DotSprite.svelte.d.ts +0 -10
- package/dist/components/HoveredEntities.svelte +0 -19
- package/dist/components/HoveredEntityTooltip.svelte +0 -241
- package/dist/components/MeasureTool.svelte +0 -123
- package/dist/components/MeasureTool.svelte.d.ts +0 -3
- package/dist/components/Overlay/ToggleGroup.svelte +0 -60
- package/dist/components/Tree/Settings.svelte +0 -221
- package/dist/components/null-states/Connection.svelte +0 -0
- package/dist/components/null-states/Connection.svelte.d.ts +0 -26
- /package/dist/components/{HoveredEntities.svelte.d.ts → hover/HoveredEntities.svelte.d.ts} +0 -0
- /package/dist/components/{Details.svelte.d.ts → overlay/Details.svelte.d.ts} +0 -0
- /package/dist/components/{LiveUpdatesBanner.svelte.d.ts → overlay/LiveUpdatesBanner.svelte.d.ts} +0 -0
- /package/dist/components/{Overlay → overlay}/Popover.svelte +0 -0
- /package/dist/components/{Overlay → overlay}/Popover.svelte.d.ts +0 -0
- /package/dist/components/{RefreshRate.svelte.d.ts → overlay/RefreshRate.svelte.d.ts} +0 -0
- /package/dist/components/{shared → overlay}/Table.svelte +0 -0
- /package/dist/components/{shared → overlay}/Table.svelte.d.ts +0 -0
- /package/dist/components/{__tests__ → overlay/__tests__}/__fixtures__/entity.d.ts +0 -0
- /package/dist/components/{__tests__ → overlay/__tests__}/__fixtures__/resource.d.ts +0 -0
- /package/dist/components/{__tests__ → overlay/__tests__}/__fixtures__/resource.js +0 -0
- /package/dist/components/{dashboard → overlay/dashboard}/Button.svelte.d.ts +0 -0
- /package/dist/components/{dashboard → overlay/dashboard}/Dashboard.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/AddFrames.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Drawer.svelte +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Drawer.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Logs.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Tree.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/TreeContainer.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/Widgets.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/buildTree.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/useExpanded.svelte.d.ts +0 -0
- /package/dist/components/{Tree → overlay/left-pane}/useExpanded.svelte.js +0 -0
- /package/dist/components/{Tree → overlay/settings}/Settings.svelte.d.ts +0 -0
- /package/dist/components/{widgets → overlay/widgets}/ArmPositions.svelte.d.ts +0 -0
- /package/dist/components/{widgets → overlay/widgets}/Camera.svelte.d.ts +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Entity } from 'koota'
|
|
3
|
+
import { Button, Select, Input } from '@viamrobotics/prime-core'
|
|
4
|
+
import { traits, useQuery, relations, useTrait } from '../../ecs'
|
|
5
|
+
import { SubEntityLinkType } from '../../ecs/relations'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
entity: Entity | undefined
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { entity }: Props = $props()
|
|
12
|
+
|
|
13
|
+
const allEntities = useQuery(traits.Name)
|
|
14
|
+
const name = useTrait(() => entity, traits.Name)
|
|
15
|
+
const entityNames = $derived.by(() => {
|
|
16
|
+
const currentEntityName = name.current
|
|
17
|
+
return allEntities.current
|
|
18
|
+
.map((e: Entity) => e.get(traits.Name))
|
|
19
|
+
.filter((n: string | undefined): n is string => n !== undefined && n !== currentEntityName)
|
|
20
|
+
.sort()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
let showRelationshipOptions = $state(false)
|
|
24
|
+
let selectedRelationshipType = $state<string>('')
|
|
25
|
+
let selectedRelationshipEntity = $state<string>('')
|
|
26
|
+
let relationshipFormula = $state('index')
|
|
27
|
+
|
|
28
|
+
const linkType = $derived.by(() => {
|
|
29
|
+
return selectedRelationshipType === SubEntityLinkType.HoverLink
|
|
30
|
+
? SubEntityLinkType.HoverLink
|
|
31
|
+
: null
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
function resetForm() {
|
|
35
|
+
selectedRelationshipType = ''
|
|
36
|
+
selectedRelationshipEntity = ''
|
|
37
|
+
relationshipFormula = 'index'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function handleAdd() {
|
|
41
|
+
if (!entity || !relationshipFormula.includes('index')) return
|
|
42
|
+
const selectedEntity = allEntities.current.find(
|
|
43
|
+
(e: Entity) => e.get(traits.Name) === selectedRelationshipEntity
|
|
44
|
+
)
|
|
45
|
+
if (selectedEntity) {
|
|
46
|
+
entity.add(
|
|
47
|
+
relations.SubEntityLink(selectedEntity, {
|
|
48
|
+
indexMapping: relationshipFormula,
|
|
49
|
+
type: linkType,
|
|
50
|
+
})
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
showRelationshipOptions = false
|
|
54
|
+
resetForm()
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<Button
|
|
59
|
+
class="mt-2 w-full"
|
|
60
|
+
icon={showRelationshipOptions ? undefined : 'plus'}
|
|
61
|
+
variant={showRelationshipOptions ? 'dark' : 'primary'}
|
|
62
|
+
onclick={() => {
|
|
63
|
+
if (showRelationshipOptions) {
|
|
64
|
+
resetForm()
|
|
65
|
+
}
|
|
66
|
+
showRelationshipOptions = !showRelationshipOptions
|
|
67
|
+
}}>{showRelationshipOptions ? 'Cancel' : 'Add Relationship'}</Button
|
|
68
|
+
>
|
|
69
|
+
|
|
70
|
+
{#if showRelationshipOptions}
|
|
71
|
+
<div class="mt-2 flex flex-col gap-2">
|
|
72
|
+
<div>
|
|
73
|
+
<label
|
|
74
|
+
for="relationship-type-select"
|
|
75
|
+
class="text-subtle-2 mb-1 block text-xs">Relationship type</label
|
|
76
|
+
>
|
|
77
|
+
<Select
|
|
78
|
+
id="relationship-type-select"
|
|
79
|
+
aria-label="Select relationship type"
|
|
80
|
+
value={selectedRelationshipType}
|
|
81
|
+
onchange={(event: InputEvent) => {
|
|
82
|
+
selectedRelationshipType = (event.target as HTMLSelectElement).value as 'HoverLink'
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<option value="">Select a relationship type...</option>
|
|
86
|
+
<option value="HoverLink">HoverLink</option>
|
|
87
|
+
</Select>
|
|
88
|
+
</div>
|
|
89
|
+
<div>
|
|
90
|
+
<label
|
|
91
|
+
for="relationship-entity-select"
|
|
92
|
+
class="text-subtle-2 mb-1 block text-xs">Entity</label
|
|
93
|
+
>
|
|
94
|
+
<Select
|
|
95
|
+
id="relationship-entity-select"
|
|
96
|
+
aria-label="Select entity for relationship"
|
|
97
|
+
value={selectedRelationshipEntity}
|
|
98
|
+
onchange={(event: InputEvent) => {
|
|
99
|
+
selectedRelationshipEntity = (event.target as HTMLSelectElement).value
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
<option value="">Select an entity...</option>
|
|
103
|
+
{#each entityNames as entityName (entityName)}
|
|
104
|
+
<option value={entityName}>{entityName}</option>
|
|
105
|
+
{/each}
|
|
106
|
+
</Select>
|
|
107
|
+
</div>
|
|
108
|
+
<div>
|
|
109
|
+
<label
|
|
110
|
+
for="relationship-formula-input"
|
|
111
|
+
class="text-subtle-2 mb-1 block text-xs">Index mapping</label
|
|
112
|
+
>
|
|
113
|
+
<Input
|
|
114
|
+
on:keydown={(e) => e.stopPropagation()}
|
|
115
|
+
id="relationship-formula-input"
|
|
116
|
+
aria-label="Math formula for index mapping"
|
|
117
|
+
bind:value={relationshipFormula}
|
|
118
|
+
placeholder="index"
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
<div>
|
|
122
|
+
<Button
|
|
123
|
+
class="w-full"
|
|
124
|
+
variant="primary"
|
|
125
|
+
onclick={handleAdd}
|
|
126
|
+
>
|
|
127
|
+
Add
|
|
128
|
+
</Button>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
{/if}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
module
|
|
3
3
|
lang="ts"
|
|
4
4
|
>
|
|
5
|
-
import { OrientationVector } from '
|
|
5
|
+
import { OrientationVector } from '../../three/OrientationVector'
|
|
6
6
|
import { Quaternion, Vector3, MathUtils, BufferAttribute } from 'three'
|
|
7
7
|
|
|
8
8
|
const vec3 = new Vector3()
|
|
@@ -20,14 +20,16 @@
|
|
|
20
20
|
useFocusedEntity,
|
|
21
21
|
useFocusedObject3d,
|
|
22
22
|
useSelectedObject3d,
|
|
23
|
-
} from '
|
|
24
|
-
import { useFrames } from '
|
|
25
|
-
import { usePartConfig } from '
|
|
26
|
-
import { FrameConfigUpdater } from '
|
|
27
|
-
import { useEnvironment } from '
|
|
28
|
-
import { traits, useTrait, useWorld } from '
|
|
29
|
-
import { useResourceByName } from '
|
|
30
|
-
import { useCameraControls } from '
|
|
23
|
+
} from '../../hooks/useSelection.svelte'
|
|
24
|
+
import { useFrames } from '../../hooks/useFrames.svelte'
|
|
25
|
+
import { usePartConfig } from '../../hooks/usePartConfig.svelte'
|
|
26
|
+
import { FrameConfigUpdater } from '../../FrameConfigUpdater.svelte'
|
|
27
|
+
import { useEnvironment } from '../../hooks/useEnvironment.svelte'
|
|
28
|
+
import { traits, useTrait, useWorld, relations } from '../../ecs'
|
|
29
|
+
import { useResourceByName } from '../../hooks/useResourceByName.svelte'
|
|
30
|
+
import { useCameraControls } from '../../hooks/useControls.svelte'
|
|
31
|
+
import { useLinkedEntities } from '../../hooks/useLinked.svelte'
|
|
32
|
+
import AddRelationship from './AddRelationship.svelte'
|
|
31
33
|
|
|
32
34
|
const { ...rest } = $props()
|
|
33
35
|
|
|
@@ -45,7 +47,7 @@
|
|
|
45
47
|
const object3d = $derived(focusedObject3d.current ?? selectedObject3d.current)
|
|
46
48
|
const worldPosition = $state({ x: 0, y: 0, z: 0 })
|
|
47
49
|
const worldOrientation = $state({ x: 0, y: 0, z: 1, th: 0 })
|
|
48
|
-
|
|
50
|
+
const linkedEntities = useLinkedEntities()
|
|
49
51
|
const name = useTrait(() => entity, traits.Name)
|
|
50
52
|
const parent = useTrait(() => entity, traits.Parent)
|
|
51
53
|
const localPose = useTrait(() => entity, traits.EditedPose)
|
|
@@ -53,11 +55,14 @@
|
|
|
53
55
|
const sphere = useTrait(() => entity, traits.Sphere)
|
|
54
56
|
const capsule = useTrait(() => entity, traits.Capsule)
|
|
55
57
|
const removable = useTrait(() => entity, traits.Removable)
|
|
58
|
+
const points = useTrait(() => entity, traits.Points)
|
|
59
|
+
const arrows = useTrait(() => entity, traits.Arrows)
|
|
56
60
|
|
|
57
61
|
const framesAPI = useTrait(() => entity, traits.FramesAPI)
|
|
58
62
|
const isFrameNode = $derived(!!framesAPI.current)
|
|
59
63
|
|
|
60
64
|
const showEditFrameOptions = $derived(isFrameNode && partConfig.hasEditPermissions)
|
|
65
|
+
const showRelationshipOptions = $derived(points.current || arrows.current)
|
|
61
66
|
|
|
62
67
|
const resourceName = $derived(name.current ? resourceByName.current[name.current] : undefined)
|
|
63
68
|
|
|
@@ -232,7 +237,7 @@
|
|
|
232
237
|
|
|
233
238
|
<div
|
|
234
239
|
id="details-panel"
|
|
235
|
-
class="border-medium bg-extralight absolute top-0 right-0 z-
|
|
240
|
+
class="border-medium bg-extralight absolute top-0 right-0 z-4 m-2 {showEditFrameOptions
|
|
236
241
|
? 'w-80'
|
|
237
242
|
: 'w-60'} border p-2 text-xs"
|
|
238
243
|
use:draggable={{
|
|
@@ -611,6 +616,30 @@
|
|
|
611
616
|
{/if}
|
|
612
617
|
</div>
|
|
613
618
|
|
|
619
|
+
<h3 class="text-subtle-2 pt-3 pb-2">Relationships</h3>
|
|
620
|
+
|
|
621
|
+
{#if linkedEntities.current.length > 0}
|
|
622
|
+
<div>
|
|
623
|
+
<div class="mt-0.5 flex flex-col gap-1">
|
|
624
|
+
<strong class="font-semibold">Linked entities</strong>
|
|
625
|
+
{#each linkedEntities.current as linkedEntity (linkedEntity)}
|
|
626
|
+
{@const linkedEntityName = linkedEntity.get(traits.Name)}
|
|
627
|
+
{@const linkType = entity.get(relations.SubEntityLink(linkedEntity))?.type}
|
|
628
|
+
<div class="flex items-center gap-1">
|
|
629
|
+
<span class="text-primary">{linkedEntityName} ({linkType})</span>
|
|
630
|
+
<Icon
|
|
631
|
+
name="trash-can-outline"
|
|
632
|
+
class="h-6 cursor-pointer px-2 py-1 text-xs text-red-500"
|
|
633
|
+
onclick={() => {
|
|
634
|
+
entity.remove(relations.SubEntityLink(linkedEntity))
|
|
635
|
+
}}
|
|
636
|
+
/>
|
|
637
|
+
</div>
|
|
638
|
+
{/each}
|
|
639
|
+
</div>
|
|
640
|
+
</div>
|
|
641
|
+
{/if}
|
|
642
|
+
|
|
614
643
|
<h3 class="text-subtle-2 pt-3 pb-2">Actions</h3>
|
|
615
644
|
|
|
616
645
|
{#if focusedEntity.current}
|
|
@@ -632,6 +661,10 @@
|
|
|
632
661
|
</Button>
|
|
633
662
|
{/if}
|
|
634
663
|
|
|
664
|
+
{#if showRelationshipOptions}
|
|
665
|
+
<AddRelationship {entity} />
|
|
666
|
+
{/if}
|
|
667
|
+
|
|
635
668
|
{#if showEditFrameOptions && environment.current.isStandalone}
|
|
636
669
|
<Button
|
|
637
670
|
variant="danger"
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import { Icon } from '@viamrobotics/prime-core'
|
|
4
|
+
|
|
5
|
+
import * as floatingPanel from '@zag-js/floating-panel'
|
|
6
|
+
import { normalizeProps, useMachine } from '@zag-js/svelte'
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
title?: string
|
|
10
|
+
defaultSize?: { width: number; height: number }
|
|
11
|
+
isOpen?: boolean
|
|
12
|
+
children: Snippet
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
title = '',
|
|
17
|
+
defaultSize = { width: 700, height: 500 },
|
|
18
|
+
isOpen = $bindable(false),
|
|
19
|
+
children,
|
|
20
|
+
}: Props = $props()
|
|
21
|
+
|
|
22
|
+
const id = $props.id()
|
|
23
|
+
const floatingPanelService = useMachine(floatingPanel.machine, () => ({
|
|
24
|
+
id,
|
|
25
|
+
defaultSize,
|
|
26
|
+
resizable: false,
|
|
27
|
+
allowOverflow: false,
|
|
28
|
+
open: isOpen,
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
const api = $derived(floatingPanel.connect(floatingPanelService, normalizeProps))
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<div
|
|
35
|
+
{...api.getPositionerProps()}
|
|
36
|
+
class="z-5"
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
{...api.getContentProps()}
|
|
40
|
+
class="border-medium border-1 bg-white"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
{...api.getDragTriggerProps()}
|
|
44
|
+
class="sticky"
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
{...api.getHeaderProps()}
|
|
48
|
+
class="border-medium flex justify-between border-b p-2"
|
|
49
|
+
>
|
|
50
|
+
<p
|
|
51
|
+
{...api.getTitleProps()}
|
|
52
|
+
class="text-gray-7 text-xs"
|
|
53
|
+
>
|
|
54
|
+
{title}
|
|
55
|
+
</p>
|
|
56
|
+
|
|
57
|
+
<div
|
|
58
|
+
{...api.getControlProps()}
|
|
59
|
+
class="flex gap-3"
|
|
60
|
+
>
|
|
61
|
+
<button
|
|
62
|
+
aria-label="Close connection configs panel"
|
|
63
|
+
onclick={() => (isOpen = false)}
|
|
64
|
+
>
|
|
65
|
+
<Icon name="close" />
|
|
66
|
+
</button>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div
|
|
72
|
+
{...api.getBodyProps()}
|
|
73
|
+
class="relative h-[calc(100%-33px)]"
|
|
74
|
+
>
|
|
75
|
+
{@render children()}
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: string;
|
|
4
|
+
defaultSize?: {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
children: Snippet;
|
|
10
|
+
}
|
|
11
|
+
declare const FloatingPanel: import("svelte").Component<Props, {}, "isOpen">;
|
|
12
|
+
type FloatingPanel = ReturnType<typeof FloatingPanel>;
|
|
13
|
+
export default FloatingPanel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Button, Icon } from '@viamrobotics/prime-core'
|
|
3
|
-
import { usePartConfig } from '
|
|
3
|
+
import { usePartConfig } from '../../hooks/usePartConfig.svelte'
|
|
4
4
|
|
|
5
5
|
const partConfig = usePartConfig()
|
|
6
6
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
{#if partConfig.isDirty}
|
|
27
27
|
<div
|
|
28
|
-
class="absolute bottom-8 z-
|
|
28
|
+
class="absolute bottom-8 z-4 flex w-full justify-center gap-2"
|
|
29
29
|
{...rest}
|
|
30
30
|
>
|
|
31
31
|
<div
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<script lang="ts">
|
|
19
19
|
import { Select, IconButton } from '@viamrobotics/prime-core'
|
|
20
|
-
import { useMachineSettings } from '
|
|
20
|
+
import { useMachineSettings } from '../../hooks/useMachineSettings.svelte'
|
|
21
21
|
import type { Snippet } from 'svelte'
|
|
22
22
|
|
|
23
23
|
interface Props {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { normalizeProps, useMachine } from '@zag-js/svelte'
|
|
3
|
+
import * as toggle from '@zag-js/toggle-group'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
multiple?: boolean
|
|
7
|
+
options: {
|
|
8
|
+
selected?: boolean
|
|
9
|
+
label: string
|
|
10
|
+
value?: string
|
|
11
|
+
}[]
|
|
12
|
+
onSelect: (details: string[]) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { multiple = false, options, onSelect }: Props = $props()
|
|
16
|
+
|
|
17
|
+
const id = $props.id()
|
|
18
|
+
const service = useMachine(toggle.machine, () => ({
|
|
19
|
+
id,
|
|
20
|
+
value: options
|
|
21
|
+
.filter((option) => option.selected)
|
|
22
|
+
.map((button) => button.value ?? button.label),
|
|
23
|
+
multiple,
|
|
24
|
+
onValueChange(details) {
|
|
25
|
+
onSelect(details.value)
|
|
26
|
+
},
|
|
27
|
+
}))
|
|
28
|
+
const api = $derived(toggle.connect(service, normalizeProps))
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<div
|
|
32
|
+
class="flex items-center"
|
|
33
|
+
{...api.getRootProps()}
|
|
34
|
+
>
|
|
35
|
+
{#each options as option (option.label)}
|
|
36
|
+
{@const value = option.value ?? option.label}
|
|
37
|
+
|
|
38
|
+
<button
|
|
39
|
+
class={[
|
|
40
|
+
'border-gray-8 -ml-px flex items-center justify-center border px-2 py-0.5 text-xs',
|
|
41
|
+
{
|
|
42
|
+
'bg-green-700 text-white': api.value.includes(value),
|
|
43
|
+
},
|
|
44
|
+
]}
|
|
45
|
+
{...api.getItemProps({ value })}
|
|
46
|
+
>
|
|
47
|
+
{value}
|
|
48
|
+
</button>
|
|
49
|
+
{/each}
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
button[data-focus] {
|
|
54
|
+
outline: none;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
-
multiple
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
value: string;
|
|
2
|
+
multiple?: boolean;
|
|
3
|
+
options: {
|
|
4
|
+
selected?: boolean;
|
|
5
|
+
label: string;
|
|
6
|
+
value?: string;
|
|
8
7
|
}[];
|
|
9
|
-
|
|
8
|
+
onSelect: (details: string[]) => void;
|
|
10
9
|
}
|
|
11
10
|
declare const ToggleGroup: import("svelte").Component<Props, {}, "">;
|
|
12
11
|
type ToggleGroup = ReturnType<typeof ToggleGroup>;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
class={[
|
|
34
34
|
className,
|
|
35
35
|
'relative block border',
|
|
36
|
-
active ? 'border-gray-5 text-gray-8 z-
|
|
36
|
+
active ? 'border-gray-5 text-gray-8 z-4 bg-white' : 'bg-light border-medium text-disabled',
|
|
37
37
|
]}
|
|
38
38
|
aria-describedby={tooltipID}
|
|
39
39
|
>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import { useSettings } from '
|
|
2
|
+
import { useSettings } from '../../../hooks/useSettings.svelte'
|
|
3
3
|
import { PortalTarget } from '@threlte/extras'
|
|
4
4
|
import Button from './Button.svelte'
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<div
|
|
12
|
-
class="absolute top-2 z-
|
|
12
|
+
class="absolute top-2 z-4 flex w-full justify-center gap-2"
|
|
13
13
|
{...rest}
|
|
14
14
|
>
|
|
15
15
|
<!-- camera view -->
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { IconButton } from '@viamrobotics/prime-core'
|
|
3
3
|
import Drawer from './Drawer.svelte'
|
|
4
|
-
import { usePartConfig } from '
|
|
5
|
-
import { useFramelessComponents } from '
|
|
4
|
+
import { usePartConfig } from '../../../hooks/usePartConfig.svelte'
|
|
5
|
+
import { useFramelessComponents } from '../../../hooks/useFramelessComponents.svelte'
|
|
6
6
|
|
|
7
7
|
const framelessComponents = useFramelessComponents()
|
|
8
8
|
const partConfig = usePartConfig()
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import * as tree from '@zag-js/tree-view'
|
|
3
3
|
import { useMachine, normalizeProps } from '@zag-js/svelte'
|
|
4
4
|
import { ChevronRight, Eye, EyeOff } from 'lucide-svelte'
|
|
5
|
-
import { useVisibility } from '
|
|
5
|
+
import { useVisibility } from '../../../hooks/useVisibility.svelte'
|
|
6
6
|
import type { TreeNode } from './buildTree'
|
|
7
7
|
import { VirtualList } from 'svelte-virtuallists'
|
|
8
8
|
import { Icon } from '@viamrobotics/prime-core'
|
|
9
|
-
import { traits } from '
|
|
10
|
-
import { useSelectedEntity } from '
|
|
9
|
+
import { traits } from '../../../ecs'
|
|
10
|
+
import { useSelectedEntity } from '../../../hooks/useSelection.svelte'
|
|
11
11
|
import { SvelteSet } from 'svelte/reactivity'
|
|
12
12
|
|
|
13
13
|
const selected = useSelectedEntity()
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { draggable } from '@neodrag/svelte'
|
|
3
3
|
import Tree from './Tree.svelte'
|
|
4
|
-
import { useSelectedEntity } from '
|
|
4
|
+
import { useSelectedEntity } from '../../../hooks/useSelection.svelte'
|
|
5
5
|
import { provideTreeExpandedContext } from './useExpanded.svelte'
|
|
6
|
-
import Settings from './Settings.svelte'
|
|
7
6
|
import Logs from './Logs.svelte'
|
|
8
7
|
import Widgets from './Widgets.svelte'
|
|
9
8
|
import AddFrames from './AddFrames.svelte'
|
|
10
|
-
import { useEnvironment } from '
|
|
11
|
-
import { usePartID } from '
|
|
12
|
-
import { usePartConfig } from '
|
|
13
|
-
import { useFrames } from '
|
|
14
|
-
import { traits, useQuery, useWorld } from '
|
|
9
|
+
import { useEnvironment } from '../../../hooks/useEnvironment.svelte'
|
|
10
|
+
import { usePartID } from '../../../hooks/usePartID.svelte'
|
|
11
|
+
import { usePartConfig } from '../../../hooks/usePartConfig.svelte'
|
|
12
|
+
import { useFrames } from '../../../hooks/useFrames.svelte'
|
|
13
|
+
import { traits, useQuery, useWorld } from '../../../ecs'
|
|
15
14
|
import { IsExcluded, type Entity } from 'koota'
|
|
16
15
|
import { buildTreeNodes, type TreeNode } from './buildTree'
|
|
17
|
-
import { MIN_DIMENSIONS, useResizable } from '
|
|
16
|
+
import { MIN_DIMENSIONS, useResizable } from '../../../hooks/useResizable.svelte'
|
|
18
17
|
|
|
19
18
|
const { ...rest } = $props()
|
|
20
19
|
|
|
@@ -59,7 +58,7 @@
|
|
|
59
58
|
|
|
60
59
|
<div
|
|
61
60
|
bind:this={container}
|
|
62
|
-
class="bg-extralight border-medium absolute top-0 left-0 z-
|
|
61
|
+
class="bg-extralight border-medium absolute top-0 left-0 z-4 m-2 resize overflow-y-auto border text-xs"
|
|
63
62
|
style:min-width="{MIN_DIMENSIONS.width}px"
|
|
64
63
|
style:min-height="{MIN_DIMENSIONS.height}px"
|
|
65
64
|
style:width={resizable.current ? `${resizable.current.width}px` : undefined}
|
|
@@ -86,6 +85,5 @@
|
|
|
86
85
|
{/if}
|
|
87
86
|
|
|
88
87
|
<Logs />
|
|
89
|
-
<Settings />
|
|
90
88
|
<Widgets />
|
|
91
89
|
</div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Switch } from '@viamrobotics/prime-core'
|
|
3
3
|
import Drawer from './Drawer.svelte'
|
|
4
|
-
import { useSettings } from '
|
|
5
|
-
import { useResourceByName } from '
|
|
6
|
-
import { usePartID } from '
|
|
4
|
+
import { useSettings } from '../../../hooks/useSettings.svelte'
|
|
5
|
+
import { useResourceByName } from '../../../hooks/useResourceByName.svelte'
|
|
6
|
+
import { usePartID } from '../../../hooks/usePartID.svelte'
|
|
7
7
|
|
|
8
8
|
const settings = useSettings()
|
|
9
9
|
const resourceByName = useResourceByName()
|