Skip to content

Commit dea1523

Browse files
authored
chore: upgrade @antfu/design to 0.3.0 and finish data-inspector icon TODO (#110)
1 parent bd2d10f commit dea1523

9 files changed

Lines changed: 53 additions & 32 deletions

File tree

plugins/data-inspector/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"@types/codemirror": "catalog:",
7070
"@vitejs/plugin-vue": "catalog:build",
7171
"devframe": "workspace:*",
72+
"dompurify": "catalog:frontend",
7273
"floating-vue": "catalog:frontend",
7374
"reka-ui": "catalog:frontend",
7475
"splitpanes": "catalog:",

plugins/data-inspector/src/spa/App.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import type { SavedQueryScope } from '../engine'
33
import LayoutSplitPane from '@antfu/design/components/Layout/LayoutSplitPane.vue'
4+
import { provideColorScheme } from '@antfu/design/composables/colorScheme'
45
import { Pane } from 'splitpanes'
56
import { onMounted, provide } from 'vue'
67
import AppHeader from './components/AppHeader.vue'
@@ -10,6 +11,7 @@ import ResultViewer from './components/ResultViewer.vue'
1011
import SavedQueriesPanel from './components/SavedQueriesPanel.vue'
1112
import { backend, connect, connection } from './composables/rpc'
1213
import { useSavedQueries } from './composables/saved'
14+
import { colorScheme } from './composables/scheme'
1315
import { useWorkbench, workbenchKey } from './composables/workbench'
1416
import '@antfu/design/styles.css'
1517
@@ -20,6 +22,11 @@ const savedApi = useSavedQueries()
2022
// receiving it (and mutating it) through props.
2123
provide(workbenchKey, wb)
2224
25+
// The app owns the color scheme; feed it to @antfu/design's opt-in context so
26+
// the JS-colored surfaces (hash/hue `DisplayBadge`) tune their contrast to the
27+
// active mode without threading a `colorScheme` prop through every panel.
28+
provideColorScheme(() => colorScheme.value)
29+
2330
onMounted(async () => {
2431
await connect()
2532
if (!connection.connected)

plugins/data-inspector/src/spa/components/DataShapePanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const rootLabel = computed(() => {
7070
</div>
7171
<div class="flex-auto" />
7272
<ActionIconButton
73-
size="sm"
73+
class="text-sm"
7474
:icon="loading ? 'i-ph:arrows-clockwise animate-spin' : 'i-ph:arrows-clockwise'"
7575
label="Refresh data shape"
7676
tooltip="Refresh"

plugins/data-inspector/src/spa/components/DataSourceSelect.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
22
import type { DataSourceMeta } from '../../engine'
3+
import DisplayIconifyRemoteIcon from '@antfu/design/components/Display/DisplayIconifyRemoteIcon.vue'
34
import { SelectContent, SelectIcon, SelectItem, SelectItemIndicator, SelectPortal, SelectRoot, SelectTrigger, SelectViewport } from 'reka-ui'
45
import { computed } from 'vue'
56
@@ -26,8 +27,9 @@ function iconOf(source: DataSourceMeta | undefined): string {
2627
class="text-sm px-2.5 outline-none border border-base rounded bg-base inline-flex gap-2 h-9 min-w-52 max-w-80 transition items-center justify-between data-[disabled]:op50 focus-visible:ring-2 focus-visible:ring-primary-500/40"
2728
>
2829
<span class="inline-flex items-center gap-2 min-w-0">
29-
<!-- TODO: migrate to IconifyIcon.vue in @antfu/design 0.3 -->
30-
<span class="shrink-0 color-active" :class="iconOf(active)" aria-hidden="true" />
30+
<!-- Source icons are declared per-source at runtime, so render them via
31+
the remote-icon component rather than a static (build-extracted) class. -->
32+
<DisplayIconifyRemoteIcon :icon="iconOf(active)" class="shrink-0 w-3.5 h-3.5 color-active [&_svg]:h-full [&_svg]:w-full" aria-hidden="true" />
3133
<span class="truncate font-semibold text-primary">{{ active?.title ?? placeholder ?? 'Data source' }}</span>
3234
</span>
3335
<SelectIcon class="op-fade shrink-0">
@@ -47,8 +49,7 @@ function iconOf(source: DataSourceMeta | undefined): string {
4749
:value="source.id"
4850
class="text-sm color-base py-1.5 pl-2 pr-2 outline-none rounded-md flex gap-2 cursor-pointer select-none transition items-start relative data-[highlighted]:bg-active"
4951
>
50-
<!-- TODO: migrate to IconifyIcon.vue in @antfu/design 0.3 -->
51-
<span class="shrink-0 mt-0.5 color-active" :class="iconOf(source)" aria-hidden="true" />
52+
<DisplayIconifyRemoteIcon :icon="iconOf(source)" class="shrink-0 mt-0.5 w-3.5 h-3.5 color-active [&_svg]:h-full [&_svg]:w-full" aria-hidden="true" />
5253
<span class="flex flex-col min-w-0 flex-1">
5354
<span class="flex items-center gap-1.5">
5455
<span class="truncate font-medium">{{ source.title }}</span>

plugins/data-inspector/src/spa/components/ResultViewer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ watch(() => props.result, (value) => {
6464
running
6565
</span>
6666
<ActionIconButton
67-
size="sm"
67+
class="text-sm"
6868
:icon="running ? 'i-ph:arrows-clockwise animate-spin' : 'i-ph:arrows-clockwise'"
6969
label="Re-run query"
7070
tooltip="Re-run against the live object"

plugins/data-inspector/src/spa/components/SavedQueriesPanel.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,10 @@ function filterBadges(entry: Query): FilterBadge[] {
132132
>{{ badge.label }}</span>
133133
<ActionIconButton
134134
v-if="entry.saved && !readonly"
135-
size="sm"
136135
icon="i-ph:trash-duotone"
137136
label="Delete"
138137
tooltip="Delete"
139-
class="op0 group-hover:op100 transition-opacity"
138+
class="text-sm op0 group-hover:op100 transition-opacity"
140139
@click.stop="emit('remove', entry.saved)"
141140
/>
142141
</div>

plugins/inspect/src/spa/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function reload(): void {
5858
</div>
5959

6060
<ActionIconButton
61-
size="sm"
61+
class="text-sm"
6262
:icon="loading ? 'i-ph-arrows-clockwise animate-spin' : 'i-ph-arrows-clockwise'"
6363
:tooltip="loading ? 'Refreshing…' : 'Refresh'"
6464
label="Refresh"

0 commit comments

Comments
 (0)