-
-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathModuleFlow.vue
More file actions
65 lines (57 loc) · 2.02 KB
/
ModuleFlow.vue
File metadata and controls
65 lines (57 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<script setup lang="ts">
import type { ModuleInfo, RolldownChunkInfo, RolldownModuleFlowNode, SessionContext } from '~~/shared/types'
import { vOnClickOutside } from '@vueuse/components'
import { Pane, Splitpanes } from 'splitpanes'
import { shallowRef, toRefs, watch } from 'vue'
import ModuleFlowDetails from './ModuleFlowDetails.vue'
import ModuleFlowTimeline from './ModuleFlowTimeline.vue'
const props = defineProps<{
info: ModuleInfo
session: SessionContext
transformsLoading: boolean
}>()
const emit = defineEmits<{
(e: 'select', v: boolean): void
}>()
const { info } = toRefs(props)
const selected = shallowRef<RolldownChunkInfo | RolldownModuleFlowNode | null>(null)
watch(selected, (v) => {
emit('select', !!v)
})
function handleSelect(value: RolldownModuleFlowNode | null) {
selected.value = value
}
function handleClose() {
selected.value = null
}
</script>
<template>
<Splitpanes class="!h-auto !of-visible p4 module-flow-splitter">
<Pane size="45" min-size="10" max-size="90" class="!h-auto !of-visible">
<ModuleFlowTimeline
:info="info"
:session="session"
:transforms-loading="transformsLoading"
:selected="selected"
@select="handleSelect"
/>
</Pane>
<Pane v-if="selected" size="55" min-size="10" max-size="90" class="!h-auto !of-visible">
<!-- the origin of the height: -->
<!-- DialogTopMargin (20) + HandleHeight (30) + padding (4*2) = 58 -->
<div v-on-click-outside="[handleClose, { ignore: ['.splitpanes__splitter', '.flowmap-node-inline'] }]" w-full h="[calc(100vh-(var(--spacing)*58))]" sticky top-4>
<div absolute left-0 top="1/2" translate-x="-1/2" translate-y="-1/2" bg="#DFDFDF dark:#313131" h-10 w-2 rounded-full z-10 cursor-col-resize />
<ModuleFlowDetails
:selected="selected"
:session="session"
@close="handleClose"
/>
</div>
</Pane>
</Splitpanes>
</template>
<style>
.module-flow-splitter>.splitpanes__splitter:before {
background-color: transparent;
}
</style>