You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This file teaches AI coding agents (Claude Code, Cursor, Copilot, Codex, Gemini CLI, and any MCP-compatible client) how to use Roxy UI when integrating RoxyAPI into a project.
4
4
5
-
This file ships inside both`@roxyapi/ui` and `@roxyapi/ui-react` on npm. After install, read it at `node_modules/@roxyapi/ui/AGENTS.md`.
5
+
This file ships inside `@roxyapi/ui`,`@roxyapi/ui-react`, and `@roxyapi/ui-vue` on npm. After install, read it at `node_modules/@roxyapi/ui/AGENTS.md`.
6
6
7
7
Live preview: <https://roxyapi.github.io/ui/>. Source of truth for component types: the combined OpenAPI spec at `https://roxyapi.com/api/v2/openapi.json`, regenerated into `packages/ui/src/types/types.gen.ts`. Per-product specs live at `https://roxyapi.com/api/v2/{slug}/openapi.json`.
8
8
@@ -96,7 +96,7 @@ Use the table below for the formal endpoint to component mapping.
96
96
|`<roxy-forecast-timeline>`| Forecast | POST /forecast/timeline | Date-grouped events across Western, Vedic, and biorhythm domains, weighted by significance |
97
97
|`<roxy-forecast-digest>`| Forecast | POST /forecast/digest | Per-window event counts, domain breakdown, and the highest-significance events |
98
98
|`<roxy-biorhythm-chart>`| Biorhythm | POST /biorhythm/{daily,forecast,critical-days} | Daily bars, forecast cycle lines, critical days |
99
-
|`<roxy-hexagram>`| I Ching | GET /iching/hexagrams/{number}, /iching/cast, POST /iching/daily, /iching/daily/cast | Hexagram with trigrams, judgment, image, changing lines |
99
+
|`<roxy-hexagram>`| I Ching | GET /iching/hexagrams/{number}, /iching/cast, POST /iching/daily, /iching/daily/cast | Hexagram figure with trigrams, judgment, image, and a reading per line (statement plus meaning); a cast highlights the moving lines and the resulting hexagram|
100
100
|`<roxy-crystal-card>`| Crystals | GET /crystals/{id} | Photo, meaning sections, chakra, zodiac, element, hardness, keywords, and pairings |
101
101
|`<roxy-crystal-grid>`| Crystals | GET /crystals, /crystals/chakra/{chakra}, /crystals/element/{element}, /crystals/zodiac/{sign}, /crystals/birthstone/{month}, /crystals/search | Crystal gallery tiles with photo, name, and colour swatches |
102
102
|`<roxy-dream-card>`| Dreams | GET /dreams/symbols/{id} | Symbol name, interpretation body, and letter chip |
@@ -201,7 +201,24 @@ Several components select a view, mode, or chart layout in addition to `data`. T
The full set: `RoxyNatalChart``houseSystem`, `RoxyHoroscopeCard``period`, `RoxyMoonPhase``mode`, `RoxyCompatibilityCard``mode`, `RoxyVedicKundli` and `RoxyDivisionalChart``chartStyle`, `RoxyPanchangTable``detail`, `RoxyDashaTimeline``period`, `RoxyDoshaCard``type`, `RoxyNumerologyCard``type`, `RoxyTarotSpread``spread`, `RoxyBiorhythmChart``mode`, `RoxyHexagram``mode`. Outside React, set the same value as a kebab-case attribute or a JS property on the element (for example `chart-style="south"` or `el.chartStyle = 'south'`).
204
+
The full set: `RoxyNatalChart``houseSystem`, `RoxyHoroscopeCard``period`, `RoxyMoonPhase``mode`, `RoxyCompatibilityCard``mode`, `RoxyVedicKundli` and `RoxyDivisionalChart``chartStyle`, `RoxyPanchangTable``detail`, `RoxyDashaTimeline``period`, `RoxyDoshaCard``type`, `RoxyNumerologyCard``type`, `RoxyTarotSpread``spread`, `RoxyBiorhythmChart``mode`, `RoxyHexagram``mode`. Outside React and Vue, set the same value as a kebab-case attribute or a JS property on the element (for example `chart-style="south"` or `el.chartStyle = 'south'`).
205
+
206
+
### 6c. Vue and Nuxt
207
+
208
+
`@roxyapi/ui-vue` exposes the same components with the same prop names. Bind `data` and the config props normally; the package sets them as DOM properties for you, so an object payload never gets stringified into an attribute. Listen to widget events with the usual `@` syntax.
209
+
210
+
```vue
211
+
<script setup lang="ts">
212
+
import { RoxyVedicKundli, RoxyLocationSearch } from '@roxyapi/ui-vue';
In Nuxt, render these in a client context (`<ClientOnly>` or a `.client.vue` component): they mount Custom Elements and need the DOM, the same constraint as `'use client'` in the Next.js App Router.
205
222
206
223
### 7. Local response interface drift
207
224
@@ -451,8 +468,8 @@ When listing domains in user-visible copy, use the canonical order: Western astr
451
468
452
469
## What not to ship
453
470
454
-
- Do not bundle `@roxyapi/ui`and`@roxyapi/ui-react`together; they ship independently.
455
-
- Use `@roxyapi/ui-react` for React projects. Use `@roxyapi/ui` directly elsewhere.
471
+
- Do not bundle `@roxyapi/ui`with`@roxyapi/ui-react`or `@roxyapi/ui-vue`; they ship independently.
472
+
- Use `@roxyapi/ui-react` for React projects and `@roxyapi/ui-vue` for Vue and Nuxt projects. Use `@roxyapi/ui` directly elsewhere.
456
473
- Do not write your own kundli component. The lifted layout in `<roxy-vedic-kundli>` is the canonical RoxyAPI render path.
457
474
- Do not call astrology endpoints with hardcoded coordinates. Always geocode first via `<roxy-location-search>` or `roxy.location.searchCities()`.
458
475
- Do not declare a local `interface XyzData` to describe a RoxyAPI response. Import the type from the spec-derived bundle: `import type { XyzResponse } from '@roxyapi/sdk'`. Local interfaces drift the moment the spec changes.
<imgsrc="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/hexagram-light.png"alt="Hexagram with trigrams, judgment, image, changing lines">
199
+
<imgsrc="https://raw.githubusercontent.com/RoxyAPI/ui/main/assets/screenshots/hexagram-light.png"alt="Hexagram figure with trigrams, judgment, image, and a reading for every line">
@@ -268,6 +268,24 @@ export function Chart({ data }: { data: NatalChart }) {
268
268
}
269
269
```
270
270
271
+
Vue users get the same typed surface.
272
+
273
+
```bash
274
+
npm install @roxyapi/ui-vue
275
+
```
276
+
277
+
```vue
278
+
<script setup lang="ts">
279
+
import { RoxyNatalChart } from '@roxyapi/ui-vue';
280
+
281
+
defineProps<{ data: NatalChart }>();
282
+
</script>
283
+
284
+
<template>
285
+
<RoxyNatalChart :data="data" />
286
+
</template>
287
+
```
288
+
271
289
## Quick start
272
290
273
291
```ts
@@ -298,6 +316,24 @@ Serialize with the shipped helper, never a bare `JSON.stringify`. `@roxyapi/ui`
298
316
299
317
Load the bundle once anywhere on the page. It registers every `roxy-*` element and loads the design tokens, so every component on the page renders themed, in light or dark, from that single tag. Nothing else to add.
300
318
319
+
### No-JavaScript fallback
320
+
321
+
The two modes degrade differently, and only one of them can be rescued.
322
+
323
+
**Controlled mode** (the `<script class="roxy-data">` island above) already holds the reading in the page. Render it server-side as ordinary HTML alongside the island and put that markup *inside* the element. Components render into a shadow root and none of them expose a `<slot>`, so light-DOM children are painted only while the element is un-upgraded, and disappear the moment the bundle registers it. You get the server HTML without JavaScript and the live component with it, from the same markup, with no flash of both.
324
+
325
+
**Form mode** (`data-endpoint` + a `pk_` key) is a self-fetch widget: it cannot work without JavaScript, because there is nothing to render until the visitor submits the form. Give it a light-DOM fallback that says so and links out.
@@ -624,7 +661,7 @@ Set `ROXY_API_KEY` to your secret key in your server env for the server-side SDK
624
661
|`<roxy-forecast-timeline>`| Forecast | POST /forecast/timeline | Date-grouped events across Western, Vedic, and biorhythm domains, weighted by significance |
625
662
|`<roxy-forecast-digest>`| Forecast | POST /forecast/digest | Per-window event counts, domain breakdown, and the highest-significance events |
626
663
|`<roxy-biorhythm-chart>`| Biorhythm | POST /biorhythm/{daily,forecast,critical-days} | Daily bars, forecast cycle lines, critical days |
627
-
|`<roxy-hexagram>`| I Ching | GET /iching/hexagrams/{number}, /iching/cast, POST /iching/daily, /iching/daily/cast | Hexagram with trigrams, judgment, image, changing lines |
664
+
|`<roxy-hexagram>`| I Ching | GET /iching/hexagrams/{number}, /iching/cast, POST /iching/daily, /iching/daily/cast | Hexagram figure with trigrams, judgment, image, and a reading per line (statement plus meaning); a cast highlights the moving lines and the resulting hexagram|
628
665
|`<roxy-crystal-card>`| Crystals | GET /crystals/{id} | Photo, meaning sections, chakra, zodiac, element, hardness, keywords, and pairings |
629
666
|`<roxy-crystal-grid>`| Crystals | GET /crystals, /crystals/chakra/{chakra}, /crystals/element/{element}, /crystals/zodiac/{sign}, /crystals/birthstone/{month}, /crystals/search | Crystal gallery tiles with photo, name, and colour swatches |
630
667
|`<roxy-dream-card>`| Dreams | GET /dreams/symbols/{id} | Symbol name, interpretation body, and letter chip |
@@ -673,7 +710,7 @@ roxy-natal-chart {
673
710
674
711
## Built for AI agents
675
712
676
-
[`AGENTS.md`](AGENTS.md) is bundled inside both npm packages. Once installed, agents can read it from `node_modules/@roxyapi/ui/AGENTS.md` (or `@roxyapi/ui-react/AGENTS.md`) for the component decision tree, integration patterns, and rules.
713
+
[`AGENTS.md`](AGENTS.md) is bundled inside every npm package. Once installed, agents can read it from `node_modules/@roxyapi/ui/AGENTS.md` (or `@roxyapi/ui-react/AGENTS.md`, `@roxyapi/ui-vue/AGENTS.md`) for the component decision tree, integration patterns, and rules.
677
714
678
715
- Works with Claude Code, Cursor, Copilot, Codex, Gemini CLI, and any MCP-compatible client.
679
716
- Component decision tree maps each RoxyAPI endpoint to the component that renders its response.
@@ -732,7 +769,7 @@ Persist the choice in `localStorage` from your own code; the components do not o
732
769
<details>
733
770
<summary><strong>How big is each component? What is the bundle cost?</strong></summary>
734
771
735
-
Per-component bundles run 9-21 KB gzipped, capped at 30 KB by CI. The full bundle (every component, helpers, base styles, and the inlined design tokens) stays well under the 150 KB CI cap, around 85 KB gzipped today. The React package loads the runtime on mount, so a route that renders one chart pays for one component, not the whole catalog. Pin a concrete version in production for byte-stable cache hits.
772
+
Per-component bundles run 9-21 KB gzipped, capped at 30 KB by CI. The full bundle (every component, helpers, base styles, and the inlined design tokens) stays well under the 150 KB CI cap, around 85 KB gzipped today. The React and Vue packages load the runtime on mount, so a route that renders one chart pays for one component, not the whole catalog. Pin a concrete version in production for byte-stable cache hits.
0 commit comments