Skip to content

Commit 57c497f

Browse files
afuchereca-agent
andauthored
feat(website): Phase 2 — Polish & Complete documentation site (#114)
* feat(website): Phase 2 — Polish & Complete documentation site Issue #99 — Theme customization and logo design: - Replace placeholder logo.svg with proper astrological wheel SVG (12 division marks, dual rings, crosshair axes, planet dots, currentColor) - Apply indigo accent palette to custom.css (light + dark mode variants) - Wire customCss into astro.config.mjs so theme is applied site-wide - Improve .chart-demo container styling (rounded corners, shadow, padding) Issue #100 — Enrich remaining documentation pages: - custom-settings.md: full settings table grouped by category, 5+ examples - custom-symbols.md: complete CUSTOM_SYMBOL_FN docs with 3 examples - click-events.md: ADD_CLICK_AREA flag, on() API, full event handler example - multiple-charts.md: unique IDs, 4 multi-chart examples, independent state - api/settings.md: comprehensive reference for all ~100 settings from source - guides/frameworks/vue.md: Vue 3 Composition API, Vue 2, Nuxt SSR examples - guides/frameworks/angular.md: ViewChild, ngOnDestroy, NgZone, SSR guard - changelog.md: real version history (v3.0.0–v3.0.2) in Keep a Changelog format - contributing.md: website dev, code style table, PR branch conventions Issue #98 — Gallery page and advanced demo features: - Add 'aspects' mode to ChartDemo.astro (renders chart.radix().aspects()) - Create gallery.mdx with 4 live demos: radix, transit, aspects, animate - Add 'Examples' sidebar group in astro.config.mjs between Guides and API 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev> * fix(website): animation error and gallery code snippet readability Fix animation demo crashing with "Data is not set": - Transit.animate() requires (data, duration, isReverse, callback) — was called with no arguments, causing validate() to throw on undefined data - Add animateTargetData to demoData.ts (planets shifted ~30–90° from the initial transit so movement is clearly visible) - Pass animateTargetData via define:vars to the inline script - Button now toggles forward/back between transitData and animateTargetData - Duration passed as 2 (seconds, the library multiplies by 1000 internally) Fix gallery/guide code snippet hard to read in dark mode: - Replace light #f5f5f5 pre background with dark #1e1e2e (Catppuccin Mocha) - Set explicit code color #cdd6f4 (light lavender) for contrast on both light and dark mode - Add a subtle border so the block has definition on any background 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev> * fix(website): address Copilot review — factual errors and broken examples - changelog: replace '— Current' header with real release dates (3.0.2: 2023-08-17, 3.0.1: 2023-07-20, 3.0.0: 2023-07-10) - changelog: remove false claim that AstroData/AspectData/Dignity are exported from the package entry point (only Chart, AspectCalculator, and Settings are) - changelog: add real 3.0.2 fix: SNode and Fortune symbol positions - changelog: correct ADD_CLICK_AREA entry — remove mention of the non-existent radix.on() event API - click-events: rewrite guide to use real DOM addEventListener pattern with predictable element IDs ({chartId}-radix-planets-{Name} / {chartId}-radix-cusps-{index}) instead of fictional radix.on() API - custom.css: rename .chart-demo selectors to .chart-demo-wrapper to match the class actually used by ChartDemo.astro (dead CSS fix) - vue.md: replace broken `import type { AstroData }` (not exported) with derived type: Parameters<InstanceType<typeof Chart>['radix']>[0] - ChartDemo.astro: fix package name in all 4 code snippets ('astrochart' → '@astrodraw/astrochart') - ChartDemo.astro: fix animate snippet — replace no-arg transit.animate() call with a valid call showing all required parameters 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev> * fix(website): address remaining Copilot review comments (8, 9, 10) - angular.md: remove OnChanges/SimpleChanges from Basic Component import — they are unused in that snippet and belong only in the follow-up Re-rendering section where they are explicitly introduced - ChartDemo.astro: fix animation toggle passing isReverse: false on every click — change hardcoded false to !isForward so the second click correctly reverses the animation - vue.md: replace hardcoded container IDs (astrochart-root, astrochart-instance) with per-instance unique IDs generated via Math.random() in all three examples (Vue 3 Composition API, Vue 3 with Settings Prop, Vue 2 Options API), matching the pattern already used in the Angular example 🤖 Generated with [eca](https://eca.dev) Co-Authored-By: eca <git@eca.dev> --------- Co-authored-by: eca <git@eca.dev>
1 parent d661b4b commit 57c497f

15 files changed

Lines changed: 1444 additions & 153 deletions

File tree

website/astro.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export default defineConfig({
1414
src: './public/img/logo.svg',
1515
alt: 'AstroChart Logo'
1616
},
17+
customCss: ['./src/styles/custom.css'],
1718
social: [
1819
{ icon: 'github', label: 'GitHub', href: 'https://github.com/AstroDraw/AstroChart' }
1920
],
@@ -46,6 +47,12 @@ export default defineConfig({
4647
}
4748
]
4849
},
50+
{
51+
label: 'Examples',
52+
items: [
53+
{ label: 'Gallery', slug: 'gallery' }
54+
]
55+
},
4956
{
5057
label: 'API Reference',
5158
items: [

website/public/img/logo.svg

Lines changed: 29 additions & 4 deletions
Loading

website/src/components/ChartDemo.astro

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
export interface Props {
1313
id: string
1414
height?: number
15-
mode?: 'radix' | 'transit' | 'animate'
15+
mode?: 'radix' | 'transit' | 'animate' | 'aspects'
1616
showCode?: boolean
1717
}
1818
19-
import { defaultRadixData, defaultTransitData } from '../data/demoData'
19+
import { defaultRadixData, defaultTransitData, animateTargetData } from '../data/demoData'
2020
2121
const {
2222
id,
@@ -28,21 +28,30 @@ const {
2828
// Generate code snippet based on mode
2929
const getCodeSnippet = () => {
3030
if (mode === 'radix') {
31-
return `import { Chart } from 'astrochart'
31+
return `import { Chart } from '@astrodraw/astrochart'
3232
3333
const chart = new Chart('chart', 600, 600)
3434
chart.radix(data)`
3535
} else if (mode === 'transit') {
36-
return `import { Chart } from 'astrochart'
36+
return `import { Chart } from '@astrodraw/astrochart'
3737
3838
const chart = new Chart('chart', 600, 600)
3939
chart.radix(radixData).transit(transitData)`
40+
} else if (mode === 'aspects') {
41+
return `import { Chart } from '@astrodraw/astrochart'
42+
43+
const chart = new Chart('chart', 600, 600)
44+
chart.radix(data).aspects()`
4045
} else {
41-
return `import { Chart } from 'astrochart'
46+
return `import { Chart } from '@astrodraw/astrochart'
4247
4348
const chart = new Chart('chart', 600, 600)
4449
const transit = chart.radix(radixData).transit(transitData)
45-
transit.animate()`
50+
51+
// animate(targetData, durationSeconds, isReverse, onComplete)
52+
transit.animate(newTransitData, 2, false, () => {
53+
console.log('animation complete')
54+
})`
4655
}
4756
}
4857
@@ -79,6 +88,7 @@ const codeSnippet = getCodeSnippet()
7988
chartHeight: height,
8089
radixData: defaultRadixData,
8190
transitData: defaultTransitData,
91+
animateTargetData: animateTargetData,
8292
baseUrl: import.meta.env.BASE_URL
8393
}}
8494
>
@@ -95,13 +105,19 @@ const codeSnippet = getCodeSnippet()
95105
chart.radix(radixData)
96106
} else if (chartMode === 'transit') {
97107
chart.radix(radixData).transit(transitData)
108+
} else if (chartMode === 'aspects') {
109+
chart.radix(radixData).aspects()
98110
} else if (chartMode === 'animate') {
99111
const transit = chart.radix(radixData).transit(transitData)
112+
var isForward = true
100113

101114
const animateBtn = document.getElementById(chartId + '-animate-btn')
102115
if (animateBtn) {
103116
animateBtn.addEventListener('click', function () {
104-
transit.animate()
117+
var target = isForward ? animateTargetData : transitData
118+
transit.animate(target, 2, !isForward, function () {
119+
isForward = !isForward
120+
})
105121
})
106122
}
107123
}
@@ -183,16 +199,18 @@ const codeSnippet = getCodeSnippet()
183199
}
184200

185201
.code-snippet pre {
186-
background: #f5f5f5;
202+
background: #1e1e2e;
187203
padding: 1rem;
188204
border-radius: 0.5rem;
189205
overflow-x: auto;
190206
margin-top: 0.5rem;
191207
font-size: 0.875rem;
192208
line-height: 1.5;
209+
border: 1px solid rgba(255, 255, 255, 0.08);
193210
}
194211

195212
.code-snippet code {
196213
font-family: 'Courier New', monospace;
214+
color: #cdd6f4;
197215
}
198216
</style>

0 commit comments

Comments
 (0)