nuxtseo-layer-devtools 0.1.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/LICENSE.md +9 -0
- package/app.config.ts +27 -0
- package/assets/css/global.css +593 -0
- package/components/DevtoolsAlert.vue +101 -0
- package/components/DevtoolsCopyButton.vue +20 -0
- package/components/DevtoolsDocs.vue +11 -0
- package/components/DevtoolsEmptyState.vue +105 -0
- package/components/DevtoolsError.vue +78 -0
- package/components/DevtoolsKeyValue.vue +109 -0
- package/components/DevtoolsLayout.vue +219 -0
- package/components/DevtoolsLoading.vue +8 -0
- package/components/DevtoolsMetric.vue +96 -0
- package/components/DevtoolsPanel.vue +74 -0
- package/components/DevtoolsProductionError.vue +41 -0
- package/components/DevtoolsSection.vue +139 -0
- package/components/DevtoolsSnippet.vue +51 -0
- package/components/DevtoolsToolbar.vue +42 -0
- package/components/NuxtSeoLogo.vue +77 -0
- package/components/OCodeBlock.vue +23 -0
- package/composables/clipboard.ts +6 -0
- package/composables/rpc.ts +40 -0
- package/composables/shiki.ts +49 -0
- package/composables/state.ts +33 -0
- package/nuxt.config.ts +26 -0
- package/package.json +35 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useCopy } from '../composables/clipboard'
|
|
3
|
+
|
|
4
|
+
const { text } = defineProps<{
|
|
5
|
+
text: string
|
|
6
|
+
}>()
|
|
7
|
+
|
|
8
|
+
const { copy, copied } = useCopy()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<UTooltip :text="copied ? 'Copied!' : 'Copy'">
|
|
13
|
+
<UButton
|
|
14
|
+
:icon="copied ? 'carbon:checkmark' : 'carbon:copy'"
|
|
15
|
+
:aria-label="copied ? 'Copied' : 'Copy to clipboard'"
|
|
16
|
+
:class="copied ? 'text-[var(--seo-green)]' : ''"
|
|
17
|
+
@click="copy(text)"
|
|
18
|
+
/>
|
|
19
|
+
</UTooltip>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { url } = defineProps<{
|
|
3
|
+
url: string
|
|
4
|
+
}>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="h-full max-h-full overflow-hidden">
|
|
9
|
+
<iframe :src="url" :title="`Documentation - ${url}`" class="w-full h-full border-none" style="min-height: calc(100vh - 100px);" />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const {
|
|
3
|
+
icon = 'carbon:search',
|
|
4
|
+
title,
|
|
5
|
+
description,
|
|
6
|
+
variant = 'default',
|
|
7
|
+
} = defineProps<{
|
|
8
|
+
icon?: string
|
|
9
|
+
title: string
|
|
10
|
+
description?: string
|
|
11
|
+
variant?: 'default' | 'error'
|
|
12
|
+
}>()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="devtools-empty">
|
|
17
|
+
<div class="devtools-empty-icon" :class="`devtools-empty-icon-${variant}`">
|
|
18
|
+
<UIcon :name="icon" class="w-8 h-8" aria-hidden="true" />
|
|
19
|
+
</div>
|
|
20
|
+
<h2 class="devtools-empty-title">
|
|
21
|
+
{{ title }}
|
|
22
|
+
</h2>
|
|
23
|
+
<p v-if="description || $slots.description" class="devtools-empty-description">
|
|
24
|
+
<slot name="description">
|
|
25
|
+
{{ description }}
|
|
26
|
+
</slot>
|
|
27
|
+
</p>
|
|
28
|
+
<div v-if="$slots.default" class="devtools-empty-actions">
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<style scoped>
|
|
35
|
+
.devtools-empty {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
align-items: center;
|
|
39
|
+
text-align: center;
|
|
40
|
+
max-width: 32rem;
|
|
41
|
+
margin: 0 auto;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.devtools-empty-icon {
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
width: 4rem;
|
|
49
|
+
height: 4rem;
|
|
50
|
+
border-radius: var(--radius-lg);
|
|
51
|
+
margin-bottom: 1.5rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.devtools-empty-icon-default {
|
|
55
|
+
background: oklch(65% 0.2 145 / 0.12);
|
|
56
|
+
color: var(--seo-green);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.dark .devtools-empty-icon-default {
|
|
60
|
+
background: oklch(65% 0.2 145 / 0.15);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.devtools-empty-icon-error {
|
|
64
|
+
background: oklch(55% 0.2 25 / 0.12);
|
|
65
|
+
color: oklch(55% 0.2 25);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dark .devtools-empty-icon-error {
|
|
69
|
+
background: oklch(55% 0.2 25 / 0.15);
|
|
70
|
+
color: oklch(75% 0.15 25);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.devtools-empty-title {
|
|
74
|
+
font-size: 1.125rem;
|
|
75
|
+
font-weight: 600;
|
|
76
|
+
color: var(--color-text);
|
|
77
|
+
margin-bottom: 0.75rem;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@media (min-width: 640px) {
|
|
81
|
+
.devtools-empty-title {
|
|
82
|
+
font-size: 1.25rem;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.devtools-empty-description {
|
|
87
|
+
font-size: 0.875rem;
|
|
88
|
+
color: var(--color-text-muted);
|
|
89
|
+
margin-bottom: 1.25rem;
|
|
90
|
+
line-height: 1.5;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@media (min-width: 640px) {
|
|
94
|
+
.devtools-empty-description {
|
|
95
|
+
font-size: 1rem;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.devtools-empty-actions {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: column;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: 0.75rem;
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { icon = 'carbon:warning', title = 'Something went wrong' } = defineProps<{
|
|
3
|
+
icon?: string
|
|
4
|
+
title?: string
|
|
5
|
+
error?: string | Error | null
|
|
6
|
+
}>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<div class="devtools-error">
|
|
11
|
+
<div class="devtools-error-icon-wrap">
|
|
12
|
+
<UIcon :name="icon" class="devtools-error-icon" />
|
|
13
|
+
</div>
|
|
14
|
+
<p class="devtools-error-title">
|
|
15
|
+
{{ title }}
|
|
16
|
+
</p>
|
|
17
|
+
<p v-if="error" class="devtools-error-message">
|
|
18
|
+
{{ typeof error === 'string' ? error : error.message }}
|
|
19
|
+
</p>
|
|
20
|
+
<div v-if="$slots.default" class="devtools-error-actions">
|
|
21
|
+
<slot />
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<style scoped>
|
|
27
|
+
.devtools-error {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
gap: 0.75rem;
|
|
33
|
+
padding: 3rem 1.5rem;
|
|
34
|
+
text-align: center;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.devtools-error-icon-wrap {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
width: 3rem;
|
|
42
|
+
height: 3rem;
|
|
43
|
+
border-radius: var(--radius-lg);
|
|
44
|
+
background: oklch(65% 0.15 25 / 0.1);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.dark .devtools-error-icon-wrap {
|
|
48
|
+
background: oklch(45% 0.1 25 / 0.15);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.devtools-error-icon {
|
|
52
|
+
font-size: 1.5rem;
|
|
53
|
+
color: oklch(60% 0.18 25);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dark .devtools-error-icon {
|
|
57
|
+
color: oklch(70% 0.15 25);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.devtools-error-title {
|
|
61
|
+
font-size: 0.875rem;
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
color: var(--color-text);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.devtools-error-message {
|
|
67
|
+
font-size: 0.75rem;
|
|
68
|
+
color: var(--color-text-muted);
|
|
69
|
+
max-width: 20rem;
|
|
70
|
+
line-height: 1.5;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.devtools-error-actions {
|
|
74
|
+
display: flex;
|
|
75
|
+
gap: 0.5rem;
|
|
76
|
+
margin-top: 0.25rem;
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
export interface KeyValueItem {
|
|
3
|
+
key: string
|
|
4
|
+
value: string | number | boolean | undefined
|
|
5
|
+
copyable?: boolean
|
|
6
|
+
mono?: boolean
|
|
7
|
+
link?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { items, striped = false } = defineProps<{
|
|
11
|
+
items: KeyValueItem[]
|
|
12
|
+
striped?: boolean
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<div class="divide-y divide-[var(--color-border-subtle)]">
|
|
18
|
+
<div
|
|
19
|
+
v-for="item in items"
|
|
20
|
+
:key="item.key"
|
|
21
|
+
class="devtools-kv-row group"
|
|
22
|
+
:class="{ 'devtools-kv-striped': striped }"
|
|
23
|
+
>
|
|
24
|
+
<span class="devtools-kv-key">{{ item.key }}</span>
|
|
25
|
+
<div class="devtools-kv-value-wrap">
|
|
26
|
+
<a
|
|
27
|
+
v-if="item.link"
|
|
28
|
+
:href="item.link"
|
|
29
|
+
target="_blank"
|
|
30
|
+
rel="noopener"
|
|
31
|
+
class="link-external text-sm"
|
|
32
|
+
>
|
|
33
|
+
{{ item.value }}
|
|
34
|
+
</a>
|
|
35
|
+
<span
|
|
36
|
+
v-else
|
|
37
|
+
class="devtools-kv-value"
|
|
38
|
+
:class="{
|
|
39
|
+
'font-mono': item.mono !== false,
|
|
40
|
+
'devtools-kv-true': item.value === true,
|
|
41
|
+
'devtools-kv-false': item.value === false,
|
|
42
|
+
'devtools-kv-empty': item.value === undefined || item.value === '',
|
|
43
|
+
}"
|
|
44
|
+
>
|
|
45
|
+
{{ item.value === undefined || item.value === '' ? '(empty)' : item.value }}
|
|
46
|
+
</span>
|
|
47
|
+
<DevtoolsCopyButton
|
|
48
|
+
v-if="item.copyable && item.value !== undefined && item.value !== ''"
|
|
49
|
+
:text="String(item.value)"
|
|
50
|
+
class="opacity-0 group-hover:opacity-100 transition-opacity"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<style scoped>
|
|
58
|
+
.devtools-kv-row {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: space-between;
|
|
62
|
+
gap: 1rem;
|
|
63
|
+
padding: 0.625rem 1.25rem;
|
|
64
|
+
transition: background-color 150ms ease;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.devtools-kv-row:hover {
|
|
68
|
+
background: var(--color-surface-sunken);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.devtools-kv-striped:nth-child(even) {
|
|
72
|
+
background: oklch(from var(--color-surface-sunken) l c h / 0.5);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.devtools-kv-key {
|
|
76
|
+
font-size: 0.8125rem;
|
|
77
|
+
font-family: var(--font-mono);
|
|
78
|
+
color: var(--color-text-muted);
|
|
79
|
+
flex-shrink: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.devtools-kv-value-wrap {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 0.5rem;
|
|
86
|
+
min-width: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.devtools-kv-value {
|
|
90
|
+
font-size: 0.8125rem;
|
|
91
|
+
text-align: right;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.devtools-kv-true {
|
|
98
|
+
color: var(--seo-green);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.devtools-kv-false {
|
|
102
|
+
color: oklch(65% 0.15 25);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.devtools-kv-empty {
|
|
106
|
+
color: var(--color-text-subtle);
|
|
107
|
+
font-style: italic;
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { colorMode } from '../composables/rpc'
|
|
4
|
+
import { hasProductionUrl, isProductionMode, previewSource, productionUrl } from '../composables/state'
|
|
5
|
+
|
|
6
|
+
export interface DevtoolsNavItem {
|
|
7
|
+
value: string
|
|
8
|
+
to?: string
|
|
9
|
+
icon: string
|
|
10
|
+
label: string
|
|
11
|
+
devOnly?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
title,
|
|
16
|
+
icon,
|
|
17
|
+
version,
|
|
18
|
+
navItems,
|
|
19
|
+
githubUrl,
|
|
20
|
+
loading = false,
|
|
21
|
+
} = defineProps<{
|
|
22
|
+
title: string
|
|
23
|
+
icon: string
|
|
24
|
+
version?: string
|
|
25
|
+
navItems: DevtoolsNavItem[]
|
|
26
|
+
githubUrl: string
|
|
27
|
+
loading?: boolean
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits<{
|
|
31
|
+
refresh: []
|
|
32
|
+
}>()
|
|
33
|
+
|
|
34
|
+
const activeTab = defineModel<string>('activeTab')
|
|
35
|
+
|
|
36
|
+
const isDark = computed(() => colorMode.value === 'dark')
|
|
37
|
+
|
|
38
|
+
useHead({
|
|
39
|
+
title: `Nuxt ${title}`,
|
|
40
|
+
htmlAttrs: {
|
|
41
|
+
class: () => isDark.value ? 'dark' : '',
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const filteredNavItems = computed(() =>
|
|
46
|
+
isProductionMode.value
|
|
47
|
+
? navItems.filter(item => !item.devOnly)
|
|
48
|
+
: navItems,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const productionHostname = computed(() => {
|
|
52
|
+
try {
|
|
53
|
+
return new URL(productionUrl.value).hostname
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return productionUrl.value
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const isRouteNav = computed(() => navItems.some(item => item.to))
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<UApp>
|
|
65
|
+
<div class="relative bg-base flex flex-col min-h-screen">
|
|
66
|
+
<div class="gradient-bg" />
|
|
67
|
+
|
|
68
|
+
<header class="devtools-header glass sticky top-0 z-50">
|
|
69
|
+
<div class="devtools-header-content">
|
|
70
|
+
<!-- Logo & Brand -->
|
|
71
|
+
<div class="flex items-center gap-3 sm:gap-4">
|
|
72
|
+
<a
|
|
73
|
+
href="https://nuxtseo.com"
|
|
74
|
+
target="_blank"
|
|
75
|
+
rel="noopener"
|
|
76
|
+
aria-label="Nuxt SEO"
|
|
77
|
+
class="flex items-center opacity-90 hover:opacity-100 transition-opacity"
|
|
78
|
+
>
|
|
79
|
+
<NuxtSeoLogo class="h-6 sm:h-7" />
|
|
80
|
+
</a>
|
|
81
|
+
|
|
82
|
+
<div class="devtools-divider" />
|
|
83
|
+
|
|
84
|
+
<div class="flex items-center gap-2">
|
|
85
|
+
<div class="devtools-brand-icon" aria-hidden="true">
|
|
86
|
+
<UIcon :name="icon" class="text-base sm:text-lg" />
|
|
87
|
+
</div>
|
|
88
|
+
<h1 class="text-sm sm:text-base font-semibold tracking-tight text-[var(--color-text)]">
|
|
89
|
+
{{ title }}
|
|
90
|
+
</h1>
|
|
91
|
+
<UBadge
|
|
92
|
+
v-if="version"
|
|
93
|
+
class="font-mono text-[10px] sm:text-xs hidden sm:inline-flex"
|
|
94
|
+
>
|
|
95
|
+
{{ version }}
|
|
96
|
+
</UBadge>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<!-- Navigation -->
|
|
101
|
+
<nav class="flex items-center gap-1 sm:gap-2">
|
|
102
|
+
<!-- Nav Tabs -->
|
|
103
|
+
<div class="devtools-nav-tabs">
|
|
104
|
+
<template v-if="isRouteNav">
|
|
105
|
+
<NuxtLink
|
|
106
|
+
v-for="item of filteredNavItems"
|
|
107
|
+
:key="item.value"
|
|
108
|
+
:to="item.to"
|
|
109
|
+
class="devtools-nav-tab"
|
|
110
|
+
:class="[
|
|
111
|
+
activeTab === item.value ? 'active' : '',
|
|
112
|
+
loading ? 'opacity-50 pointer-events-none' : '',
|
|
113
|
+
]"
|
|
114
|
+
>
|
|
115
|
+
<UTooltip :text="item.label">
|
|
116
|
+
<div class="devtools-nav-tab-inner">
|
|
117
|
+
<UIcon
|
|
118
|
+
:name="item.icon"
|
|
119
|
+
class="text-base sm:text-lg"
|
|
120
|
+
:class="activeTab === item.value ? 'text-[var(--seo-green)]' : ''"
|
|
121
|
+
/>
|
|
122
|
+
<span class="devtools-nav-label">{{ item.label }}</span>
|
|
123
|
+
</div>
|
|
124
|
+
</UTooltip>
|
|
125
|
+
</NuxtLink>
|
|
126
|
+
</template>
|
|
127
|
+
<template v-else>
|
|
128
|
+
<button
|
|
129
|
+
v-for="item of filteredNavItems"
|
|
130
|
+
:key="item.value"
|
|
131
|
+
type="button"
|
|
132
|
+
class="devtools-nav-tab"
|
|
133
|
+
:class="[
|
|
134
|
+
activeTab === item.value ? 'active' : '',
|
|
135
|
+
loading ? 'opacity-50 pointer-events-none' : '',
|
|
136
|
+
]"
|
|
137
|
+
@click="activeTab = item.value"
|
|
138
|
+
>
|
|
139
|
+
<UTooltip :text="item.label">
|
|
140
|
+
<div class="devtools-nav-tab-inner">
|
|
141
|
+
<UIcon
|
|
142
|
+
:name="item.icon"
|
|
143
|
+
class="text-base sm:text-lg"
|
|
144
|
+
:class="activeTab === item.value ? 'text-[var(--seo-green)]' : ''"
|
|
145
|
+
/>
|
|
146
|
+
<span class="devtools-nav-label">{{ item.label }}</span>
|
|
147
|
+
</div>
|
|
148
|
+
</UTooltip>
|
|
149
|
+
</button>
|
|
150
|
+
</template>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<!-- Preview source toggle -->
|
|
154
|
+
<div v-if="hasProductionUrl" class="devtools-preview-toggle">
|
|
155
|
+
<button
|
|
156
|
+
type="button"
|
|
157
|
+
class="devtools-preview-btn"
|
|
158
|
+
:class="{ active: previewSource === 'local' }"
|
|
159
|
+
@click="previewSource = 'local'"
|
|
160
|
+
>
|
|
161
|
+
<UIcon name="carbon:laptop" class="w-3.5 h-3.5" aria-hidden="true" />
|
|
162
|
+
<span class="hidden sm:inline">Local</span>
|
|
163
|
+
</button>
|
|
164
|
+
<button
|
|
165
|
+
type="button"
|
|
166
|
+
class="devtools-preview-btn"
|
|
167
|
+
:class="{ active: previewSource === 'production' }"
|
|
168
|
+
@click="previewSource = 'production'"
|
|
169
|
+
>
|
|
170
|
+
<UIcon name="carbon:cloud" class="w-3.5 h-3.5" aria-hidden="true" />
|
|
171
|
+
<span class="hidden sm:inline">Production</span>
|
|
172
|
+
</button>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<!-- Production URL indicator -->
|
|
176
|
+
<UTooltip v-if="isProductionMode" :text="productionUrl">
|
|
177
|
+
<span class="devtools-production-badge">
|
|
178
|
+
<span class="devtools-production-dot" />
|
|
179
|
+
<span class="hidden sm:inline text-xs">{{ productionHostname }}</span>
|
|
180
|
+
</span>
|
|
181
|
+
</UTooltip>
|
|
182
|
+
|
|
183
|
+
<!-- Actions -->
|
|
184
|
+
<div class="flex items-center gap-1">
|
|
185
|
+
<slot name="actions" />
|
|
186
|
+
|
|
187
|
+
<UTooltip text="Refresh">
|
|
188
|
+
<UButton
|
|
189
|
+
icon="carbon:reset"
|
|
190
|
+
aria-label="Refresh"
|
|
191
|
+
class="devtools-nav-action"
|
|
192
|
+
@click="emit('refresh')"
|
|
193
|
+
/>
|
|
194
|
+
</UTooltip>
|
|
195
|
+
|
|
196
|
+
<UTooltip text="GitHub">
|
|
197
|
+
<UButton
|
|
198
|
+
icon="simple-icons:github"
|
|
199
|
+
aria-label="GitHub"
|
|
200
|
+
:to="githubUrl"
|
|
201
|
+
target="_blank"
|
|
202
|
+
class="devtools-nav-action hidden sm:flex"
|
|
203
|
+
/>
|
|
204
|
+
</UTooltip>
|
|
205
|
+
</div>
|
|
206
|
+
</nav>
|
|
207
|
+
</div>
|
|
208
|
+
</header>
|
|
209
|
+
|
|
210
|
+
<!-- Main Content -->
|
|
211
|
+
<div class="devtools-main">
|
|
212
|
+
<main class="mx-auto flex flex-col w-full max-w-7xl">
|
|
213
|
+
<DevtoolsLoading v-if="loading" />
|
|
214
|
+
<slot v-else />
|
|
215
|
+
</main>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</UApp>
|
|
219
|
+
</template>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const {
|
|
3
|
+
label,
|
|
4
|
+
value,
|
|
5
|
+
icon,
|
|
6
|
+
variant = 'default',
|
|
7
|
+
} = defineProps<{
|
|
8
|
+
label?: string
|
|
9
|
+
value: string | number
|
|
10
|
+
icon?: string
|
|
11
|
+
variant?: 'default' | 'success' | 'warning' | 'danger' | 'info'
|
|
12
|
+
}>()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="devtools-metric" :class="`devtools-metric-${variant}`">
|
|
17
|
+
<UIcon v-if="icon" :name="icon" class="devtools-metric-icon" aria-hidden="true" />
|
|
18
|
+
<span class="devtools-metric-value">{{ value }}</span>
|
|
19
|
+
<span v-if="label" class="devtools-metric-label">{{ label }}</span>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.devtools-metric {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
gap: 0.375rem;
|
|
28
|
+
padding: 0.25rem 0.625rem;
|
|
29
|
+
font-size: 0.75rem;
|
|
30
|
+
font-weight: 500;
|
|
31
|
+
border-radius: var(--radius-sm);
|
|
32
|
+
font-variant-numeric: tabular-nums;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.devtools-metric-icon {
|
|
36
|
+
font-size: 0.875rem;
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.devtools-metric-value {
|
|
41
|
+
font-family: var(--font-mono);
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.devtools-metric-label {
|
|
46
|
+
color: inherit;
|
|
47
|
+
opacity: 0.7;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Variants */
|
|
51
|
+
.devtools-metric-default {
|
|
52
|
+
background: var(--color-surface-sunken);
|
|
53
|
+
border: 1px solid var(--color-border-subtle);
|
|
54
|
+
color: var(--color-text);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.devtools-metric-success {
|
|
58
|
+
background: oklch(75% 0.15 145 / 0.12);
|
|
59
|
+
color: oklch(50% 0.15 145);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.dark .devtools-metric-success {
|
|
63
|
+
background: oklch(50% 0.15 145 / 0.15);
|
|
64
|
+
color: oklch(75% 0.18 145);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.devtools-metric-warning {
|
|
68
|
+
background: oklch(80% 0.12 85 / 0.12);
|
|
69
|
+
color: oklch(55% 0.15 85);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.dark .devtools-metric-warning {
|
|
73
|
+
background: oklch(55% 0.12 85 / 0.15);
|
|
74
|
+
color: oklch(75% 0.15 85);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.devtools-metric-danger {
|
|
78
|
+
background: oklch(65% 0.12 25 / 0.1);
|
|
79
|
+
color: oklch(55% 0.15 25);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.dark .devtools-metric-danger {
|
|
83
|
+
background: oklch(45% 0.1 25 / 0.15);
|
|
84
|
+
color: oklch(70% 0.12 25);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.devtools-metric-info {
|
|
88
|
+
background: oklch(85% 0.08 200 / 0.1);
|
|
89
|
+
color: oklch(50% 0.12 200);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.dark .devtools-metric-info {
|
|
93
|
+
background: oklch(35% 0.08 200 / 0.15);
|
|
94
|
+
color: oklch(70% 0.1 200);
|
|
95
|
+
}
|
|
96
|
+
</style>
|