@ubio/design
v1.3.0
Published
Ubio Design System: styles, palette and components
Keywords
Readme
Ubio Design System
Ubio's styles, palette, logos and components.
npm i @ubio/designPrimeVue 4, @primeuix/themes and Font Awesome 7 are peers; npm installs them with it.
<!-- index.html, first in <head>: the cascade order; the app's own layers, if any, go after `ubio` -->
<style>@layer nightshade, nightshade-docs, nightshade-components, primevue, fontawesome, ubio;</style>
<!-- Ubio's faces, Source Sans 3 and Source Code Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500&family=Source+Sans+3:ital,wght@0,300..700;1,300..700&display=swap" />/* the app's CSS entry */
@import '@ubio/design/stylesheets';import { UbioDesign } from '@ubio/design';
app.use(UbioDesign);<!-- the app's root component, last: tooltips and popups teleport here -->
<div id="overlays" />- The stylesheet brings the tokens, the palette, Font Awesome (don't import it again), PrimeVue's sizes, the heading ladder and the utilities, all in cascade layers, weakest first:
nightshade, nightshade-docs, nightshade-components, primevue, fontawesome, ubio. The app's CSS needs no layer: unlayered, it beats the design system. The order goes first inindex.html, because in dev a component's styles can load before the CSS entry and the first@layerseen sets the order. UbioDesigninstalls PrimeVue on Ubio's preset with its toast, confirmation and dialog services ({ primevue: false }to do it yourself), registersv-tooltip, and takes the app's loading glyph ({ loader: 'hu' }, drawn byLoaderand every loading state).- Components are imported as in any Vue app (
import Button from 'primevue/button',import { MainPanel } from '@ubio/design'). Optionally,autoImportComponents()from@ubio/design/vitedoes it at compile time where templates use them; that is all it does. - Controls are PrimeVue's: buttons, fields, selects, menus, dialogs, tables. Layout (
HGroup,VGroup,Filler), tooltips and everything else Ubio's frontends share are Ubio's, from@ubio/design.
| Import | What it is |
|--------|------------|
| @ubio/design | the components (layout, panels, charts, chat, DataExplorer, the marks and loaders), UbioDesign, the tooltip helpers |
| @ubio/design/components | the components alone |
| @ubio/design/directives | tooltip(), tooltipCode() and vTooltip |
| @ubio/design/code-editor | CodeEditor and JsonEditor, on CodeMirror 6, loaded lazily; install the @codemirror/* peers to use it |
| @ubio/design/primevue | UbioPrimeVuePreset and ubioPrimeVueConfig, for apps that install PrimeVue themselves |
| @ubio/design/vite | autoImportComponents(), optional: Ubio's and PrimeVue's components imported where templates use them |
| @ubio/design/resolver | UbioResolver, for unplugin-vue-components, if you set that up yourself |
| @ubio/design/stylesheets | the tokens, the palette, Font Awesome, Ubio's :root, the heading ladder, utilities and the .Markdown prose styles |
What's here
| Path | What it is |
|------|------------|
| palette.json | the palette spec: one ramp per tone, on Ubio's own lightness and chroma curves; primary is the brand indigo |
| stylesheets/palette.css | generated from the spec; never edit it by hand |
| stylesheets/root.css | Ubio's :root: faces, 14px body, display steps 32/48px, radius, control font sizes |
| stylesheets/utilities.css | text classes: .page-title, .section-title, .subtitle, .empty-hint, .text-num, .cell-num |
| stylesheets/markdown.css | .Markdown: rendered Markdown, and shiki's CSS-variables theme on the palette |
| stylesheets/index.css | the tokens, Font Awesome, the palette, then Ubio's :root, heading ladder and utilities. Cascade order, weakest first: nightshade, nightshade-docs, nightshade-components, primevue, fontawesome, ubio |
| stylesheets/type.css | h1–h6 on the type scale, in the ubio layer |
| stylesheets/primevue.css | PrimeVue's sizes from the size context, in the ubio layer; index.css imports it |
| stylesheets/code-editor.css | CodeMirror's elements inside CodeEditor; unlayered, the one exception, because CodeMirror's own styles are |
| src/primevue/ | the PrimeVue preset: Aura's colors remapped to Ubio's ramps and roles |
| src/directives/ | tooltip helpers over vTooltip |
| src/plugin.ts | UbioDesign, the Vue plugin |
| src/resolver/ | UbioResolver; components.ts lists every component, and the type check fails when one is missing |
| src/layers.ts | Ubio's cascade layers, which the stylesheet and PrimeVue state |
| src/vite/ | autoImportComponents(), the optional Vite plugin for apps |
| src/components/ | Ubio's components, including layout (HGroup, VGroup, Filler) and tooltips |
| src/code-editor/ | CodeEditor and JsonEditor, a separate entry so CodeMirror stays optional |
| logos/ | the marks, in SVG and PNG (@ubio/design/logos/*); also the docs site's public files |
| docs/ | the documentation site |
| vite.config.mts | the library build: src to dist, one module per file, each component with its own CSS, and types |
Scripts
Development needs Node 22.12 or later (.nvmrc), for the palette CLI.
npm run devThe docs site, live: every component, both schemes, the variable reference. It regenerates the palette first. GitHub Pages serves it at https://ubio.github.io/design/.
npm run paletteRegenerates stylesheets/palette.css from palette.json. The docs scripts run it first, and npm version runs it and adds the result to the version commit.
npm run buildBuilds dist/, which is what the package ships: @ubio/design, /components, /directives and /primevue resolve there. The stylesheets ship as they are. The docs read src directly.
npm run tokensChecks the CSS for tier and token drift. npm version runs it, and the docs build, before it bumps.
npm run typecheckType-checks src, the components' templates and scripts included (vue-tsc). npm version runs it too.
Growing the system
- A component: add it to
src/components/, export it fromindex.ts, list it insrc/resolver/components.ts(the type check fails until you do), give it a page underdocs/components/and a link indocs/.vitepress/config.ts. Its page ends with a table of its--<Component>-*defaults: how it's written, not a restyle API. A look an app needs is a prop and a modifier class (SplitView ruled), never an instruction to set a variable. The variables page lists tokens only. - A tone: add a ramp to
palette.jsonand runnpm run palette. Every control takestone="<name>". - A look change: set raw values in
stylesheets/root.css, or change the PrimeVue preset insrc/primevue/. Never copy a component's CSS to change one value. - The landing's showcase:
docs/.vitepress/theme/components/HomeShowcase.vue.
AGENTS.md carries the rules for coding agents.
Releasing
npm version minornpm version checks tokens and types, and builds the library and the docs, before it bumps. It then publishes @ubio/design and pushes the commit and tag. Use major, minor or patch.
