import { css, html, LitElement, nothing } from 'lit'; import { customElement, property } from 'lit/decorators.js'; import { PLANET_GLYPH, SIGN_GLYPH } from '../tokens/index.js'; import type { TransitsResponse } from '../types/index.js'; import { baseStyles } from '../utils/base-styles.js'; import { formatDate, formatNumber, formatTime } from '../utils/format.js'; import { capitalize } from '../utils/string.js'; /** * Transit positions and aspect table. Pass `data` from /astrology/transits. * When natalChart is included in the request, `data.transitAspects` and * `data.summary` are present and rendered automatically. */ @customElement('roxy-transits-table') export class RoxyTransitsTable extends LitElement { static styles = [ baseStyles, css` .wrap { display: grid; gap: var(--roxy-space-md, 1rem); } .head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--roxy-space-md, 1rem); flex-wrap: wrap; } .title { font-size: var(--roxy-text-lg, 1.125rem); font-weight: var(--roxy-weight-bold, 600); margin: 0; } .subtitle { color: var(--roxy-muted, #71717a); font-size: var(--roxy-text-sm, 0.875rem); margin: 0; } .summary-pills { display: flex; flex-wrap: wrap; gap: var(--roxy-space-sm, 0.5rem); } .pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px var(--roxy-space-sm, 0.5rem); border-radius: var(--roxy-radius-full, 9999px); font-size: var(--roxy-text-xs, 0.75rem); font-weight: var(--roxy-weight-bold, 600); border: 1px solid currentColor; } .pill--muted { color: var(--roxy-fg, #0a0a0a); background: color-mix(in srgb, var(--roxy-border, #e4e4e7) 60%, transparent); } .pill--success { color: var(--roxy-success-fg, #166534); background: color-mix(in srgb, var(--roxy-success, #16a34a) 10%, transparent); } .pill--danger { color: var(--roxy-danger-fg, #991b1b); background: color-mix(in srgb, var(--roxy-danger, #dc2626) 10%, transparent); } table { width: 100%; border-collapse: collapse; font-size: var(--roxy-text-sm, 0.875rem); } th, td { padding: var(--roxy-space-sm, 0.5rem); border-bottom: 1px solid var(--roxy-border, #e4e4e7); text-align: left; } th { color: var(--roxy-muted, #71717a); font-weight: var(--roxy-weight-bold, 600); text-transform: uppercase; font-size: var(--roxy-text-xs, 0.75rem); letter-spacing: 0.06em; } .section-label { font-size: var(--roxy-text-xs, 0.75rem); color: var(--roxy-muted, #71717a); text-transform: uppercase; letter-spacing: 0.06em; font-weight: var(--roxy-weight-bold, 600); margin: 0 0 var(--roxy-space-xs, 0.25rem) 0; } .glyph { font-size: 1.1em; margin-right: 2px; line-height: 1; } .planet-cell { display: flex; align-items: center; gap: 4px; white-space: nowrap; } .retro-badge { display: inline-block; font-size: 0.7em; padding: 1px 4px; border-radius: var(--roxy-radius-sm, 4px); background: color-mix(in srgb, var(--roxy-warning, #ea580c) 12%, transparent); color: var(--roxy-warning-fg, #9a3412); font-weight: var(--roxy-weight-bold, 600); margin-left: 2px; vertical-align: middle; } .speed { font-variant-numeric: tabular-nums; color: var(--roxy-muted, #71717a); white-space: nowrap; } .speed-arrow { font-size: 0.85em; } td.num { font-variant-numeric: tabular-nums; color: var(--roxy-muted, #71717a); } .overflow-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; } .aspect-card { border: 1px solid var(--roxy-border, #e4e4e7); border-radius: var(--roxy-radius-md, 8px); padding: var(--roxy-space-sm, 0.5rem) var(--roxy-space-md, 1rem); margin-bottom: var(--roxy-space-xs, 0.25rem); } .aspect-card summary { cursor: pointer; font-weight: 500; color: var(--roxy-fg, #0a0a0a); display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; } .aspect-card summary .meta { color: var(--roxy-muted, #71717a); font-weight: 400; font-size: var(--roxy-text-xs, 0.75rem); margin-left: auto; font-variant-numeric: tabular-nums; } .aspect-card .interp-body { margin-top: var(--roxy-space-xs, 0.25rem); color: var(--roxy-fg, #0a0a0a); font-size: var(--roxy-text-sm, 0.875rem); line-height: 1.45; } .aspect-card .interp-body p { margin: 0 0 var(--roxy-space-xs, 0.25rem); } .interp-keywords { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.5rem; } .interp-keywords .kw { padding: 1px 8px; border-radius: 9999px; background: color-mix(in srgb, var(--roxy-accent, #f59e0b) 14%, transparent); color: var(--roxy-accent-fg, #b45309); font-size: var(--roxy-text-xs, 0.75rem); } .nature-badge { display: inline-block; padding: 1px 8px; border-radius: 9999px; font-size: var(--roxy-text-xs, 0.75rem); font-weight: 600; } .nature-badge.harmonious { background: color-mix(in srgb, var(--roxy-success, #16a34a) 12%, transparent); color: var(--roxy-success-fg, #166534); } .nature-badge.challenging { background: color-mix(in srgb, var(--roxy-danger, #dc2626) 12%, transparent); color: var(--roxy-danger-fg, #991b1b); } .nature-badge.neutral { background: color-mix(in srgb, var(--roxy-border, #e4e4e7) 60%, transparent); color: var(--roxy-fg, #0a0a0a); } `, ]; @property({ attribute: false }) data: TransitsResponse | null = null; render() { if (!this.data?.transitPlanets?.length) { return html`
${dateStr}
` : nothing}Planet positions
Transit aspects
| Planet | Sign | Degree | Speed |
|---|---|---|---|
|
${p.name}
${
p.isRetrograde
? html`R`
: nothing
}
|
${p.sign}
|
${formatNumber(p.degree, 2)} | ${formatNumber(Math.abs(p.speed), 4)} |
${interp.summary}
` : nothing} ${interp?.impact ? html`Impact: ${interp.impact}
` : nothing} ${interp?.timing ? html`Timing: ${interp.timing}
` : nothing} ${interp?.guidance ? html`Guidance: ${interp.guidance}
` : nothing} ${ interp?.keywords?.length ? html`