import { css, html, nothing } from 'lit'; import { customElement } from 'lit/decorators.js'; // Registers , reused below as the wheel renderer. The // relocation response is structurally a natal chart (same planets, houses, and // angles), so the wheel is shared rather than duplicated. import './natal-chart.js'; import { PLANET_GLYPH } from '../tokens/index.js'; import type { NatalChartResponse, RelocationChartResponse, } from '../types/index.js'; import { RoxyDataElement } from '../utils/base-element.js'; import { baseStyles } from '../utils/base-styles.js'; import { capitalize } from '../utils/string.js'; type HouseChange = RelocationChartResponse['changes']['planetsChangedHouse'][number]; const glyphFor = (name: string): string => PLANET_GLYPH[capitalize(name)] ?? PLANET_GLYPH[name] ?? ''; /** * Relocation chart. The birth instant is unchanged, so every planet keeps its * natal sign and degree while the houses and angles are recomputed for a new * place. Reuses {@link RoxyNatalChart} for the wheel (identical data shape) and * adds the relocation read: the move geometry, the planets that change house, * and the bodies pulled onto a relocated angle. */ @customElement('roxy-relocation-wheel') export class RoxyRelocationWheel extends RoxyDataElement { static styles = [ baseStyles, css` .stack { display: grid; gap: var(--roxy-space-md, 1rem); } .changes { background: var(--roxy-surface, #fff); color: var(--roxy-fg, #0a0a0a); border: 1px solid var(--roxy-border, #e4e4e7); border-radius: var(--roxy-radius-md, 8px); padding: var(--roxy-space-lg, 1.5rem); box-shadow: var(--roxy-shadow-sm); display: grid; gap: var(--roxy-space-md, 1rem); } .title { font-size: var(--roxy-text-lg, 1.125rem); font-weight: var(--roxy-weight-bold, 600); margin: 0; color: var(--roxy-primary, #0f172a); } .move { display: flex; flex-wrap: wrap; gap: var(--roxy-space-xs, 0.25rem) var(--roxy-space-md, 1rem); font-size: var(--roxy-text-sm, 0.875rem); color: var(--roxy-muted, #71717a); } .summary { font-size: var(--roxy-text-sm, 0.875rem); color: var(--roxy-fg, #0a0a0a); margin: 0; } .block-label { font-size: var(--roxy-text-xs, 0.75rem); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--roxy-muted, #71717a); margin: 0 0 var(--roxy-space-xs, 0.25rem); } .chips { display: flex; flex-wrap: wrap; gap: var(--roxy-space-xs, 0.25rem); } .chip { padding: 2px 10px; border-radius: var(--roxy-radius-full, 9999px); font-size: var(--roxy-text-xs, 0.75rem); background: color-mix(in srgb, var(--roxy-accent, #f59e0b) 16%, transparent); color: var(--roxy-fg, #0a0a0a); } .moves-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; } .moves-list li { font-size: var(--roxy-text-sm, 0.875rem); color: var(--roxy-fg, #0a0a0a); } .moves-list .arrow { color: var(--roxy-muted, #71717a); } .empty-note { font-size: var(--roxy-text-sm, 0.875rem); color: var(--roxy-muted, #71717a); margin: 0; } `, ]; protected renderEmpty() { return html`
No relocation data
`; } protected renderData(data: RelocationChartResponse) { const c = data.changes; return html`

What changes at this location

${ typeof c?.distanceKm === 'number' ? html`${Math.round(c.distanceKm).toLocaleString()} km ${c.direction ?? ''} of birthplace` : nothing } ${ c ? html`Ascendant ${c.ascendantSignChanged ? 'changes sign' : 'keeps its sign'}` : nothing }
${ data.interpretation?.summary ? html`

${data.interpretation.summary}

` : nothing } ${ c?.angularPlanets?.length ? html`

Angular planets here

${c.angularPlanets.map((p) => html`${glyphFor(p)} ${p}`)}
` : nothing }

Planets that change house

${ c?.planetsChangedHouse?.length ? html`
    ${c.planetsChangedHouse.map( (m: HouseChange) => html`
  • ${glyphFor(m.planet)} ${m.planet}: house ${m.natalHouse} to ${m.relocatedHouse}
  • `, )}
` : html`

No planet changes house at this location.

` }
`; } } declare global { interface HTMLElementTagNameMap { 'roxy-relocation-wheel': RoxyRelocationWheel; } }