Skip to content

v0.2.0 — Foundations token system

Latest

Choose a tag to compare

@emmanuel-defreitas emmanuel-defreitas released this 10 May 02:19
· 2 commits to main since this release
e24a486

Replaces the v0.1.0 marker namespace with a real Foundations token system.

What's new

  • 8 token categories reachable via Spectrum.{color, spacing, typography, motion, elevation, radius, opacity, sizing}.
  • 4 SwiftUI-native value types: SpectrumColor (ShapeStyle-conforming), SpectrumFont, SpectrumDuration, SpectrumElevation. All Equatable + Sendable.
  • Theme + ThemeOverrides with builder API; built-in .light / .dark.
  • SwiftUI Environment integration: \.spectrumTheme, View.spectrumTheme(_:), View.spectrumFont(_:), Animation.spectrum(_:reduceMotion:).
  • Real generator (SPM command plugin) emitting 326 tokens from the Adobe Spectrum JSON snapshot (adobe/spectrum-design-data commit c970c1e4adbc):
    • 19 color families × ~16 shades = 301 adaptive palette colors
    • 15 spacing tokens, 10 corner-radius tokens
    • Idempotent: re-running produces zero diff
  • 5 categories hand-curated by design (Adobe doesn't publish them in a generator-ready form): typography, motion, elevation, opacity, sizing — each documented as such in source headers.
  • Accessibility: every typography token carries a Font.TextStyle anchor for Dynamic Type pickup; every motion token has a reduced-motion variant.
  • 40 / 40 tests covering color-scheme adaptation, theme override, sibling-isolation, Dynamic Type metadata, reduce-motion, and traceability.

Breaking changes from v0.1.0

  • SpectrumUIFoundations no longer exposes the moduleName constant. Use the Spectrum.* namespace instead. Pre-1.0.0 versioning permits this break per the constitution.

What's not yet shipped

  • Atoms, molecules, and icons remain v0.1.0 marker namespaces. Their real APIs come in subsequent releases.
  • Image-snapshot baselines for token rendering (deferred — needs review tooling).
  • A programmatic generator-idempotency XCTest (manual md5sum check is in place).

Use it

.package(url: "https://github.com/Mannydefreitas7/SpectrumUI.git", from: "0.2.0")
import SwiftUI
import SpectrumUIFoundations

Text("Hello")
    .spectrumFont(Spectrum.typography.headingM)
    .foregroundStyle(Spectrum.color.text.body)
    .padding(Spectrum.spacing.s400)
    .background(Spectrum.color.background.layer1,
                in: .rect(cornerRadius: Spectrum.radius.s500))

Full PR: #2