From 4cc3f4be937e0a6d98db8d56465124c41938a561 Mon Sep 17 00:00:00 2001 From: "Anthony Fu (via agent)" Date: Wed, 22 Jul 2026 01:28:28 +0000 Subject: [PATCH 1/6] feat(design): shared uno.config base with h-nav and unified nav header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce design/uno.config.ts as the single source for the UnoCSS stack every plugin and example composes — the sage-green preset, Wind4, Phosphor icons, DM Sans/Mono fonts, transformers, border preflight, the named z-* layers, and a new shared h-nav navbar-height token. All 15 configs now extend it via mergeConfigs and keep only their own content globs/safelist. Unify the top nav header (icon + title) across every surface: the design.ts nav() helpers and the Vue LayoutToolbar navs all resolve to the shared h-nav height, and data-inspector's divergent header is brought into the canonical icon + title form. --- design/uno.config.ts | 48 ++++++++++++ examples/files-inspector/src/client/design.ts | 2 +- examples/files-inspector/uno.config.ts | 44 +++-------- .../minimal-next-devframe-hub/uno.config.ts | 47 +++--------- .../minimal-vite-devframe-hub/uno.config.ts | 48 +++--------- .../src/client/app/design.ts | 2 +- examples/next-runtime-snapshot/uno.config.ts | 43 +++-------- examples/storybook-hub/uno.config.ts | 48 +++--------- examples/streaming-chat/src/client/design.ts | 2 +- examples/streaming-chat/uno.config.ts | 40 +++------- plugins/a11y/src/spa/design.ts | 2 +- plugins/a11y/uno.config.ts | 55 ++++---------- plugins/code-server/uno.config.ts | 55 ++++---------- .../src/spa/components/AppHeader.vue | 73 ++++++++++-------- plugins/data-inspector/uno.config.ts | 53 ++++--------- plugins/git/src/client/lib/design.ts | 2 +- plugins/git/uno.config.ts | 60 +++++---------- plugins/inspect/src/spa/App.vue | 2 +- plugins/inspect/uno.config.ts | 52 ++++--------- plugins/messages/src/client/App.vue | 2 +- plugins/messages/uno.config.ts | 54 ++++--------- .../src/spa/app/components/ViewerToolbar.vue | 2 +- plugins/og/uno.config.ts | 44 +++-------- plugins/terminals/src/client/design.ts | 2 +- plugins/terminals/uno.config.ts | 75 +++++++------------ storybook/uno.config.ts | 54 ++++--------- 26 files changed, 300 insertions(+), 611 deletions(-) create mode 100644 design/uno.config.ts diff --git a/design/uno.config.ts b/design/uno.config.ts new file mode 100644 index 00000000..56be0669 --- /dev/null +++ b/design/uno.config.ts @@ -0,0 +1,48 @@ +import { presetAnthonyDesign } from '@antfu/design/unocss' +import { + defineConfig, + presetIcons, + presetWebFonts, + presetWind4, + transformerDirectives, + transformerVariantGroup, +} from 'unocss' + +// Shared devframe UnoCSS base. Every plugin and example composes `@antfu/design` +// the same way — its preset (tuned to devframe's sage green) over a Wind4 base, +// Phosphor icons, DM Sans/Mono web fonts, and the directive/variant-group +// transformers — so the surfaces look and feel like one product across +// frameworks. Each app extends this via `mergeConfigs([designConfig, { … }])` +// and contributes only its own extraction globs (and any safelist). +// +// The shared web fonts (`sans`/`mono`), the named `z-*` layers and the `h-nav` +// navbar height live here so every surface shares one font stack, one z-index +// scale and one fixed navbar height. The `@antfu/design` preset blocks plain +// `z-`, so the layers are named on purpose. +export const designConfig = defineConfig({ + presets: [ + presetAnthonyDesign({ primary: '#3a6a45' }), + presetWind4(), + presetIcons({ scale: 1.1 }), + presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), + ], + transformers: [transformerDirectives(), transformerVariantGroup()], + // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle + // shared border color (matching `border-base`) for unqualified borders. + preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], + shortcuts: { + // Fixed navbar height, shared by every surface's top nav. + 'h-nav': 'h-10', + // Named z-index layers, shared across every surface. + 'z-nav': 'z-[30]', + 'z-dropdown': 'z-[40]', + 'z-tooltip': 'z-[45]', + 'z-toast': 'z-[50]', + 'z-modal-backdrop': 'z-[60]', + 'z-modal-content': 'z-[70]', + 'z-drawer-backdrop': 'z-[80]', + 'z-drawer-content': 'z-[90]', + }, +}) + +export default designConfig diff --git a/examples/files-inspector/src/client/design.ts b/examples/files-inspector/src/client/design.ts index 9bedf72a..decc1517 100644 --- a/examples/files-inspector/src/client/design.ts +++ b/examples/files-inspector/src/client/design.ts @@ -80,7 +80,7 @@ export function navTab({ active = false, class: extra }: NavTabProps = {}): stri } export function nav(extra?: string): string { - return cx('flex items-center gap-2 shrink-0 h-10 px-3 border-b border-base bg-base z-nav', extra) + return cx('flex items-center gap-2 shrink-0 h-nav px-3 border-b border-base bg-base z-nav', extra) } export function navBrand(extra?: string): string { diff --git a/examples/files-inspector/uno.config.ts b/examples/files-inspector/uno.config.ts index f6e6ff90..5eff85f7 100644 --- a/examples/files-inspector/uno.config.ts +++ b/examples/files-inspector/uno.config.ts @@ -1,36 +1,12 @@ -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -// This example's Preact SPA uses `@antfu/design` directly for its semantic -// tokens, class vocabulary and Phosphor icons — matching the built-in plugins. -// The named `z-*` layers are the app's to own (the preset blocks plain `z-`). -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', +// This example's Preact SPA composes the shared devframe base (see +// `design/uno.config.ts`) — matching the built-in plugins — and adds only its +// own extraction globs. +export default mergeConfigs([ + designConfig, + { + content: { pipeline: { include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/] } }, }, - content: { pipeline: { include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/] } }, -}) +]) diff --git a/examples/minimal-next-devframe-hub/uno.config.ts b/examples/minimal-next-devframe-hub/uno.config.ts index a1630af3..e5cb5469 100644 --- a/examples/minimal-next-devframe-hub/uno.config.ts +++ b/examples/minimal-next-devframe-hub/uno.config.ts @@ -1,41 +1,18 @@ import { fileURLToPath } from 'node:url' -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -// `@unocss/postcss` (see src/client/postcss.config.mjs) loads this config. -// Absolute globs keep class extraction working regardless of the directory +// The hub UI composes the shared devframe base (see `design/uno.config.ts`). +// `@unocss/postcss` (see src/client/postcss.config.mjs) loads this config; +// absolute globs keep class extraction working regardless of the directory // PostCSS runs in (Next builds from `src/client`). const client = fileURLToPath(new URL('./src/client', import.meta.url)) -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', +export default mergeConfigs([ + designConfig, + { + content: { + filesystem: [`${client}/app/**/*.{ts,tsx}`], + }, }, - content: { - filesystem: [`${client}/app/**/*.{ts,tsx}`], - }, -}) +]) diff --git a/examples/minimal-vite-devframe-hub/uno.config.ts b/examples/minimal-vite-devframe-hub/uno.config.ts index 120a8807..be8319c2 100644 --- a/examples/minimal-vite-devframe-hub/uno.config.ts +++ b/examples/minimal-vite-devframe-hub/uno.config.ts @@ -1,39 +1,13 @@ -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -// The hub UI uses `@antfu/design` directly — its preset (tuned to devframe's -// sage green) over a Wind4 base, Phosphor icons, DM Sans/Mono and the -// directive/variant-group transformers. Pair with `@antfu/design/styles.css` -// (imported in `src/client/main.ts`). The named `z-*` layers are the app's to -// own (the preset blocks plain `z-`). `.ts` is opted into extraction since -// the hub authors its class strings in vanilla `src/client/main.ts`. -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', +// The hub UI composes the shared devframe base (see `design/uno.config.ts`). +// Pair with `@antfu/design/styles.css` (imported in `src/client/main.ts`). `.ts` +// is opted into extraction since the hub authors its class strings in vanilla +// `src/client/main.ts`. +export default mergeConfigs([ + designConfig, + { + content: { pipeline: { include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/] } }, }, - content: { pipeline: { include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/] } }, -}) +]) diff --git a/examples/next-runtime-snapshot/src/client/app/design.ts b/examples/next-runtime-snapshot/src/client/app/design.ts index 9bedf72a..decc1517 100644 --- a/examples/next-runtime-snapshot/src/client/app/design.ts +++ b/examples/next-runtime-snapshot/src/client/app/design.ts @@ -80,7 +80,7 @@ export function navTab({ active = false, class: extra }: NavTabProps = {}): stri } export function nav(extra?: string): string { - return cx('flex items-center gap-2 shrink-0 h-10 px-3 border-b border-base bg-base z-nav', extra) + return cx('flex items-center gap-2 shrink-0 h-nav px-3 border-b border-base bg-base z-nav', extra) } export function navBrand(extra?: string): string { diff --git a/examples/next-runtime-snapshot/uno.config.ts b/examples/next-runtime-snapshot/uno.config.ts index 2499c33c..4f6e6bf8 100644 --- a/examples/next-runtime-snapshot/uno.config.ts +++ b/examples/next-runtime-snapshot/uno.config.ts @@ -1,42 +1,19 @@ import { fileURLToPath } from 'node:url' -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' +// This example composes the shared devframe base (see `design/uno.config.ts`). // `@unocss/postcss` (see src/client/postcss.config.mjs) loads this config; the // absolute glob keeps class extraction working regardless of the directory Next // builds from. The co-located `app/design.ts` (carrying `@unocss-include`) is // covered by the same glob. const client = fileURLToPath(new URL('./src/client', import.meta.url)) -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', +export default mergeConfigs([ + designConfig, + { + content: { + filesystem: [`${client}/app/**/*.{ts,tsx}`], + }, }, - content: { - filesystem: [`${client}/app/**/*.{ts,tsx}`], - }, -}) +]) diff --git a/examples/storybook-hub/uno.config.ts b/examples/storybook-hub/uno.config.ts index 120a8807..be8319c2 100644 --- a/examples/storybook-hub/uno.config.ts +++ b/examples/storybook-hub/uno.config.ts @@ -1,39 +1,13 @@ -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -// The hub UI uses `@antfu/design` directly — its preset (tuned to devframe's -// sage green) over a Wind4 base, Phosphor icons, DM Sans/Mono and the -// directive/variant-group transformers. Pair with `@antfu/design/styles.css` -// (imported in `src/client/main.ts`). The named `z-*` layers are the app's to -// own (the preset blocks plain `z-`). `.ts` is opted into extraction since -// the hub authors its class strings in vanilla `src/client/main.ts`. -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', +// The hub UI composes the shared devframe base (see `design/uno.config.ts`). +// Pair with `@antfu/design/styles.css` (imported in `src/client/main.ts`). `.ts` +// is opted into extraction since the hub authors its class strings in vanilla +// `src/client/main.ts`. +export default mergeConfigs([ + designConfig, + { + content: { pipeline: { include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/] } }, }, - content: { pipeline: { include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/] } }, -}) +]) diff --git a/examples/streaming-chat/src/client/design.ts b/examples/streaming-chat/src/client/design.ts index 9bedf72a..decc1517 100644 --- a/examples/streaming-chat/src/client/design.ts +++ b/examples/streaming-chat/src/client/design.ts @@ -80,7 +80,7 @@ export function navTab({ active = false, class: extra }: NavTabProps = {}): stri } export function nav(extra?: string): string { - return cx('flex items-center gap-2 shrink-0 h-10 px-3 border-b border-base bg-base z-nav', extra) + return cx('flex items-center gap-2 shrink-0 h-nav px-3 border-b border-base bg-base z-nav', extra) } export function navBrand(extra?: string): string { diff --git a/examples/streaming-chat/uno.config.ts b/examples/streaming-chat/uno.config.ts index 3eb3a226..c644da22 100644 --- a/examples/streaming-chat/uno.config.ts +++ b/examples/streaming-chat/uno.config.ts @@ -1,33 +1,11 @@ -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', +// This example's Preact SPA composes the shared devframe base (see +// `design/uno.config.ts`) and adds only its own extraction globs. +export default mergeConfigs([ + designConfig, + { + content: { pipeline: { include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/] } }, }, - content: { pipeline: { include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/] } }, -}) +]) diff --git a/plugins/a11y/src/spa/design.ts b/plugins/a11y/src/spa/design.ts index 7667ef8c..13e7551f 100644 --- a/plugins/a11y/src/spa/design.ts +++ b/plugins/a11y/src/spa/design.ts @@ -80,7 +80,7 @@ export function navTab({ active = false, class: extra }: NavTabProps = {}): stri } export function nav(extra?: string): string { - return cx('flex items-center gap-2 shrink-0 h-10 px-3 border-b border-base bg-base z-nav', extra) + return cx('flex items-center gap-2 shrink-0 h-nav px-3 border-b border-base bg-base z-nav', extra) } export function navBrand(extra?: string): string { diff --git a/plugins/a11y/uno.config.ts b/plugins/a11y/uno.config.ts index 37997dc5..cb712b84 100644 --- a/plugins/a11y/uno.config.ts +++ b/plugins/a11y/uno.config.ts @@ -1,43 +1,18 @@ -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -// The a11y inspector's Solid SPA uses `@antfu/design` directly: its preset (tuned -// to devframe's sage green) over a Wind4 base, with Phosphor icons, DM Sans/Mono -// and the directive/variant-group transformers. The in-page agent bundle -// (src/inject) is deliberately excluded — it inlines its own styles into the host -// document. `.tsx` is scanned by default; `.ts` (the co-located `design.ts` -// helpers) is opted in. -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', - }, - content: { - pipeline: { - include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/], +// The a11y inspector's Solid SPA composes the shared devframe base (see +// `design/uno.config.ts`) and adds only its own extraction globs. The in-page +// agent bundle (src/inject) is deliberately excluded — it inlines its own styles +// into the host document. `.tsx` is scanned by default; `.ts` (the co-located +// `design.ts` helpers) is opted in. +export default mergeConfigs([ + designConfig, + { + content: { + pipeline: { + include: [/\.(?:[cm]?[jt]sx?|html)($|\?)/], + }, }, }, -}) +]) diff --git a/plugins/code-server/uno.config.ts b/plugins/code-server/uno.config.ts index d7985bc9..2929b5ad 100644 --- a/plugins/code-server/uno.config.ts +++ b/plugins/code-server/uno.config.ts @@ -1,44 +1,17 @@ -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -// The code-server launcher is a Vue SPA using `@antfu/design` directly: its -// preset (tuned to devframe's sage green) over a Wind4 base, with Phosphor -// icons, DM Sans/Mono and the directive/variant-group transformers. The SPA and -// Storybook generate CSS from this config. -// -// Vue templates are scanned by default; `.ts` is opted into the extraction -// pipeline for class strings authored in composables/helpers. -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', - }, - content: { - pipeline: { - include: [/\.(?:vue|[cm]?[jt]sx?|html)($|\?)/], +// The code-server launcher composes the shared devframe base (see +// `design/uno.config.ts`) and adds only its own extraction globs. Vue templates +// are scanned by default; `.ts` is opted in for class strings authored in +// composables/helpers. The SPA and Storybook generate CSS from this config. +export default mergeConfigs([ + designConfig, + { + content: { + pipeline: { + include: [/\.(?:vue|[cm]?[jt]sx?|html)($|\?)/], + }, }, }, -}) +]) diff --git a/plugins/data-inspector/src/spa/components/AppHeader.vue b/plugins/data-inspector/src/spa/components/AppHeader.vue index a2922c0a..3f011fc2 100644 --- a/plugins/data-inspector/src/spa/components/AppHeader.vue +++ b/plugins/data-inspector/src/spa/components/AppHeader.vue @@ -1,40 +1,51 @@ diff --git a/plugins/data-inspector/uno.config.ts b/plugins/data-inspector/uno.config.ts index 713eb4b8..52a69844 100644 --- a/plugins/data-inspector/uno.config.ts +++ b/plugins/data-inspector/uno.config.ts @@ -1,42 +1,17 @@ -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -// The inspector uses `@antfu/design` directly: its preset (tuned to devframe's -// sage green) over a Wind4 base, with Phosphor icons, DM Sans/Mono and the -// directive/variant-group transformers. Vue templates are scanned by default; -// `.ts` is opted in for class strings authored in composables/helpers. The -// named `z-*` layers are the app's to own (the preset blocks plain `z-`). -export default defineConfig({ - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', - }, - content: { - pipeline: { - include: [/\.(?:vue|[cm]?[jt]sx?|html)($|\?)/], +// The data inspector composes the shared devframe base (see +// `design/uno.config.ts`) and adds only its own extraction globs. Vue templates +// are scanned by default; `.ts` is opted in for class strings authored in +// composables/helpers. +export default mergeConfigs([ + designConfig, + { + content: { + pipeline: { + include: [/\.(?:vue|[cm]?[jt]sx?|html)($|\?)/], + }, }, }, -}) +]) diff --git a/plugins/git/src/client/lib/design.ts b/plugins/git/src/client/lib/design.ts index 33795fb5..d6dc8ffc 100644 --- a/plugins/git/src/client/lib/design.ts +++ b/plugins/git/src/client/lib/design.ts @@ -80,7 +80,7 @@ export function navTab({ active = false, class: extra }: NavTabProps = {}): stri } export function nav(extra?: string): string { - return cx('flex items-center gap-2 shrink-0 h-10 px-3 border-b border-base bg-base z-nav', extra) + return cx('flex items-center gap-2 shrink-0 h-nav px-3 border-b border-base bg-base z-nav', extra) } export function navBrand(extra?: string): string { diff --git a/plugins/git/uno.config.ts b/plugins/git/uno.config.ts index 1565957e..61a1adfa 100644 --- a/plugins/git/uno.config.ts +++ b/plugins/git/uno.config.ts @@ -1,48 +1,22 @@ import { fileURLToPath } from 'node:url' -import { presetAnthonyDesign } from '@antfu/design/unocss' -import { - defineConfig, - presetIcons, - presetWebFonts, - presetWind4, - transformerDirectives, - transformerVariantGroup, -} from 'unocss' +import { mergeConfigs } from 'unocss' +import { designConfig } from '../../design/uno.config' -// The Git dashboard uses `@antfu/design` directly: its preset (tuned to -// devframe's sage green) over a Wind4 base, with Phosphor icons, DM Sans/Mono and -// the directive/variant-group transformers. `@unocss/postcss` (see -// src/client/postcss.config.mjs) and Storybook both load this config. Absolute -// globs keep class extraction working regardless of the working directory -// PostCSS runs in (Next builds from `src/client`). +// The Git dashboard composes the shared devframe base (see `design/uno.config.ts`). +// `@unocss/postcss` (see src/client/postcss.config.mjs) and Storybook both load +// this config. Absolute globs keep class extraction working regardless of the +// working directory PostCSS runs in (Next builds from `src/client`). const client = fileURLToPath(new URL('./src/client', import.meta.url)) -export default defineConfig({ - content: { - filesystem: [ - `${client}/app/**/*.{ts,tsx}`, - `${client}/components/**/*.{ts,tsx}`, - `${client}/lib/**/*.{ts,tsx}`, - ], +export default mergeConfigs([ + designConfig, + { + content: { + filesystem: [ + `${client}/app/**/*.{ts,tsx}`, + `${client}/components/**/*.{ts,tsx}`, + `${client}/lib/**/*.{ts,tsx}`, + ], + }, }, - presets: [ - presetAnthonyDesign({ primary: '#3a6a45' }), - presetWind4(), - presetIcons({ scale: 1.1 }), - presetWebFonts({ provider: 'none', fonts: { sans: 'DM Sans', mono: 'DM Mono' } }), - ], - transformers: [transformerDirectives(), transformerVariantGroup()], - shortcuts: { - 'z-nav': 'z-[30]', - 'z-dropdown': 'z-[40]', - 'z-tooltip': 'z-[45]', - 'z-toast': 'z-[50]', - 'z-modal-backdrop': 'z-[60]', - 'z-modal-content': 'z-[70]', - 'z-drawer-backdrop': 'z-[80]', - 'z-drawer-content': 'z-[90]', - }, - // Wind4 leaves bare `border`/`border-b` at currentColor; restore the subtle - // shared border color (matching `border-base`) for unqualified borders. - preflights: [{ getCSS: () => '*,::before,::after{border-color:#8882}' }], -}) +]) diff --git a/plugins/inspect/src/spa/App.vue b/plugins/inspect/src/spa/App.vue index f0c97bd4..ed00f290 100644 --- a/plugins/inspect/src/spa/App.vue +++ b/plugins/inspect/src/spa/App.vue @@ -32,7 +32,7 @@ function reload(): void {