Skip to content
Open
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
3 changes: 3 additions & 0 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"build:test": "pnpm run build",
"dev": "vite build --watch"
},
"dependencies": {
"@tanstack/vue-virtual": "^3.13.12"
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.0",
"vite": "^7.0.2",
Expand Down
33 changes: 0 additions & 33 deletions packages/runtime/src/components/Checker.ce.vue

This file was deleted.

9 changes: 7 additions & 2 deletions packages/runtime/src/components/Diagnostic.ce.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const errorSource = computed(() => {

<template>
<li class="message-item">
<pre class="message">
<pre class="message" :title="diagnostic.message">
<!-- @vue-ignore -->
<span class="plugin" :style="{ color: checkerColorMap[diagnostic.checkerId] }"
>{{ `[${diagnostic.checkerId}]` }} </span
Expand All @@ -88,11 +88,14 @@ li {
.message-item {
border-bottom: 1px dotted #666;
padding: 12px 0 0 0;
box-sizing: border-box;
height: 220px;
}

.message {
white-space: initial;
white-space: nowrap;
font-weight: 600;
word-break: break-all;
}

pre {
Expand All @@ -110,6 +113,8 @@ pre {
background: rgba(22, 24, 29, 0.85);
margin-top: 8px;
border-radius: 8px;
height: 140px;
overflow-y: auto;
}

.frame-code {
Expand Down
68 changes: 52 additions & 16 deletions packages/runtime/src/components/List.ce.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,55 @@
<script setup lang="ts">
import Checker from './Checker.ce.vue'

withDefaults(
defineProps<{
ulStyle?: string
base: string
checkerResults: any[]
}>(),
{
ulStyle: '',
}
import {computed, ref} from "vue";
import Diagnostic from "./Diagnostic.ce.vue";
import {useVirtualizer} from "@tanstack/vue-virtual";

const parentRef = ref<HTMLElement | null>(null)

const props = withDefaults(
defineProps<{
ulStyle?: string
base: string
checkerResults: any[]
}>(),
{
ulStyle: '',
}
)

const diagnostics = computed(() => props.checkerResults.flatMap(item => item.diagnostics))

const rowVirtualizer = useVirtualizer({
count: diagnostics.value.length,
getScrollElement: () => parentRef.value,
estimateSize: () => 220,
overscan: 5,
})

const virtualRows = computed(() => rowVirtualizer.value.getVirtualItems())

const totalSize = computed(() => rowVirtualizer.value.getTotalSize())

</script>

<template>
<ul :style="ulStyle">
<li v-for="(checkerResult, index) in checkerResults" :key="index">
<Checker :diagnostics="checkerResult.diagnostics" :base="base" :index="index" />
</li>
</ul>
<div ref="parentRef" class="parent-container">
<ul :style="`height: ${totalSize}px; width: 100%; position: relative; ${ulStyle}`">
<li
v-for="virtualRow in virtualRows"
:key="virtualRow.index"
:style="{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: `${virtualRow.size}px`,
transform: `translateY(${virtualRow.start}px)`,
}"
>
<Diagnostic :diagnostic="diagnostics[virtualRow.index]" :base="base"/>
</li>
</ul>
</div>
</template>

<style>
Expand All @@ -31,4 +62,9 @@ ul {
padding-inline: 0;
margin-block: 0;
}

.parent-container {
height: 100%;
overflow: auto;
}
</style>
19 changes: 19 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading