@viamrobotics/motion-tools 1.9.1 → 1.11.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 +16 -0
- package/dist/HoverUpdater.svelte.js +78 -0
- package/dist/WorldObject.svelte.d.ts +27 -0
- package/dist/WorldObject.svelte.js +8 -55
- package/dist/{draw → buf/draw}/v1/drawing_pb.d.ts +6 -0
- package/dist/{draw → buf/draw}/v1/drawing_pb.js +7 -0
- package/dist/buf/draw/v1/service_connect.d.ts +122 -0
- package/dist/buf/draw/v1/service_connect.js +126 -0
- package/dist/buf/draw/v1/service_pb.d.ts +382 -0
- package/dist/buf/draw/v1/service_pb.js +612 -0
- package/dist/components/App.svelte +28 -30
- package/dist/components/Arrows/Arrows.svelte +16 -3
- package/dist/components/FileDrop/file-dropper.d.ts +1 -1
- package/dist/components/FileDrop/snapshot-dropper.js +1 -1
- package/dist/components/FileDrop/useFileDrop.svelte.d.ts +2 -1
- package/dist/components/Frame.svelte +1 -1
- package/dist/components/Geometry.svelte +113 -71
- package/dist/components/Geometry.svelte.d.ts +6 -7
- package/dist/components/MeasureTool/MeasurePoint.svelte +3 -3
- package/dist/components/MeasureTool/MeasureTool.svelte +6 -6
- package/dist/components/SceneProviders.svelte +4 -0
- package/dist/components/Snapshot.svelte +1 -1
- package/dist/components/Snapshot.svelte.d.ts +1 -1
- 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/overlay/Details.svelte +55 -2
- package/dist/components/overlay/FloatingPanel.svelte +78 -0
- package/dist/components/overlay/FloatingPanel.svelte.d.ts +13 -0
- package/dist/components/overlay/{left-pane/RefreshRate.svelte → RefreshRate.svelte} +1 -1
- package/dist/components/overlay/ToggleGroup.svelte +22 -26
- package/dist/components/overlay/ToggleGroup.svelte.d.ts +6 -7
- package/dist/components/overlay/left-pane/TreeContainer.svelte +0 -4
- package/dist/components/overlay/settings/Settings.svelte +330 -0
- package/dist/components/overlay/settings/Tabs.svelte +54 -0
- package/dist/components/overlay/settings/Tabs.svelte.d.ts +12 -0
- package/dist/components/overlay/widgets/Camera.svelte +20 -12
- package/dist/components/xr/ArmTeleop.svelte +469 -0
- package/dist/components/xr/ArmTeleop.svelte.d.ts +10 -0
- package/dist/components/xr/CameraFeed.svelte +191 -47
- package/dist/components/xr/CameraFeed.svelte.d.ts +7 -0
- package/dist/components/xr/Controllers.svelte +45 -38
- package/dist/components/xr/Controllers.svelte.d.ts +2 -17
- package/dist/components/xr/Hands.svelte +2 -4
- package/dist/components/xr/JointLimitsWidget.svelte +209 -0
- package/dist/components/xr/JointLimitsWidget.svelte.d.ts +13 -0
- package/dist/components/xr/OriginMarker.svelte +1 -15
- package/dist/components/xr/XR.svelte +78 -5
- package/dist/components/xr/XRConfigPanel.svelte +449 -0
- package/dist/components/xr/XRConfigPanel.svelte.d.ts +11 -0
- package/dist/components/xr/XRControllerSettings.svelte +240 -0
- package/dist/components/xr/XRControllerSettings.svelte.d.ts +3 -0
- package/dist/components/xr/XRToast.svelte +215 -0
- package/dist/components/xr/XRToast.svelte.d.ts +3 -0
- package/dist/components/xr/math.d.ts +14 -0
- package/dist/components/xr/math.js +26 -0
- package/dist/components/xr/toasts.svelte.d.ts +20 -0
- package/dist/components/xr/toasts.svelte.js +32 -0
- package/dist/components/xr/useOrigin.svelte.d.ts +2 -2
- package/dist/components/xr/useOrigin.svelte.js +4 -4
- 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 +15 -1
- package/dist/ecs/traits.js +19 -5
- package/dist/ecs/useTrait.svelte.d.ts +3 -3
- package/dist/frame.d.ts +0 -3
- package/dist/hooks/useArmKinematics.svelte.d.ts +12 -0
- package/dist/hooks/useArmKinematics.svelte.js +31 -0
- package/dist/hooks/useGeometries.svelte.js +47 -36
- package/dist/hooks/useLinked.svelte.d.ts +7 -0
- package/dist/hooks/useLinked.svelte.js +35 -0
- package/dist/hooks/useObjectEvents.svelte.js +52 -16
- package/dist/hooks/usePartConfig.svelte.d.ts +0 -35
- package/dist/hooks/usePartConfig.svelte.js +2 -2
- package/dist/hooks/usePointcloudObjects.svelte.js +45 -64
- package/dist/hooks/usePointclouds.svelte.js +13 -9
- package/dist/hooks/usePose.svelte.js +5 -2
- package/dist/hooks/useResourceByName.svelte.d.ts +7 -0
- package/dist/hooks/useResourceByName.svelte.js +2 -2
- package/dist/hooks/useSettings.svelte.d.ts +14 -0
- package/dist/hooks/useSettings.svelte.js +10 -0
- package/dist/hooks/useWorldState.svelte.d.ts +0 -8
- package/dist/lib.d.ts +1 -3
- package/dist/lib.js +1 -3
- package/dist/snapshot.d.ts +2 -2
- package/dist/snapshot.js +2 -2
- package/dist/three/InstancedArrows/raycast.d.ts +2 -4
- package/dist/three/InstancedArrows/raycast.js +5 -5
- package/dist/transform.js +1 -0
- package/package.json +7 -5
- package/dist/assert.d.ts +0 -14
- package/dist/assert.js +0 -21
- package/dist/components/BatchedGeometry.svelte +0 -0
- package/dist/components/BatchedGeometry.svelte.d.ts +0 -26
- package/dist/components/Detections.svelte +0 -41
- package/dist/components/Detections.svelte.d.ts +0 -3
- package/dist/components/DetectionsPlane.svelte +0 -23
- package/dist/components/DetectionsPlane.svelte.d.ts +0 -21
- package/dist/components/Geometry2.svelte +0 -211
- package/dist/components/Geometry2.svelte.d.ts +0 -19
- package/dist/components/HoveredEntities.svelte +0 -19
- package/dist/components/HoveredEntityTooltip.svelte +0 -242
- package/dist/components/overlay/left-pane/Settings.svelte +0 -221
- package/dist/components/overlay/left-pane/Widgets.svelte +0 -65
- package/dist/components/overlay/left-pane/Widgets.svelte.d.ts +0 -3
- package/dist/entries.d.ts +0 -1
- package/dist/entries.js +0 -3
- package/dist/hooks/index.d.ts +0 -0
- package/dist/hooks/index.js +0 -1
- package/dist/test.d.ts +0 -1
- package/dist/test.js +0 -1
- package/dist/three/BoxHelper.d.ts +0 -50
- package/dist/three/BoxHelper.js +0 -134
- /package/dist/{common → buf/common}/v1/common_pb.d.ts +0 -0
- /package/dist/{common → buf/common}/v1/common_pb.js +0 -0
- /package/dist/{draw → buf/draw}/v1/metadata_pb.d.ts +0 -0
- /package/dist/{draw → buf/draw}/v1/metadata_pb.js +0 -0
- /package/dist/{draw → buf/draw}/v1/scene_pb.d.ts +0 -0
- /package/dist/{draw → buf/draw}/v1/scene_pb.js +0 -0
- /package/dist/{draw → buf/draw}/v1/snapshot_pb.d.ts +0 -0
- /package/dist/{draw → buf/draw}/v1/snapshot_pb.js +0 -0
- /package/dist/{draw → buf/draw}/v1/transforms_pb.d.ts +0 -0
- /package/dist/{draw → buf/draw}/v1/transforms_pb.js +0 -0
- /package/dist/components/{HoveredEntities.svelte.d.ts → hover/HoveredEntities.svelte.d.ts} +0 -0
- /package/dist/components/overlay/{left-pane/RefreshRate.svelte.d.ts → RefreshRate.svelte.d.ts} +0 -0
- /package/dist/components/overlay/{left-pane → settings}/Settings.svelte.d.ts +0 -0
- /package/dist/components/{BentPlaneGeometry.svelte → xr/BentPlaneGeometry.svelte} +0 -0
- /package/dist/components/{BentPlaneGeometry.svelte.d.ts → xr/BentPlaneGeometry.svelte.d.ts} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Parser } from 'expr-eval';
|
|
2
|
+
export declare const parser: Parser;
|
|
3
|
+
import type { Entity } from 'koota';
|
|
4
|
+
interface Props {
|
|
5
|
+
linkedEntity: Entity;
|
|
6
|
+
}
|
|
7
|
+
declare const LinkedHoveredEntity: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type LinkedHoveredEntity = ReturnType<typeof LinkedHoveredEntity>;
|
|
9
|
+
export default LinkedHoveredEntity;
|
|
@@ -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}
|
|
@@ -25,9 +25,12 @@
|
|
|
25
25
|
import { usePartConfig } from '../../hooks/usePartConfig.svelte'
|
|
26
26
|
import { FrameConfigUpdater } from '../../FrameConfigUpdater.svelte'
|
|
27
27
|
import { useEnvironment } from '../../hooks/useEnvironment.svelte'
|
|
28
|
-
import { traits, useTrait, useWorld } from '../../ecs'
|
|
28
|
+
import { traits, useTrait, useWorld, relations } from '../../ecs'
|
|
29
29
|
import { useResourceByName } from '../../hooks/useResourceByName.svelte'
|
|
30
30
|
import { useCameraControls } from '../../hooks/useControls.svelte'
|
|
31
|
+
import { useLinkedEntities } from '../../hooks/useLinked.svelte'
|
|
32
|
+
import AddRelationship from './AddRelationship.svelte'
|
|
33
|
+
import { createPose } from '../../transform'
|
|
31
34
|
|
|
32
35
|
const { ...rest } = $props()
|
|
33
36
|
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
const object3d = $derived(focusedObject3d.current ?? selectedObject3d.current)
|
|
46
49
|
const worldPosition = $state({ x: 0, y: 0, z: 0 })
|
|
47
50
|
const worldOrientation = $state({ x: 0, y: 0, z: 1, th: 0 })
|
|
48
|
-
|
|
51
|
+
const linkedEntities = useLinkedEntities()
|
|
49
52
|
const name = useTrait(() => entity, traits.Name)
|
|
50
53
|
const parent = useTrait(() => entity, traits.Parent)
|
|
51
54
|
const localPose = useTrait(() => entity, traits.EditedPose)
|
|
@@ -53,11 +56,14 @@
|
|
|
53
56
|
const sphere = useTrait(() => entity, traits.Sphere)
|
|
54
57
|
const capsule = useTrait(() => entity, traits.Capsule)
|
|
55
58
|
const removable = useTrait(() => entity, traits.Removable)
|
|
59
|
+
const points = useTrait(() => entity, traits.Points)
|
|
60
|
+
const arrows = useTrait(() => entity, traits.Arrows)
|
|
56
61
|
|
|
57
62
|
const framesAPI = useTrait(() => entity, traits.FramesAPI)
|
|
58
63
|
const isFrameNode = $derived(!!framesAPI.current)
|
|
59
64
|
|
|
60
65
|
const showEditFrameOptions = $derived(isFrameNode && partConfig.hasEditPermissions)
|
|
66
|
+
const showRelationshipOptions = $derived(points.current || arrows.current)
|
|
61
67
|
|
|
62
68
|
const resourceName = $derived(name.current ? resourceByName.current[name.current] : undefined)
|
|
63
69
|
|
|
@@ -119,6 +125,25 @@
|
|
|
119
125
|
}
|
|
120
126
|
})
|
|
121
127
|
|
|
128
|
+
$effect(() => {
|
|
129
|
+
if (entity) {
|
|
130
|
+
const worldPose = createPose({
|
|
131
|
+
x: worldPosition.x,
|
|
132
|
+
y: worldPosition.y,
|
|
133
|
+
z: worldPosition.z,
|
|
134
|
+
oX: worldOrientation.x,
|
|
135
|
+
oY: worldOrientation.y,
|
|
136
|
+
oZ: worldOrientation.z,
|
|
137
|
+
theta: MathUtils.radToDeg(worldOrientation.th),
|
|
138
|
+
})
|
|
139
|
+
if (entity.has(traits.WorldPose)) {
|
|
140
|
+
entity.set(traits.WorldPose, worldPose)
|
|
141
|
+
} else {
|
|
142
|
+
entity.add(traits.WorldPose(worldPose))
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
|
|
122
147
|
const getCopyClipboardText = () => {
|
|
123
148
|
return JSON.stringify(
|
|
124
149
|
{
|
|
@@ -611,6 +636,30 @@
|
|
|
611
636
|
{/if}
|
|
612
637
|
</div>
|
|
613
638
|
|
|
639
|
+
<h3 class="text-subtle-2 pt-3 pb-2">Relationships</h3>
|
|
640
|
+
|
|
641
|
+
{#if linkedEntities.current.length > 0}
|
|
642
|
+
<div>
|
|
643
|
+
<div class="mt-0.5 flex flex-col gap-1">
|
|
644
|
+
<strong class="font-semibold">Linked entities</strong>
|
|
645
|
+
{#each linkedEntities.current as linkedEntity (linkedEntity)}
|
|
646
|
+
{@const linkedEntityName = linkedEntity.get(traits.Name)}
|
|
647
|
+
{@const linkType = entity.get(relations.SubEntityLink(linkedEntity))?.type}
|
|
648
|
+
<div class="flex items-center gap-1">
|
|
649
|
+
<span class="text-primary">{linkedEntityName} ({linkType})</span>
|
|
650
|
+
<Icon
|
|
651
|
+
name="trash-can-outline"
|
|
652
|
+
class="h-6 cursor-pointer px-2 py-1 text-xs text-red-500"
|
|
653
|
+
onclick={() => {
|
|
654
|
+
entity.remove(relations.SubEntityLink(linkedEntity))
|
|
655
|
+
}}
|
|
656
|
+
/>
|
|
657
|
+
</div>
|
|
658
|
+
{/each}
|
|
659
|
+
</div>
|
|
660
|
+
</div>
|
|
661
|
+
{/if}
|
|
662
|
+
|
|
614
663
|
<h3 class="text-subtle-2 pt-3 pb-2">Actions</h3>
|
|
615
664
|
|
|
616
665
|
{#if focusedEntity.current}
|
|
@@ -632,6 +681,10 @@
|
|
|
632
681
|
</Button>
|
|
633
682
|
{/if}
|
|
634
683
|
|
|
684
|
+
{#if showRelationshipOptions}
|
|
685
|
+
<AddRelationship {entity} />
|
|
686
|
+
{/if}
|
|
687
|
+
|
|
635
688
|
{#if showEditFrameOptions && environment.current.isStandalone}
|
|
636
689
|
<Button
|
|
637
690
|
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;
|
|
@@ -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 {
|
|
@@ -3,25 +3,26 @@
|
|
|
3
3
|
import * as toggle from '@zag-js/toggle-group'
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
|
-
multiple
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: string
|
|
6
|
+
multiple?: boolean
|
|
7
|
+
options: {
|
|
8
|
+
selected?: boolean
|
|
9
|
+
label: string
|
|
10
|
+
value?: string
|
|
12
11
|
}[]
|
|
13
|
-
|
|
12
|
+
onSelect: (details: string[]) => void
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
let { multiple,
|
|
15
|
+
let { multiple = false, options, onSelect }: Props = $props()
|
|
17
16
|
|
|
18
17
|
const id = $props.id()
|
|
19
18
|
const service = useMachine(toggle.machine, () => ({
|
|
20
19
|
id,
|
|
21
|
-
value:
|
|
20
|
+
value: options
|
|
21
|
+
.filter((option) => option.selected)
|
|
22
|
+
.map((button) => button.value ?? button.label),
|
|
22
23
|
multiple,
|
|
23
24
|
onValueChange(details) {
|
|
24
|
-
|
|
25
|
+
onSelect(details.value)
|
|
25
26
|
},
|
|
26
27
|
}))
|
|
27
28
|
const api = $derived(toggle.connect(service, normalizeProps))
|
|
@@ -31,29 +32,24 @@
|
|
|
31
32
|
class="flex items-center"
|
|
32
33
|
{...api.getRootProps()}
|
|
33
34
|
>
|
|
34
|
-
{#each
|
|
35
|
+
{#each options as option (option.label)}
|
|
36
|
+
{@const value = option.value ?? option.label}
|
|
37
|
+
|
|
35
38
|
<button
|
|
36
|
-
class=
|
|
37
|
-
|
|
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 })}
|
|
38
46
|
>
|
|
39
|
-
{
|
|
47
|
+
{value}
|
|
40
48
|
</button>
|
|
41
49
|
{/each}
|
|
42
50
|
</div>
|
|
43
51
|
|
|
44
52
|
<style>
|
|
45
|
-
button[data-state='on'] {
|
|
46
|
-
background: green;
|
|
47
|
-
border-color: black;
|
|
48
|
-
color: white;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
button[data-disabled] {
|
|
52
|
-
opacity: 0.5;
|
|
53
|
-
|
|
54
|
-
filter: grayscale(100%);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
53
|
button[data-focus] {
|
|
58
54
|
outline: none;
|
|
59
55
|
}
|
|
@@ -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>;
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
import Tree from './Tree.svelte'
|
|
4
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
|
-
import Widgets from './Widgets.svelte'
|
|
9
7
|
import AddFrames from './AddFrames.svelte'
|
|
10
8
|
import { useEnvironment } from '../../../hooks/useEnvironment.svelte'
|
|
11
9
|
import { usePartID } from '../../../hooks/usePartID.svelte'
|
|
@@ -86,6 +84,4 @@
|
|
|
86
84
|
{/if}
|
|
87
85
|
|
|
88
86
|
<Logs />
|
|
89
|
-
<Settings />
|
|
90
|
-
<Widgets />
|
|
91
87
|
</div>
|