Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/devtools-ui-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@vueuse/nuxt": "^10.4.1",
"defu": "^6.1.2",
"focus-trap": "^7.5.3",
"splitpanes": "^3.1.5",
"unocss": "^0.56.2",
"v-lazy-show": "^0.2.3"
},
Expand Down
82 changes: 82 additions & 0 deletions packages/devtools-ui-kit/src/components/NSplitPane.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { useLocalStorage } from '@vueuse/core'
import { Pane, Splitpanes } from 'splitpanes'

import 'splitpanes/dist/splitpanes.css'
Copy link
Copy Markdown
Member Author

@arashsheyda arashsheyda Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it okay to import the style here or should we import it in the module.ts?


const props = withDefaults(defineProps<{
/**
* The key to use for storing the pane sizes in localStorage.
*/
storageKey?: string
stateKey?: string
leftSize?: number
minSize?: number
horizontal?: boolean
}>(), {
stateKey: 'nuxt-devtools-panels-state',
})

const state = useLocalStorage<Record<string, number>>(props.stateKey, {} as any, { listenToStorageChanges: false })

const DEFAULT = 30

const key = props.storageKey
const size = key
? computed({
get: () => state.value[key] || props.leftSize || DEFAULT,
set: (v) => { state.value[key] = v },
})
: ref(props.leftSize || DEFAULT)
</script>

<template>
<Splitpanes :horizontal="horizontal" h-full of-hidden @resize="size = $event[0].size">
<Pane h-full class="of-auto!" :size="size" :min-size="$slots.right ? (minSize || 10) : 100">
<slot name="left" />
</Pane>
<Pane v-if="$slots.right" relative h-full class="of-auto!" :min-size="minSize || 10">
<slot name="right" />
</Pane>
</Splitpanes>
</template>

