Skip to content

Commit 334a872

Browse files
committed
feat: practitioner audit pass, North-default kundli, theme docs, mobile polish
Round of practitioner-audit fixes against the canonical Vedic + Western references plus the blind-test friction report. - Vedic kundli default flipped to North, tab order North/South/East. Match matrimonial + Hindi-belt market expectation. South kundli cells now show house numbers next to the sign abbr; East cells gain a house-number badge in the same pattern. Centre label case unified to D1 Rashi sentence case. - Natal chart: angle markers ASC, DSC, MC, IC, PoF, Vtx render at the tip of the tick arrow. Stellium-aware angular fan-out for tight conjunctions with a thin leader line back to the planet's true position on the rim. - Synastry: per-planet tooltip carries degree, sign, retrograde; visible degree label beside each glyph; person index subscript so the two rings read in monochrome; Asc1 and Asc2 markers derived from person ascendants. - Dasha timeline: now indicator inside the active mahadasha bar at the fractional position; birth dasha balance line; collapsed details for the active period interpretation. - Panchang: tithi now shows paksha qualifier; Next transitions section surfaces tithi, nakshatra, yoga, karana end times. - Choghadiya: current period highlighted with outline glow and Now badge. - Ashtakavarga: collapsed 7 heat tokens to a single base hue, opacity mix per tier. Fixes Sarva totals 20-40 painting solid red and lets text follow --roxy-fg cleanly in both themes. - Mobile container queries on natal SVG text and bhinna table cells so 320 px viewports stay readable; bhinna scroll mask hints overflow. - Base styles: font-variant-emoji: text on :host to keep Unicode planet glyphs monochrome across macOS, iOS, Android, Windows. - README quick-start path replaced silent-401 import.meta.env reference with explicit YOUR_API_KEY; added Vedic kundli vanilla HTML alongside natal; surfaced the envelope-unwrap rule; theme switcher moved to FAQ. - AGENTS.md: theming and dark mode table at the top of the rules.
1 parent f1e7927 commit 334a872

117 files changed

