[Phase 1] Implement ChartDemo component and demo data#105
Merged
afucher merged 5 commits intodoc-websitefrom Mar 30, 2026
Merged
[Phase 1] Implement ChartDemo component and demo data#105afucher merged 5 commits intodoc-websitefrom
afucher merged 5 commits intodoc-websitefrom
Conversation
- Add `src/data/demoData.ts` with defaultRadixData (15 planets + 12 cusps)
and defaultTransitData for transit/animate examples
- Rewrite ChartDemo.astro with updated props: id, height (default 500),
mode ('radix'|'transit'|'animate'), showCode (default true)
- Animate mode renders a 'Start Animation' button wired to transit.animate()
- Inline <script> loads /astrochart.js on demand and initialises chart
based on mode, using demoData passed via define:vars
- Collapsible <details> code snippet auto-generated per mode
- <noscript> fallback included
- Add website/public/astrochart.js (UMD bundle served to browser)
- Add src/content/docs/test-demo.md testing all modes and props
- Website builds cleanly (25 pages); root lib build + 86 tests all pass
🤖 Generated with [eca](https://eca.dev)
Co-Authored-By: eca <git@eca.dev>
Three bugs fixed: 1. Rename test-demo.md → test-demo.mdx Astro/Starlight only processes component imports (MDX syntax) in .mdx files. The .md file was printing the import statement as plain text and not rendering any <ChartDemo> tags. 2. Fix planet key names in demoData.ts The library recognises NNode/SNode/Fortune; the data used the non-existent keys NorthNode, SouthNode, Vertex which caused the validate() call inside Radix to silently skip those planets and could throw on malformed data shapes. 3. Fix multi-instance script loading race condition With 5 ChartDemo instances on one page, all inline scripts ran simultaneously and each tried to inject /astrochart.js. Replace with a shared __astrochartQueue pattern: the first instance creates the script tag and flushes the queue on load; subsequent instances detect the in-flight tag and push their initChart() to the queue instead of creating duplicate script tags. 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev>
AGENTS.md: - Add website/Astro rules: .mdx required for component imports; queue pattern for multi-instance is:inline script loading - Add AstroChart data shape section: real AstroData type, valid planet keys, cusps constraint, retrograde flag format website docs (wrong data shape fixed): - api/types.md: rewrite with real AstroData/Points types, table of valid planet keys, full working example - guides/radix-chart.md: replace invented Planet[]/Cusp[] API with real Record<string,number[]>/number[] shape throughout - api/radix.md: correct code example, document data constraints library-issues/ (new directory, two files): - improve-validate-unknown-planet-keys.md: unknown planet keys silently render as fallback circles with no warning — improvement candidate - bug-settings-mutation-across-instances.md: Chart constructor mutates the shared default_settings singleton via Object.assign, causing cross-instance settings bleed — confirmed bug 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev>
'Radix with Custom Height' and 'Transit without Code Snippet' existed to exercise ChartDemo component props — not to communicate anything useful to a documentation reader. Removed.
Without this exclusion tsc emits .d.ts files for the test helpers into dist/project/__tests__/ on every npm run build. The issue-93 branch had this fix but it was not in doc-website, so it reappeared on the new branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #94
Summary
Test plan
Generated with eca