forked from npmx-dev/npmx.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTable.vue
More file actions
39 lines (35 loc) · 1.04 KB
/
Table.vue
File metadata and controls
39 lines (35 loc) · 1.04 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
<script setup lang="ts">
const props = defineProps<{
hunks: (DiffHunk | DiffSkipBlock)[]
type: 'add' | 'delete' | 'modify'
fileName?: string
wordWrap?: boolean
}>()
// provide diff context into child components
provide('diffContext', {
fileStatus: computed(() => props.type),
wordWrap: computed(() => props.wordWrap ?? false),
})
</script>
<template>
<table
class="diff-table shiki font-mono text-sm w-full m-0 border-separate border-0 outline-none overflow-x-auto border-spacing-0"
>
<tbody class="w-full box-border">
<template v-for="(hunk, index) in hunks" :key="index">
<DiffHunk v-if="hunk.type === 'hunk'" :hunk="hunk" />
<DiffSkipBlock v-else :count="hunk.count" :content="hunk.content" />
</template>
</tbody>
</table>
</template>
<style scoped>
.diff-table {
--code-added: oklch(0.723 0.219 149.579);
--code-removed: oklch(0.704 0.191 22.216);
}
:root[data-theme='light'] .diff-table {
--code-added: oklch(0.527 0.154 150.069);
--code-removed: oklch(0.577 0.184 27.325);
}
</style>