Lines changed: 1818 additions & 667 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ test-results/
4949
/screenshot*.png
5050
/*.tmp
5151
/*.log
52+
refs/
5253

5354
# Stale tsc declaration emit alongside source. tsc is configured to emit into
5455
# dist/, but past misconfig left .d.ts siblings of .ts files in src/. Ignore so

AGENTS.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,38 @@ export default function BirthChartView({ data }: { data: unknown }) {
319319
}
320320
```
321321

322+
## Theming and dark mode
323+
324+
Components react to three signals in priority order. No events to dispatch. No JS bridge to write.
325+
326+
| Signal | Where | Effect |
327+
|---|---|---|
328+
| `prefers-color-scheme: dark` | OS | Default. Follows user system setting. |
329+
| `data-theme="light"` or `data-theme="dark"` | `<html>` / `<body>` / any ancestor / the component itself | Wins over OS. Per-element override scope works. |
330+
| `.dark` class | Any ancestor | Equivalent to `data-theme="dark"`. Use when the host stack already ships a `.dark` toggle (Tailwind, shadcn). |
331+
332+
To toggle at runtime:
333+
334+
```ts
335+
document.documentElement.dataset.theme = 'dark'; // or 'light'
336+
```
337+
338+
That single line re-themes every Roxy UI component on the page. Persist user choice in `localStorage` from your own code; the library does not own preferences.
339+
340+
Per-element scope is supported:
341+
342+
```html
343+
<roxy-natal-chart data-theme="dark" .data=${chart}></roxy-natal-chart>
344+
```
345+
346+
Every visible aspect of the chart is driven by `--roxy-*` CSS custom properties on `:host`. Override any token on `:root`, on `:host`, or per element. Do not write Tailwind utility classes inside the components; the Shadow DOM boundary stops them at the door.
347+
322348
## Rules every agent must follow
323349

324350
- Always call `/location/search` first before any chart endpoint that takes latitude, longitude, or timezone. Use `<roxy-location-search>` for the input UI.
325351
- Pass the response object directly. Components are stateless; they do not fetch internally except for `<roxy-location-search>`, `<roxy-endpoint-form>`, and the widgets auto-mount script.
326352
- Use the typed SDK from `@roxyapi/sdk` so prop shapes match the spec automatically.
327-
- Theming is CSS custom properties on `:root` or per element. Do not write Tailwind classes inside the components; the shadow DOM ignores them.
353+
- Theming is CSS custom properties on `:root` or per element. Switch light and dark via `data-theme` on any ancestor (see the table above). Do not write Tailwind classes inside the components; the shadow DOM ignores them.
328354
- Honor reduced motion. The library already respects `prefers-reduced-motion: reduce` and the `--roxy-motion-duration` variable.
329355
- A11y violations are CI failures. Do not paste over `role` or `aria-*` attributes; the components emit them correctly already.
330356
- Component types come from the OpenAPI spec via `@hey-api/openapi-ts`. Do not redefine response shapes locally; if a field is missing, fix the spec, regenerate, propagate.

README.md

Lines changed: 115 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,39 @@ Light, dark, your brand. Override one CSS variable and every component updates.
7676
}
7777
```
7878

79-
Pick a tone, set the vars, every chart and card follows. Full token reference at [THEMING.md](https://github.com/RoxyAPI/ui/blob/main/packages/ui/THEMING.md). Live tweaker on the [demo site](https://roxyapi.github.io/ui/).
79+
Pick a tone, set the vars, every chart and card follows. Full token reference at [THEMING.md](https://github.com/RoxyAPI/ui/blob/main/packages/ui/THEMING.md). Live tweaker on the [demo site](https://roxyapi.github.io/ui/). See the [FAQ](#faq) for switching between light and dark at runtime.
8080

81-
## Gallery (chart-heavy components)
81+
## Gallery
82+
83+
Every chart, table, and card adapts to light and dark automatically. Hover any image on GitHub to inspect tooltips.
84+
85+
### Western astrology
8286

8387
<table>
8488
<tr>
89+
<td width="50%"><strong>Natal chart</strong> · <code>&lt;roxy-natal-chart&gt;</code><br><sub>POST /astrology/natal-chart</sub><br>
90+
<picture>
91+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/natal-chart-dark.png">
92+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/natal-chart-light.png" alt="Natal chart wheel with 14 planets, real house cusps, IC DC Part of Fortune Vertex, aspect lines">
93+
</picture>
94+
</td>
8595
<td width="50%"><strong>Synastry</strong> · <code>&lt;roxy-synastry-chart&gt;</code><br><sub>POST /astrology/synastry</sub><br>
8696
<picture>
8797
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/synastry-chart-dark.png">
88-
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/synastry-chart-light.png" alt="Synastry dual-wheel with inter-aspects">
98+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/synastry-chart-light.png" alt="Synastry dual-wheel with inter-aspects table">
99+
</picture>
100+
</td>
101+
</tr>
102+
</table>
103+
104+
### Vedic astrology
105+
106+
<table>
107+
<tr>
108+
<td width="50%"><strong>Vedic kundli</strong> · <code>&lt;roxy-vedic-kundli&gt;</code><br><sub>POST /vedic-astrology/birth-chart</sub><br>
109+
<picture>
110+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/vedic-kundli-dark.png">
111+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/vedic-kundli-light.png" alt="Vedic kundli D1 rashi chart, South Indian style with Lagna marker">
89112
</picture>
90113
</td>
91114
<td width="50%"><strong>KP chart</strong> · <code>&lt;roxy-kp-chart&gt;</code><br><sub>POST /vedic-astrology/kp/chart</sub><br>
@@ -99,27 +122,60 @@ Pick a tone, set the vars, every chart and card follows. Full token reference at
99122
<td width="50%"><strong>Divisional chart</strong> · <code>&lt;roxy-divisional-chart&gt;</code><br><sub>POST /vedic-astrology/divisional-chart</sub><br>
100123
<picture>
101124
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/divisional-chart-dark.png">
102-
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/divisional-chart-light.png" alt="Vedic divisional chart D9 navamsa wheel">
125+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/divisional-chart-light.png" alt="D2 to D60 varga chart, D9 navamsa shown">
103126
</picture>
104127
</td>
105-
<td width="50%"><strong>Dasha timeline</strong> · <code>&lt;roxy-dasha-timeline&gt;</code><br><sub>POST /vedic-astrology/dasha/&lbrace;current,major,sub&rbrace;</sub><br>
128+
<td width="50%"><strong>Ashtakavarga grid</strong> · <code>&lt;roxy-ashtakavarga-grid&gt;</code><br><sub>POST /vedic-astrology/ashtakavarga</sub><br>
106129
<picture>
107-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/dasha-timeline-dark.png">
108-
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/dasha-timeline-light.png" alt="Vimshottari dasha mahadasha and antardasha timeline">
130+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/ashtakavarga-grid-dark.png">
131+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/ashtakavarga-grid-light.png" alt="Ashtakavarga sarva and bhinna bindu heatmap">
109132
</picture>
110133
</td>
111134
</tr>
112135
<tr>
113-
<td width="50%"><strong>Ashtakavarga grid</strong> · <code>&lt;roxy-ashtakavarga-grid&gt;</code><br><sub>POST /vedic-astrology/ashtakavarga</sub><br>
136+
<td width="50%"><strong>Dasha timeline</strong> · <code>&lt;roxy-dasha-timeline&gt;</code><br><sub>POST /vedic-astrology/dasha/&lbrace;current,major,sub&rbrace;</sub><br>
114137
<picture>
115-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/ashtakavarga-grid-dark.png">
116-
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/ashtakavarga-grid-light.png" alt="Ashtakavarga sarva and bhinna bindu heatmap">
138+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/dasha-timeline-dark.png">
139+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/dasha-timeline-light.png" alt="Vimshottari mahadasha and antardasha timeline with progress bars">
140+
</picture>
141+
</td>
142+
<td width="50%"><strong>Shadbala table</strong> · <code>&lt;roxy-shadbala-table&gt;</code><br><sub>POST /vedic-astrology/shadbala</sub><br>
143+
<picture>
144+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/shadbala-table-dark.png">
145+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/shadbala-table-light.png" alt="Six-fold planetary strength bars with rupas and adequacy badges">
117146
</picture>
118147
</td>
148+
</tr>
149+
</table>
150+
151+
### Other domains
152+
153+
<table>
154+
<tr>
119155
<td width="50%"><strong>Tarot spread</strong> · <code>&lt;roxy-tarot-spread&gt;</code><br><sub>POST /tarot/spreads/&lbrace;three-card,celtic-cross,love&rbrace;</sub><br>
120156
<picture>
121157
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/tarot-spread-dark.png">
122-
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/tarot-spread-light.png" alt="Tarot spread with three-card layout and reading">
158+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/tarot-spread-light.png" alt="Three-card tarot spread with position labels and reading">
159+
</picture>
160+
</td>
161+
<td width="50%"><strong>Biorhythm</strong> · <code>&lt;roxy-biorhythm-chart&gt;</code><br><sub>POST /biorhythm/&lbrace;daily,forecast,critical-days&rbrace;</sub><br>
162+
<picture>
163+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/biorhythm-chart-dark.png">
164+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/biorhythm-chart-light.png" alt="Physical, emotional, intellectual cycle bars">
165+
</picture>
166+
</td>
167+
</tr>
168+
<tr>
169+
<td width="50%"><strong>I Ching hexagram</strong> · <code>&lt;roxy-hexagram&gt;</code><br><sub>GET /iching/hexagrams/&lbrace;number&rbrace;, /iching/cast</sub><br>
170+
<picture>
171+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/hexagram-dark.png">
172+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/hexagram-light.png" alt="Hexagram with trigrams, judgment, image, changing lines">
173+
</picture>
174+
</td>
175+
<td width="50%"><strong>Numerology</strong> · <code>&lt;roxy-numerology-card&gt;</code><br><sub>POST /numerology/&lbrace;life-path,expression,personal-year,chart&rbrace;</sub><br>
176+
<picture>
177+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/numerology-card-dark.png">
178+
<img src="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/numerology-card-light.png" alt="Life path number card with archetype, keywords, and interpretation">
123179
</picture>
124180
</td>
125181
</tr>
@@ -138,7 +194,7 @@ Tables, cards, forms, and helper components in the [live demo](https://roxyapi.g
138194

139195
## Start with one component
140196

141-
Vanilla HTML. Three lines. No build step.
197+
Vanilla HTML. No build step. Replace `YOUR_API_KEY` with a publishable key from <https://roxyapi.com/account>.
142198

143199
```html
144200
<script
@@ -149,15 +205,31 @@ Vanilla HTML. Three lines. No build step.
149205
<roxy-natal-chart id="chart"></roxy-natal-chart>
150206
<script type="module">
151207
import { createRoxy } from 'https://cdn.jsdelivr.net/npm/@roxyapi/sdk@latest/dist/factory.js';
152-
const roxy = createRoxy(import.meta.env?.ROXY_API_KEY);
208+
const roxy = createRoxy('YOUR_API_KEY');
153209
const { data } = await roxy.astrology.generateNatalChart({
154210
body: { date: '1990-01-15', time: '14:30:00', latitude: 28.6139, longitude: 77.209, timezone: 5.5 },
155211
});
156212
document.getElementById('chart').data = data;
157213
</script>
158214
```
159215

160-
Then add the kundli, the panchang, the dasha timeline, the tarot spread.
216+
> **Unwrap `data` before passing to the component.** The SDK returns `{ data, error, request, response }`. Pass the envelope and the chart renders `[object Object]`. This is the most common integration bug.
217+
218+
Want a Vedic kundli instead? Same shape, different SDK method:
219+
220+
```html
221+
<roxy-vedic-kundli id="kundli" chart-style="south"></roxy-vedic-kundli>
222+
<script type="module">
223+
import { createRoxy } from 'https://cdn.jsdelivr.net/npm/@roxyapi/sdk@latest/dist/factory.js';
224+
const roxy = createRoxy('YOUR_API_KEY');
225+
const { data } = await roxy.vedicAstrology.generateBirthChart({
226+
body: { date: '1990-01-15', time: '14:30:00', latitude: 19.07, longitude: 72.88, timezone: 5.5 },
227+
});
228+
document.getElementById('kundli').data = data;
229+
</script>
230+
```
231+
232+
In production, geocode the user's city with `<roxy-location-search>` (see [Quick start](#quick-start)) instead of hardcoding coordinates.
161233

162234
## Install
163235

@@ -500,6 +572,35 @@ Roxy UI runs in any framework that supports the DOM: **React, Next.js, Vue, Svel
500572

501573
## FAQ
502574

575+
<details>
576+
<summary><strong>How do I switch between light and dark mode?</strong></summary>
577+
578+
No events. No JavaScript bridge. Components read three CSS signals in priority order:
579+
580+
1. **`prefers-color-scheme`**: follows the operating system by default. Ship nothing, get correct behaviour.
581+
2. **`data-theme="dark"` or `data-theme="light"`** on any ancestor (typically `<html>` or `<body>`). Wins over system preference.
582+
3. **`.dark` class** on any ancestor. Equivalent to `data-theme="dark"`. Useful when the host stack already toggles a `.dark` class (Tailwind, shadcn).
583+
584+
```ts
585+
// Toggle on click. No imports from this library needed.
586+
document.documentElement.dataset.theme =
587+
document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
588+
```
589+
590+
```ts
591+
// React: bind theme to component state.
592+
useEffect(() => {
593+
document.documentElement.dataset.theme = theme;
594+
}, [theme]);
595+
```
596+
597+
Persist the choice in `localStorage` from your own code; the components do not own user preferences. Per-element overrides also work, so one chart can run in dark on an otherwise light page:
598+
599+
```html
600+
<roxy-natal-chart data-theme="dark" .data=${chart}></roxy-natal-chart>
601+
```
602+
</details>
603+
503604
<details>
504605
<summary><strong>How big is each component? What is the bundle cost?</strong></summary>
505606

25 KB
Loading
29.6 KB
Loading
30.6 KB
Loading

0 commit comments

Comments
 (0)