Skip to content

feat(emerald): Paper design system foundation — Phase 0#167

Draft
johnleider wants to merge 17 commits intomasterfrom
feat/emerald-paper-design-system
Draft

feat(emerald): Paper design system foundation — Phase 0#167
johnleider wants to merge 17 commits intomasterfrom
feat/emerald-paper-design-system

Conversation

@johnleider
Copy link
Copy Markdown
Member

Summary

  • Reworks Paper styling composables to output utility classes instead of inline CSS variables — cleaner, no runtime overhead, normal CSS specificity
  • Implements 3 reference Emerald components (EmButton, EmTextField, EmDialog) that establish the conventions for all future Paper DS component development
  • Adds Emerald design token definitions (colors, typography, borders, shadows) extracted from Juan's Figma spec
  • Adds .claude/rules/paper-components.md contract with 5 concrete patterns for building Paper DS components

Paper Composable Rework

All 6 composables (useBorder, useSpacing, useDimensions, useRounded, useElevation, useColor) now return utility class arrays. V0Paper applies via :class instead of :style.

Reference Components

Component Pattern Sub-components
EmButton Root with V0Paper Content, Prepend, Append, Loader
EmTextField Wrapping v0 compound (Input) Control, Label, Description, Error, Prepend, Append
EmDialog Renderless v0 root Content (V0Paper), Activator, Title, Description, Close

Design Tokens

Complete Emerald token system: primary (purple), secondary (slate), success/warning/error/info semantics, Manrope typography (6 sizes), border radius/width scales, 6 shadow elevations.

Test plan

  • pnpm typecheck — all 3 packages pass
  • pnpm lint:fix — clean
  • pnpm test:run — 88 files, 3921 tests passing
  • pnpm repo:check — knip + sherif clean
  • Manual review of reference component patterns
  • Verify token values match Juan's Figma spec (border radius/shadow values estimated)

…t stubs

New package at packages/emerald/ with Em-prefixed component stubs
(EmButton, EmCard, EmDialog, etc.) extending V0Paper for styling
primitives. Divider, Flex, and Grid use bare Atom.
Defines the must/may/must-not contract for Paper design system
components and the build pipeline (spec → implement → review).
Key decisions: props → utility classes for styling, data attributes
for state, named slots become components, explicit v-model re-exposure.
Paper composables now return class string arrays instead of CSS
variable style objects. V0Paper applies via :class instead of :style.
SCSS simplified to base reset — utility classes handle all styling.

Color utility functions (hexToRgba, etc.) extracted to color-utils.ts
and re-exported for consumers who need runtime color parsing.
First reference component establishing Paper DS conventions:
- Root with V0Paper, sub-components as plain elements
- Props forwarded to V0Paper via v-bind spread
- Data attributes for state styling (disabled, loading)
- Explicit event re-exposure, no $attrs forwarding
- Sub-components: EmButtonContent, EmButtonPrepend,
  EmButtonAppend, EmButtonLoader
Second reference component. Demonstrates:
- Wrapping v0 compound component (Input.Root + sub-components)
- V0Paper on root, raw v0 primitives on Control/Description/Error
- DS-specific sub-components (Label, Prepend, Append)
- Explicit v-model re-exposure for input value
- Form validation integration via Input.Root props
Third reference component. Demonstrates:
- Wrapping v0 behavioral compound component (Dialog)
- Root is renderless — no V0Paper wrapper needed
- EmDialogContent gets V0Paper for independent styling
  (elevation, rounded, background on the dialog panel)
