SPB Git

Repository Public License

DESIGN.md 16.7 KB 258 lines markdown

1# Lunar Glass — the ORIX Navigator design system23`LunarDesign` (`Packages/NavigatorKit/Sources/LunarDesign`) is the design system of ORIX Navigator on macOS, iOS and4iPadOS. Its visual identity is called **Lunar Glass**: an obsidian window, a floating translucent capsule bar, thin5orbital rings, and planets that stand for workspaces. Cosmic but sober; luxurious, legible, recognisable at a glance.67The module depends on SwiftUI and AppKit/UIKit only. It does not import `NavigatorCore`.89> **About the original mockups.** The concept images from the owner's conversation were **not available** when this10> system was built. Nothing here was traced from them. The reference renders in `DesignSystem/reference/` are native11> mockups drawn from the written specification with the real components; they are the visual target for the real12> screens until the owner confirms or corrects them against the original concepts.1314## 1. Principles15161. **The page is the subject.** Chrome floats above and around the web content and gets out of its way. The web area17   is always the dominant surface.182. **Glass is for chrome and controls only.** Never behind the body text of a page, never as a full-window effect.193. **Depth by layering, not by weight.** Hairlines, a top highlight and soft low-opacity shadows. No thick borders,20   no hard corners, no heavy shadows.214. **Space, quietly.** Orbital rings are one point thin. The starfield is sparse, slow and optional. Colour is used22   for meaning (accent, workspace tint, status), not decoration.235. **Themes are data.** A view never names a colour: it reads a semantic role from the theme in the environment.246. **Accessible by construction.** Contrast is computed and tested; state never relies on colour alone; every control25   has a label, a focus ring and a minimum hit target.2627## 2. Tokens2829Source of truth: `Sources/LunarDesign/Tokens/`. Exported for other tools as `DesignSystem/tokens.json`30(`LunarTokenDocument.current`); a test fails if the file drifts from the code.3132| Token | Values |33|---|---|34| Core palette (`LunarPalette`) | Obsidian `#080B15`, Midnight `#101522`, Lunar Slate `#171F35`, Silver `#E6EAFA`, Spectral Violet `#927ADB`, Lunar Blue `#9BAEFF`, Aurora Mint `#75DFC9` |35| Grid | 4 pt (`LunarSpacing.unit`) |36| Spacing (`LunarSpacing`) | `xs` 8, `sm` 12, `md` 16, `lg` 24, `xl` 32 |37| Radii (`LunarRadius`, `LunarShape`) | `xs` 10, `sm` 16, `md` 22, `lg` 28, `xl` 36, plus `.capsule` and `.circle`; corners are continuous |38| Strokes (`LunarStroke`) | hairline 1 (1.5 under Increase Contrast), focus ring 2, orbital ring 1 |39| Metrics (`LunarMetrics`) | touch target 44 (iOS), pointer target 28 (macOS), control height 36 / 28 compact, bar height 44 |40| Elevation (`LunarElevation`) | `flat` (no shadow), `raised` (radius 10, y 3), `floating` (radius 24, y 10); shadow alpha ≤ 0.42 dark, 0.16 light |41| Type (`LunarTextStyle`) | display, title, title2, headline, body, bodyEmphasized, callout, subheadline, footnote, caption, overline, mono |42| Motion (`LunarMotion`) | `quick` 0.18 s, `snappy` 0.28 s, `smooth` 0.42 s, `gentle` 0.62 s spring responses, damping 0.86–1.0 |4344Typography is SF Pro through system text styles (`.lunarFont(_:)`), so every role follows Dynamic Type; `mono` is45SF Mono. Numbers that update or align use tabular digits (`.lunarTabularDigits()`). Icons are SF Symbols or the46proprietary glyphs below.4748Colours are stored as `LunarRGBA` (plain sRGB numbers, `Sendable`, `Codable`, hex parsing, WCAG luminance and49contrast). `LunarRGBA` is a `ShapeStyle`: pass it straight to `foregroundStyle`, `fill`, `stroke`.5051## 3. Themes5253Twelve families (`LunarThemes.all`), each a `LunarThemeFamily` with a designed **dark** and a designed **light**54`LunarTheme`. The light renditions are their own palettes (lunar white fields, silver chrome, deep slate accents), not55inversions. The family `id` is the stable string to persist; never rename a shipped id.5657| id | Name | Dark accent | Light accent | Mood |58|---|---|---|---|---|59| `lunar` (default) | Lunar | `#9BAEFF` | `#3D54C8` | Obsidian night, silver light, lunar blue |60| `obsidian` | Obsidian | `#C9D2F5` | `#2A3350` | Near-black volcanic glass, pale silver |61| `aurora` | Aurora | `#75DFC9` | `#086B5A` | Polar night, mint and ice blue |62| `eclipse` | Eclipse | `#FFB26B` | `#94480A` | Warm black, amber corona |63| `silver` | Silver | `#C4CCDE` | `#4A5570` | Graphite and cool metal |64| `nebula` | Nebula | `#C58BEF` | `#7B3DB8` | Violet dust, magenta light |65| `ocean` | Ocean | `#5CB8F0` | `#0E67A8` | Abyssal blue |66| `solar` | Solar | `#F4C56A` | `#8A5E00` | Dark amber and gold |67| `forest` | Forest | `#6CC48A` | `#24703E` | Moss, pine, night air |68| `rose` | Rose | `#F28DB2` | `#B5306A` | Dusk pink over plum |69| `monochrome` | Monochrome | `#FFFFFF` | `#111111` | No hue: ink, paper, greys |70| `high-contrast` | High Contrast | `#B8CCFF` | `#0A2E9E` | Pure black/white fields, AAA text, strong borders |7172Semantic roles of a `LunarTheme`: `windowBackground`, `windowBackgroundDeep`, `chromeSurface`, `elevatedSurface`,73`sunkenSurface`, `glassTint`, `hairline`, `hairlineStrong`, `textPrimary`, `textSecondary`, `textTertiary`, `accent`,74`accentSecondary`, `onAccent`, `success`, `warning`, `danger`, `selection`, `focusRing`, `glow`, `orbitRings` (three,75innermost first), `orbitCore`, `star`, `shadow`, and `tints` (one colour per `LunarTint`).7677`LunarTint` has exactly the ten workspace cases (`lunarBlue`, `spectralViolet`, `auroraMint`, `silver`, `solar`,78`rose`, `ocean`, `forest`, `ember`, `nebula`); the app maps its own workspace tint with79`LunarTint(rawValue: tint.rawValue)`.8081```swift82// At the root of each scene. Follows the colour scheme and the Increase Contrast setting.83ContentView().lunarTheme(LunarThemes.family(id: storedThemeID))84// or force an appearance85ContentView().lunarTheme(LunarThemes.aurora, appearance: .dark)8687// In any view88@Environment(\.lunarTheme) private var theme89Text("Hello").foregroundStyle(theme.textPrimary)90```9192### Contrast guarantees (tested)9394`ThemeTests` computes WCAG 2 contrast for all 24 renditions **and** their Increase Contrast renditions, against every95surface text may sit on (window, deep window, chrome, elevated, sunken):9697- primary text ≥ 4.5:1 (≥ 7:1 in High Contrast);98- secondary text ≥ 4.5:1 (≥ 7:1 in High Contrast); tertiary text ≥ 3:1;99- accent, secondary accent, success, warning, danger, focus ring, orbit core and all ten tints ≥ 3:1;100- accent ≥ 4.5:1 on window, chrome and elevated surfaces (it is used as text); text on an accent fill ≥ 4.5:1;101- primary text ≥ 4.5:1 and accent ≥ 3:1 on the selection fill.102103Palettes were adjusted until these passed; thresholds were not lowered.104105## 4. Materials and the Liquid Glass policy106107One modifier draws every glass surface:108109```swift110view.lunarGlass(.capsule, style: .chrome, elevation: .floating, interactive: false, tint: nil)111```112113| Condition | What is drawn |114|---|---|115| OS 26 and later | Liquid Glass: `glassEffect(Glass.regular.tint(…).interactive(…), in: shape)`, behind `if #available(macOS 26.0, iOS 26.0, *)` |116| macOS 15 / iOS 18 | `.thinMaterial` (`.regularMaterial` for `.dense`) + theme tint + top highlight |117| Reduce Transparency, or `lunarRenderMode == .snapshot` | Opaque `chromeSurface` / `elevatedSurface` + top highlight |118| Always | Luminous hairline (brighter at the top edge) and the soft elevation shadow |119120Rules:121122- Glass styles: `.chrome` (bars, sidebars, docks, panels), `.control` (buttons, chips, selected tabs), `.dense`123  (banners, toasts: must stay readable over arbitrary web content).124- **Never** behind page body text. Content that carries reading text inside a panel goes on an opaque `LunarCard`.125- No permanent expensive blur: only system materials and `glassEffect`, which the system composites and caches; no126  `.blur()` on live content, no full-window material.127- `interactive: true` only on tappable surfaces.128- The shadow never exceeds the `floating` elevation.129130## 5. Iconography131132All drawn in code on a fixed grid, resolution independent (`Sources/LunarDesign/Icons/`).133134- **ORIX Navigator mark** — `LunarMarkView` (full colour, themed) and `LunarMarkShape` (single colour): an orbital135  ring around a core with a navigation needle, and a satellite on the ring. Geometry in `LunarMarkGeometry`136  (100-unit grid), mirrored by the app icon script.137- **Module glyphs** — `LunarGlyph` (24-unit grid, one stroke weight of 1.7, at most a couple of solid accents):138  `command`, `orbit`, `split`, `agent`, `memory`, `ghost`, `time`, `canvas`, `blink`, `lens`, `shield`, `archive`,139  `morph`, `reader`, `dev`, `flow`, `capsule`, `bridge`, `media`, `focus`. Use `LunarGlyphView(_:size:label:)` or140  `LunarGlyphShape`. Tests check that each glyph renders, stays in its box, has sensible coverage at 16 pt and141  differs from every other glyph on a 16 × 16 grid. See `DesignSystem/reference/glyphs--lunar-*.png`.142- `LunarIcon` (`.symbol("name")` or `.glyph(.orbit)`) is what components take; SF Symbols cover generic actions.143144## 6. Component catalogue145146Every component is themed, labelled for assistive technologies, draws the Lunar focus ring when it has keyboard147focus, and keeps a 44 pt hit target on iOS (28 pt on macOS) through `lunarHitTarget()`.148149| Component | API | Notes |150|---|---|---|151| Glass surface | `.lunarGlass(_:style:elevation:interactive:tint:)` | see §4 |152| Hairline, shadow | `.lunarHairline(_:)`, `.lunarShadow(_:)`, `LunarHairline(_ axis)` | |153| Window field | `LunarWindowBackground()` | the theme gradient |154| Capsule bar | `LunarCapsuleBar { … }` | floating toolbar / omnibox container |155| Icon button | `LunarIconButton(_:label:style:isActive:diameter:action:)` | styles `.plain`, `.glass`, `.accent`; tooltip = label |156| Chip | `LunarChip(_:icon:isOn:)`, `LunarChip(_:icon:isSelected:action:)` | pill toggle |157| Buttons | `.buttonStyle(.lunar(.primary / .secondary / .destructive, size:fullWidth:))` | sizes compact, regular, large |158| Press feedback | `LunarPressStyle()` | for custom tappable content |159| Text field | `LunarTextField(_:text:icon:)`, `.lunarField(_:isFocused:)` | modifier styles any `TextField` / `SecureField` |160| Search field | `LunarSearchField(text:prompt:leading:accessory:)` | base of the omnibox; attach `.onSubmit` |161| List row | `LunarListRow(_:subtitle:icon:isSelected:action:trailing:)` | also custom leading/trailing |162| Section header | `LunarSectionHeader(_:actionTitle:action:)` | header trait |163| Card | `LunarCard(padding:shape:elevation:) { … }` | opaque: may hold body text |164| Badge | `LunarBadge(_:status:icon:)` | `LunarStatus`: neutral, accent, success, warning, danger |165| Progress | `LunarProgressBar(value:label:)`, `LunarProgressRing(value:label:size:)` | `nil` = indeterminate; frozen under Reduce Motion |166| Label | `LunarLabel(_:icon:help:)` | tooltip + accessibility hint from one string |167| Empty / error state | `LunarEmptyState(icon:title:message:actionTitle:action:)`, `LunarErrorState(title:message:retryTitle:retry:)` | |168| Banner, toast | `LunarBanner(_:title:message:actionTitle:action:onDismiss:)`, `LunarToast(_:status:)` | dense glass |169| Sheet header | `LunarSheetHeader(_:subtitle:icon:onClose:)` | |170| Segmented control | `LunarSegmentedControl(_:selection:segments:)` with `LunarSegment` | gliding thumb |171| Slider | `LunarSlider(_:value:in:step:)` | arrow keys; VoiceOver through a native `Slider` representation |172| Toggle | `Toggle(…).toggleStyle(.lunar)` | I/O marks under Differentiate Without Colour |173| Tab chip | `LunarTabChip(title:favicon:tint:isSelected:isPinned:isLoading:audio:layout:onSelect:onClose:onToggleMute:)` | horizontal pill or vertical row; monogram fallback (`LunarMonogram`) |174| Planet, satellite | `LunarPlanet(tint:size:isActive:hasRing:)`, `LunarSatelliteChip(_:tint:isActive:count:action:)` | workspaces |175| Key caps | `LunarKeyCap(_:)`, `LunarShortcut("⌘K")` | read as "Command K" |176| Orbital rings | `LunarOrbitRings(count:squash:tilt:)`, `LunarOrbitRings.radiusFraction(ring:of:)` | skeleton of the Orbit view |177| Starfield | `LunarStarfield(density:showsOrbits:isAnimated:)` | optional backdrop, see §7 |178| Gallery | `LunarGallery()`, `LunarGalleryContent(layout:)` | every token, theme and component |179180SwiftUI previews exist for buttons, fields, containers, feedback, controls, tabs, starfield and the gallery.181182## 7. Motion183184- Springs only (`LunarMotion`), so every animation is interruptible and retargetable. Use185  `.lunarAnimation(_:value:)` and `.lunarTransition(anchor:)`; transitions are geometric (scale + fade from an anchor,186  `matchedGeometryEffect` for the segmented thumb).187- **Reduce Motion**: springs become a 0.14 s fade, press scaling is dropped, indeterminate progress shows a static188  segment, the starfield draws one frame and never schedules another.189- **Starfield cost control**: 12 fps `TimelineView`, half-resolution `Canvas` scaled up, asynchronous rendering,190  paused when off screen and when the window or scene is inactive (`controlActiveState` on the Mac, `scenePhase` on191  iOS). Do not add a second animated full-window canvas.192- Haptics: `LunarHaptics.play(.selection / .lightImpact / .mediumImpact / .success / .warning / .error)` on iPhone;193  trackpad alignment feedback on the Mac where an equivalent exists.194195## 8. Accessibility196197| Setting | Behaviour |198|---|---|199| Dynamic Type | all text uses system text styles |200| Reduce Motion | see §7 |201| Reduce Transparency | every glass surface becomes an opaque theme surface |202| Increase Contrast | `lunarTheme(_ family:)` switches to `theme.increasedContrast` (stronger secondary text, hairlines 1.5 pt and darker, stronger selection); the High Contrast theme is also available as a choice |203| Differentiate Without Colour | active icon buttons get an underline, selected chips a check mark, selected rows and tabs a bar, status badges a symbol, the switch I/O marks |204| VoiceOver | labels on every control; `.isSelected`, `.isHeader`, `.updatesFrequently` traits; tab state in the accessibility value ("Pinned, Loading, Playing audio"); decorative glyphs hidden |205| Keyboard (Mac) | custom focus ring (`lunarFocusRing`), arrow keys on the slider |206| Hit targets | 44 pt on iOS, 28 pt on macOS |207208## 9. Do / Don't209210**Do**211212- read colours from `@Environment(\.lunarTheme)`; use spacing and radius tokens;213- put chrome on `lunarGlass`, reading text on `LunarCard` or the window field;214- give every icon-only control a `label`;215- use `LunarTint` for workspaces and `LunarStatus` for meaning.216217**Don't**218219- hard-code a hex value or a `Color` in a feature view;220- put glass behind page text or stack glass on glass more than one level deep;221- add borders thicker than a hairline, sharp corners, or shadows heavier than `floating`;222- animate with fixed-duration curves, or ignore Reduce Motion;223- reorder or rename `LunarTint` cases or theme ids (they are persisted).224225## 10. Reference renders, icon and how to regenerate226227| Output | Path |228|---|---|229| Gallery (Lunar, Aurora, Solar × dark, light) | `DesignSystem/reference/gallery--<theme>-<variant>.png` |230| Mac main window | `DesignSystem/reference/mac-window--<theme>-<variant>.png` |231| iPhone | `DesignSystem/reference/iphone--<theme>-<variant>.png` |232| iPad | `DesignSystem/reference/ipad--<theme>-<variant>.png` |233| Orbit view | `DesignSystem/reference/orbit--<theme>-<variant>.png` |234| New-tab page | `DesignSystem/reference/new-tab--<theme>-<variant>.png` |235| Glyph sheet (16 / 24 / 48 pt) | `DesignSystem/reference/glyphs--lunar-<variant>.png` |236| Tokens | `DesignSystem/tokens.json` |237| App icon masters | `DesignSystem/AppIcon/AppIcon-1024.png`, `AppIcon-iOS-1024{,-dark,-tinted}.png` |238| Asset catalogs | `DesignSystem/AppIcon/macOS/AppIcon.appiconset`, `DesignSystem/AppIcon/iOS/AppIcon.appiconset` |239240```sh241scripts/render-design-reference.sh              # gallery + mockups + tokens.json242scripts/render-design-reference.sh --tokens     # tokens.json only243scripts/render-design-reference.sh --icon       # app icon (same as: swift scripts/make-icon.swift)244scripts/render-design-reference.sh --all        # everything245scripts/render-design-reference.sh --all --isolated   # build LunarDesign alone, if another module does not compile246```247248How the renders are made, and their limits:249250- The mockups live in the **test target** (`Tests/LunarDesignTests/ReferenceMockups.swift`) and are built from the251  real components. Their page titles, counts and the neutral page placeholder are fixtures that exist only there.252- They are drawn offscreen with `ImageRenderer` in `lunarRenderMode == .snapshot`. `ImageRenderer` cannot capture253  live materials, Liquid Glass or platform text fields, so the renders show the **opaque glass fallback** (the254  Reduce Transparency look) and static text in fields. On a device, chrome is translucent; layout, colour, type and255  iconography are otherwise the same.256- The app icon is drawn by `scripts/make-icon.swift` with CoreGraphics, every size from vectors. The iOS images are257  opaque (no alpha channel); the macOS images use the rounded-tile grid with a transparent margin. No text.258
Files main
Menu

Theme