<style>
.splitpanes__splitter {
position: relative;
}
.splitpanes__splitter:before {
position: absolute;
left: 0;
top: 0;
transition: .2s ease;
content: '';
transition: opacity 0.4s;
z-index: 1;
}
.splitpanes__splitter:hover:before {
background: #8881;
opacity: 1;
}
.splitpanes--vertical>.splitpanes__splitter {
min-width: 0 !important;
width: 0 !important;
@apply border-r border-base
}
.splitpanes--horizontal>.splitpanes__splitter {
min-height: 0 !important;
height: 0 !important;
@apply border-t border-base
}
.splitpanes--vertical>.splitpanes__splitter:before {
left: -5px;
right: -4px;
height: 100%;
}
.splitpanes--horizontal>.splitpanes__splitter:before {
top: -5px;
bottom: -4px;
width: 100%;
}
</style>
5 changes: 2 additions & 3 deletions packages/devtools/client/app.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import 'floating-vue/dist/style.css'
import 'vanilla-jsoneditor/themes/jse-theme-dark.css'
import 'splitpanes/dist/splitpanes.css'
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
import './styles/global.css'
import { setupClientRPC } from './setup/client-rpc'
Expand Down Expand Up @@ -94,14 +93,14 @@ registerCommands(() =>
>
<SideNav v-show="!isUtilityView" of-x-hidden of-y-auto />
<NuxtLayout>
<PanelLeftRight storage-key="devtools:split-screen-mode" :min-size="20">
<NSplitPane storage-key="devtools:split-screen-mode" :min-size="20">
<template #left>
<NuxtPage />
</template>
<template v-if="splitScreenEnabled && splitScreenAvailable" #right>
<SplitScreen />
</template>
</PanelLeftRight>
</NSplitPane>
</NuxtLayout>
<CommandPalette />
<AuthConfirmDialog />
Expand Down
34 changes: 0 additions & 34 deletions packages/devtools/client/components/PanelLeftRight.vue

This file was deleted.

4 changes: 2 additions & 2 deletions packages/devtools/client/components/StorageDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async function renameCurrentItem() {
</script>

<template>
<PanelLeftRight v-if="currentStorage" storage-key="tab-storage">
<NSplitPane v-if="currentStorage" storage-key="tab-storage">
<template #left>
<div class="h-[48px] flex items-center justify-between gap1 px-3">
<NIconButton icon="carbon-chevron-left" ml--1 @click="currentStorage = ''" />
Expand Down Expand Up @@ -189,7 +189,7 @@ async function renameCurrentItem() {
</NCard>
</NPanelGrids>
</template>
</PanelLeftRight>
</NSplitPane>
<NPanelGrids v-else>
<p v-if="Object.keys(storageMounts as any).length" op50>
Select one storage to start:
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools/client/pages/modules/analyze-build.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ registerCommands(() => [
</script>

<template>
<PanelLeftRight :left-size="30">
<NSplitPane :left-size="30">
<template #left>
<div flex="~ col">
<template v-for="build of info?.builds" :key="build.slug">
Expand Down Expand Up @@ -96,7 +96,7 @@ registerCommands(() => [
<BuildAnalyzeDetails v-if="selected" :current="selected" />
<NPanelGrids v-else />
</template>
</PanelLeftRight>
</NSplitPane>

<PromiseConfirm v-slot="{ resolve }">
<NDialog :model-value="true" @close="resolve(false)">
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools/client/pages/modules/server-routes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function capitalize(str: string) {
</script>

<template>
<PanelLeftRight storage-key="tab-server-routes">
<NSplitPane storage-key="tab-server-routes">
<template #left>
<Navbar v-model:search="search" pb2>
<template #actions>
Expand Down Expand Up @@ -177,7 +177,7 @@ function capitalize(str: string) {
</NCard>
</NPanelGrids>
</template>
</PanelLeftRight>
</NSplitPane>
<NDrawer v-model="inputDefaultsDrawer" auto-close max-w-xl min-w-xl @close="inputDefaultsDrawer = false">
<div>
<div p4 border="b base">
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools/client/pages/modules/virtual-files.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const filteredFiles = computed(() => {
</script>

<template>
<PanelLeftRight class="virtual-files" storage-key="tab-virtual-files">
<NSplitPane class="virtual-files" storage-key="tab-virtual-files">
<template #left>
<Navbar
v-model:search="searchString"
Expand Down Expand Up @@ -94,7 +94,7 @@ const filteredFiles = computed(() => {
</NCard>
</NPanelGrids>
</template>
</PanelLeftRight>
</NSplitPane>

<HelpFab>
<DocsVirtualFiles />
Expand Down
36 changes: 0 additions & 36 deletions packages/devtools/client/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,42 +66,6 @@ html.dark {
color: var(--shiki-dark, inherit) !important;
}

/* Splitpanes */
.splitpanes__splitter {
position: relative;
}
.splitpanes__splitter:before {
position: absolute;
left: 0;
top: 0;
transition: .2s ease;
content: '';
transition: opacity 0.4s;
z-index: 1;
}
.splitpanes__splitter:hover:before {
background: #8881;
opacity: 1;
}
.splitpanes--vertical>.splitpanes__splitter {
min-width: 0 !important;
width: 0 !important;
}
.splitpanes--horizontal>.splitpanes__splitter {
min-height: 0 !important;
height: 0 !important;
}
.splitpanes--vertical>.splitpanes__splitter:before {
left: -5px;
right: -4px;
height: 100%;
}
.splitpanes--horizontal>.splitpanes__splitter:before {
top: -5px;
bottom: -4px;
width: 100%;
}

/* JSON Editor */
textarea {
background: #8881
Expand Down
1 change: 0 additions & 1 deletion packages/devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
"nuxt-vitest": "^0.10.5",
"quicktype-core": "^23.0.75",
"shikiji": "^0.6.8",
"splitpanes": "^3.1.5",
"theme-vitesse": "^0.7.3",
"ua-parser-js": "^1.0.36",
"unocss": "^0.56.2",
Expand Down
Loading