Skip to content

Commit 4a3d214

Browse files
committed
feat(hub-ui): adopt @antfu/design components and devframe branding
Reuse the shared design system's Vue components in the dock shell instead of bespoke local ones, swap the placeholder plug glyph for the devframe logo, and drop the Vite-derived dock chrome. - Buttons across the launcher, confirm modal, auth notice and json-render now use @antfu/design's ActionButton; keybinding chips use DisplayKbd. - The shadow-root stylesheet build scans the design package's components so their semantic shortcut classes ship in the injected CSS. - BrandMark/BrandWordmark render the devframe logo mark. - Remove the dock brackets and re-theme the dock glow to the sage palette. Created with the help of an agent.
1 parent 8c18a2f commit 4a3d214

21 files changed

Lines changed: 192 additions & 315 deletions

packages/hub-ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"devframe": "workspace:*"
4545
},
4646
"devDependencies": {
47+
"@antfu/design": "catalog:frontend",
4748
"@devframes/hub": "workspace:*",
4849
"@iconify-json/ph": "catalog:frontend",
4950
"@json-render/core": "catalog:deps",

packages/hub-ui/scripts/build-css.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,22 @@ export async function buildCSS(): Promise<void> {
2828
ignore: IGNORE,
2929
})
3030

31+
// The dock reuses `@antfu/design`'s Vue components (buttons, badges, …)
32+
// directly. UnoCSS ignores `node_modules` by default, so their semantic
33+
// shortcut classes (`btn-primary`, `btn-action`, `badge-*`, …) would be
34+
// absent from the shadow-root stylesheet — scan the design package's
35+
// component sources too so those classes ship in the injected CSS.
36+
const designComponentsDir = join(require.resolve('@antfu/design/package.json'), '..', 'components')
37+
const designFiles = await glob('**/*.vue', {
38+
cwd: designComponentsDir,
39+
absolute: true,
40+
ignore: IGNORE,
41+
})
42+
3143
const generator = await createGenerator(config)
3244

3345
const tokens = new Set<string>()
34-
for (const file of files) {
46+
for (const file of [...files, ...designFiles]) {
3547
const content = await fs.readFile(file, 'utf-8')
3648
await generator.applyExtractors(content, file, tokens)
3749
}

packages/hub-ui/src/client/.generated/css.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/hub-ui/src/client/components/command-palette/CommandPaletteItem.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import type { DevframeCommandEntry, DevframeCommandKeybinding } from '@devframes/hub'
3+
import DisplayKbd from '@antfu/design/components/Display/DisplayKbd.vue'
34
import DockIcon from '../dock/DockIcon.vue'
4-
import KeybindingBadge from './KeybindingBadge.vue'
55
66
defineProps<{
77
entry: DevframeCommandEntry
@@ -53,10 +53,10 @@ defineEmits<{
5353
</div>
5454
<div class="flex items-center gap-1.5 flex-none">
5555
<!-- Keybinding badges -->
56-
<KeybindingBadge
56+
<DisplayKbd
5757
v-for="(kb, ki) in keybindings"
5858
:key="ki"
59-
:key-string="kb.key"
59+
:keys="kb.key"
6060
/>
6161
<!-- Loading indicator -->
6262
<span v-if="loading" class="i-ph-spinner-gap-duotone w-3.5 h-3.5 animate-spin op50" />

packages/hub-ui/src/client/components/command-palette/KeybindingBadge.stories.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/hub-ui/src/client/components/command-palette/KeybindingBadge.vue

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/hub-ui/src/client/components/display/Button.stories.ts

Lines changed: 0 additions & 79 deletions
This file was deleted.

packages/hub-ui/src/client/components/display/Button.vue

Lines changed: 0 additions & 68 deletions
This file was deleted.

packages/hub-ui/src/client/components/display/Confirm.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2+
import ActionButton from '@antfu/design/components/Action/ActionButton.vue'
23
import { useTemplateRef, watchPostEffect } from 'vue'
34
import { ConfirmPromise } from '../../state/confirm'
4-
import Button from './Button.vue'
55
6-
const confirmButton = useTemplateRef<InstanceType<typeof Button>>('confirmButton')
6+
const confirmButton = useTemplateRef<InstanceType<typeof ActionButton>>('confirmButton')
77
88
watchPostEffect(() => {
9-
confirmButton.value?.focus({ preventScroll: true })
9+
(confirmButton.value?.$el as HTMLElement | undefined)?.focus({ preventScroll: true })
1010
})
1111
1212
function resolveConfirm(resolve: (value: boolean) => void, value: boolean) {
@@ -43,12 +43,12 @@ function resolveConfirm(resolve: (value: boolean) => void, value: boolean) {
4343
</p>
4444

4545
<div class="flex items-center justify-end gap-2 mt-6">
46-
<Button variant="ghost" size="sm" @click="resolveConfirm(resolve, false)">
46+
<ActionButton variant="text" size="sm" @click="resolveConfirm(resolve, false)">
4747
{{ options.cancelText ?? 'Cancel' }}
48-
</Button>
49-
<Button ref="confirmButton" variant="soft" size="sm" @click="resolveConfirm(resolve, true)">
48+
</ActionButton>
49+
<ActionButton ref="confirmButton" variant="primary" size="sm" @click="resolveConfirm(resolve, true)">
5050
{{ options.confirmText ?? 'OK' }}
51-
</Button>
51+
</ActionButton>
5252
</div>
5353
</div>
5454
</div>

packages/hub-ui/src/client/components/dock/Dock.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { BUILTIN_ENTRY_CLIENT_AUTH_NOTICE } from '../../constants'
88
import { docksSplitGroupsWithCapacity } from '../../state/dock-settings'
99
import { setDocksOverflowPanel } from '../../state/floating-tooltip'
1010
import { useIsRpcTrusted } from '../../utils/useIsRpcTrusted'
11-
import BracketLeft from '../icons/BracketLeft.vue'
12-
import BracketRight from '../icons/BracketRight.vue'
1311
import BrandMark from '../icons/BrandMark.vue'
1412
import {
1513
dockLayoutCssVars,
@@ -262,13 +260,6 @@ onMounted(() => {
262260
id="devframes-dock"
263261
@pointerdown="onPointerDown"
264262
>
265-
<BracketLeft
266-
class="devframes-dock-bracket absolute left--1 top-1/2 translate-y--1/2 bottom-0 w-2.5 op75 transition-opacity duration-300"
267-
/>
268-
<BracketRight
269-
class="devframes-dock-bracket absolute right--1 top-1/2 translate-y--1/2 bottom-0 w-2.5 op75 transition-opacity duration-300"
270-
:class="context.panel.isVertical ? 'scale-y--100' : ''"
271-
/>
272263
<div
273264
class="w-3 h-3 absolute left-1/2 top-1/2 translate-x--1/2 translate-y--1/2 transition-opacity duration-300"
274265
:class="[

0 commit comments

Comments
 (0)