- Explicit v-model for open/close state
- Event re-exposure (cancel, close)
Contract now includes 5 concrete patterns with real code from the
reference components. Removed Phase 0 TODOs — composable rework is
done (utility classes, not inline styles). Added patterns for:
renderless v0 roots, sub-component wrapping, slot prop forwarding,
naming conventions, and styling guidelines.
Defines the complete Emerald token system extracted from Juan's Figma:
- Brand: primary (purple #7C5CF6), secondary (slate #94A3B8)
- Semantics: success, warning, error, info with 11-step luminosity
- Surfaces: background (#FAF9FF), surface (#F5F4FF)
- Border: radius scale (8 steps), width scale (6 steps)
- Shadows: 6 elevation levels
- Typography: Manrope, 6 sizes (xs-2xl) with weights/line-heights
- Icons: Phosphor Icons (Regular)
No longer imported after composable rework — composables no longer
need component names for CSS variable scoping.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 26, 2026

Open in StackBlitz

commit: 154654b

Orchestrates v0 plugin installation with Emerald defaults:
- Theme with Emerald color palette
- Locale (default: en)
- Logger, Storage, Hydration

All plugins installed by default with Emerald defaults.
User options override, set to false to disable.

Usage:
  app.use(createEmeraldPlugin())
  app.use(createEmeraldPlugin({ theme: { default: 'dark' } }))
  app.use(createEmeraldPlugin({ locale: false }))
Batteries-included documentation DS with 34 component stubs:

Shell: AppBar, AppNav, AppMain, AppFooter, AppBanner
Navigation: NavLink, Breadcrumbs, PageNavigator
Content: CodeBlock, Callout, ApiTable, ApiCard, Toc, Example,
  ExampleCode, Faq, FaqItem, HeaderAnchor, Card, Mermaid
Interactive: Search, CopyCommand, BackToTop
Utility: Icon, IconButton, Link, Divider, Switch, Chip,
  CloseButton, Kbd, Skeleton, LoaderIcon, ProgressBar

Includes token system (colors, z-index, easing, durations,
shadows, typography, border-radius) and createCodexPlugin
for one-line setup with v0 sub-plugins.
Ported from docs site with Paper DS conventions:

Content:
- CxCallout (tip/info/warning/error with config)
- CxHeaderAnchor (heading with anchor link)
- CxCard (hoverable, linkable, disableable)
- CxFaq + CxFaqItem (accordion FAQ via v0 ExpansionPanel)
- CxCopyCommand (command pill with clipboard copy)
- CxCodeBlock stub (pending Shiki integration)

Indicators:
- CxProgressBar (ARIA progressbar with fill animation)
- CxSkeleton (loading placeholder with pulse animation)
- CxLoaderIcon (spinner/dots/wave/orbit variants)
- CxBackToTop (scroll-aware visibility via v0 event listeners)

Utility:
- CxKbd (keyboard shortcut styling)

Composable:
- useClipboard (clipboard API wrapper with auto-reset)
Utility: CxDivider, CxChip, CxCloseButton, CxLink, CxSwitch
Icons: CxIcon (slot-based), CxIconButton (V0Paper button)
Navigation: CxBreadcrumbs (v0 Breadcrumbs), CxPageNavigator (prev/next)

All stripped of docs-specific coupling. CxBreadcrumbs accepts
generic items array, CxPageNavigator accepts prev/next link objects.
CxLink auto-detects external URLs. CxSwitch wraps v0 Switch compound.
App Shell:
- CxAppBar (fixed header), CxAppNav (sidebar with mobile toggle),
  CxAppMain (responsive content area), CxAppFooter (inset-aware),
  CxAppBanner (top announcement bar)

Navigation:
- CxNavLink (tree item with expand/collapse, depth indentation)

Documentation Content:
- CxToc (table of contents with active state)
- CxCodeBlock (code display with copy, line numbers, Shiki slot)
- CxExampleCode (peek/expand code pane with fade gradient)
- CxExample (preview + code container)
- CxApiTable (prop/event/slot reference table)
- CxApiCard (individual API item card)
- CxSearch (dialog shell wrapping v0 Dialog)
- CxMermaid (diagram container with figcaption)

All 34 codex components now implemented. All stripped of
docs-specific coupling — generic, composable containers.
@johnleider johnleider marked this pull request as draft March 31, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant