@automattic/charts 0.56.6 → 0.56.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +135 -0
- package/CHANGELOG.md +6 -0
- package/README.md +2 -1
- package/package.json +1 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file is the package-specific source of truth for AI coding agents working in `projects/js-packages/charts`.
|
|
4
|
+
|
|
5
|
+
## Project Scope
|
|
6
|
+
|
|
7
|
+
`@automattic/charts` is a React + TypeScript charting library used across Automattic products.
|
|
8
|
+
|
|
9
|
+
Key implementation details agents usually miss:
|
|
10
|
+
|
|
11
|
+
- Build system is `tsup`.
|
|
12
|
+
- Package exports are explicit subpath exports in `package.json`.
|
|
13
|
+
- Styling is primarily Sass-based CSS Modules (`*.module.scss`) compiled via tsup plugins.
|
|
14
|
+
- The docs workflow uses paired Storybook docs files (`.docs.mdx` + `.api.mdx`).
|
|
15
|
+
|
|
16
|
+
## CRITICAL Rules
|
|
17
|
+
|
|
18
|
+
- CRITICAL: Keep this file focused on package-specific facts and workflows that are hard to infer from code search.
|
|
19
|
+
- CRITICAL: Do not invent behavior in docs. If unsure, verify implementation and stories first.
|
|
20
|
+
- CRITICAL: Do not assume wildcard exports. Follow the explicit exports in `projects/js-packages/charts/package.json`.
|
|
21
|
+
|
|
22
|
+
## Commands
|
|
23
|
+
|
|
24
|
+
Run these from `projects/js-packages/charts` unless noted otherwise.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Build + type safety
|
|
28
|
+
pnpm run build
|
|
29
|
+
pnpm run typecheck
|
|
30
|
+
|
|
31
|
+
# Tests
|
|
32
|
+
pnpm run test
|
|
33
|
+
pnpm run test-coverage
|
|
34
|
+
|
|
35
|
+
# Storybook (delegates to ../storybook)
|
|
36
|
+
pnpm run storybook
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Changelog command (run from monorepo root):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
jp changelog add js-packages/charts -s patch -t changed -e "Charts: <user-facing change>."
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Architecture Decisions (Do Not "Fix" These)
|
|
46
|
+
|
|
47
|
+
- Charts are built around composition patterns (for example, chart components with attached subcomponents).
|
|
48
|
+
- Theme values and chart element styles flow through `GlobalChartsProvider` and related provider hooks.
|
|
49
|
+
- Accessibility behavior (keyboard navigation, accessible tooltips) is part of chart behavior, not optional polish.
|
|
50
|
+
- CSS Modules are intentionally used for scoped styles and stable local class handling.
|
|
51
|
+
- Charts are responsive by default.
|
|
52
|
+
|
|
53
|
+
## Documentation Workflow
|
|
54
|
+
|
|
55
|
+
Before changing chart docs or stories, read:
|
|
56
|
+
|
|
57
|
+
- `projects/js-packages/charts/docs/ai-documentation-guide.md`
|
|
58
|
+
- `projects/js-packages/charts/docs/feature-documentation.mdx.template`
|
|
59
|
+
- `projects/js-packages/charts/docs/feature-api-documentation.mdx.template`
|
|
60
|
+
|
|
61
|
+
Docs standards:
|
|
62
|
+
|
|
63
|
+
- For public chart/component docs, maintain the standard docs set when applicable:
|
|
64
|
+
- `[feature-name].stories.tsx`
|
|
65
|
+
- `[feature-name].docs.mdx` (usage, examples, behavior, accessibility)
|
|
66
|
+
- `[feature-name].api.mdx` (API reference only; no usage examples)
|
|
67
|
+
- Some docs are intentionally guide-only or scope-specific (for example introduction, provider docs, or focused feature guides) and may not use the full triplet.
|
|
68
|
+
- MUST keep props/types in docs aligned with implementation.
|
|
69
|
+
- MUST include animation docs only when the component actually supports an `animation` prop.
|
|
70
|
+
|
|
71
|
+
For docs-heavy tasks with many repeated steps, agents may use the optional skill:
|
|
72
|
+
|
|
73
|
+
- `.agents/skills/charts-docs.md`
|
|
74
|
+
|
|
75
|
+
## Conventions
|
|
76
|
+
|
|
77
|
+
### Code and APIs
|
|
78
|
+
|
|
79
|
+
- Preserve backward compatibility for existing public APIs unless a breaking change is explicitly requested.
|
|
80
|
+
- Prefer extending existing chart components/patterns over introducing new surface area.
|
|
81
|
+
- Reuse existing hooks/providers/utilities before adding new abstractions.
|
|
82
|
+
|
|
83
|
+
### Styling
|
|
84
|
+
|
|
85
|
+
- Follow existing CSS Module + Sass patterns.
|
|
86
|
+
- Use existing chart theme integration patterns instead of ad-hoc color/style logic.
|
|
87
|
+
- Avoid `!important` unless there is no viable alternative and the rationale is documented.
|
|
88
|
+
|
|
89
|
+
### Testing
|
|
90
|
+
|
|
91
|
+
- Use Jest + Testing Library patterns already present in this package.
|
|
92
|
+
- Add focused behavioral tests for changed behavior (interaction, rendering state, accessibility behavior).
|
|
93
|
+
- For behavior or UI changes, verify in Storybook using browser automation (browser MCP) against relevant stories/states, not only unit tests.
|
|
94
|
+
- Avoid speculative tests for behavior not implemented in code.
|
|
95
|
+
|
|
96
|
+
### PR and Changelog
|
|
97
|
+
|
|
98
|
+
- Prefer charts-scoped PR titles consistent with current repo patterns (e.g. `Charts: ...`, `CHARTS-###: ...`).
|
|
99
|
+
- Include a changelog entry for user-facing changes under `projects/js-packages/charts/changelog/`.
|
|
100
|
+
- Include test steps and outcomes in PR descriptions.
|
|
101
|
+
- Include visual evidence (screenshots/GIFs) for visible UI changes.
|
|
102
|
+
|
|
103
|
+
## Common Pitfalls
|
|
104
|
+
|
|
105
|
+
- Claiming Rollup is used for charts builds.
|
|
106
|
+
- Referring to wildcard exports like `./*` or `./providers/*` (which don't exist). Use explicit exports like `./providers` instead.
|
|
107
|
+
- Updating `.docs.mdx` without the corresponding `.api.mdx` when API docs are affected.
|
|
108
|
+
- Not checking CSF file references in `.docs.mdx` when changing or removing stories.
|
|
109
|
+
- Documenting props or behavior not present in stories and implementation.
|
|
110
|
+
- Refactoring core composition/provider patterns as if they are accidental complexity.
|
|
111
|
+
- Using ad-hoc flexbox layouts where established shared layout primitives/patterns (for example, `Stack`) should be preferred.
|
|
112
|
+
- Accessing colors and styles directly from the `theme` rather than using `getElementStyles` from the `GlobalChartsProvider`.
|
|
113
|
+
- Defining new chart prop interfaces that diverge from established base chart contracts (for example, not aligning with `BaseChartProps` when appropriate).
|
|
114
|
+
- Implementing responsive wrappers that conflict with component sizing semantics (fixed-height charts, resize behavior, or aspect-ratio assumptions).
|
|
115
|
+
- Adding stories that do not visibly demonstrate the documented behavior/props, or stories that render clipped due to container sizing.
|
|
116
|
+
- Tooltip styles/positioning that only work on default backgrounds or fail at chart edges (for example, shadows fading to opaque white instead of transparent).
|
|
117
|
+
- Using mock/placeholder series data in production code.
|
|
118
|
+
- Introducing avoidable multi-pass data transformations in render paths when a single pass is sufficient.
|
|
119
|
+
- Adding CSS layout/overflow workarounds without documenting why the workaround is needed.
|
|
120
|
+
|
|
121
|
+
## Definition of Done
|
|
122
|
+
|
|
123
|
+
Before handing off, verify:
|
|
124
|
+
|
|
125
|
+
- Guidelines: changes follow this file, root monorepo guidance, and charts docs standards.
|
|
126
|
+
- Build/tests: `pnpm run typecheck` and relevant tests pass for modified behavior.
|
|
127
|
+
- Behavior verification: changed chart behavior is validated in Storybook and/or tests, not only by static checks.
|
|
128
|
+
- Safe scope: edits remain in package boundaries and avoid unrelated refactors.
|
|
129
|
+
|
|
130
|
+
## References
|
|
131
|
+
|
|
132
|
+
- Root repo guidance: `AGENTS.md`
|
|
133
|
+
- Package docs guide: `projects/js-packages/charts/docs/ai-documentation-guide.md`
|
|
134
|
+
- Package readme: `projects/js-packages/charts/README.md`
|
|
135
|
+
- Published Storybook docs: `https://automattic.github.io/jetpack-storybook/?path=/docs/js-packages-charts-library`
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.56.7] - 2026-03-02
|
|
9
|
+
### Changed
|
|
10
|
+
- Improve AI agent documentation and validation workflow for chart development. [#47334]
|
|
11
|
+
- Standardize chart documentation structure: add Responsive Behavior and Legends as standard sections, remove Browser Compatibility and Performance Considerations sections, and align all chart docs to established template. [#47363]
|
|
12
|
+
|
|
8
13
|
## [0.56.6] - 2026-02-26
|
|
9
14
|
### Changed
|
|
10
15
|
- Simplify relocated portal positioning with CSS inset shorthand. [#47220]
|
|
@@ -708,6 +713,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
708
713
|
- Fixed lints following ESLint rule changes for TS [#40584]
|
|
709
714
|
- Fixing a bug in Chart storybook data. [#40640]
|
|
710
715
|
|
|
716
|
+
[0.56.7]: https://github.com/Automattic/charts/compare/v0.56.6...v0.56.7
|
|
711
717
|
[0.56.6]: https://github.com/Automattic/charts/compare/v0.56.5...v0.56.6
|
|
712
718
|
[0.56.5]: https://github.com/Automattic/charts/compare/v0.56.4...v0.56.5
|
|
713
719
|
[0.56.4]: https://github.com/Automattic/charts/compare/v0.56.3...v0.56.4
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive charting library for displaying interactive data visualizations within Automattic products. Built on top of modern libraries like `@visx/xychart` and designed for accessibility, responsiveness, and ease of use.
|
|
4
4
|
|
|
5
|
-
Explore the available charts and their documentation in [Storybook](https://automattic.github.io/jetpack-storybook/?path=/docs/js-packages-charts).
|
|
5
|
+
Explore the available charts and their documentation in [Storybook](https://automattic.github.io/jetpack-storybook/?path=/docs/js-packages-charts-library-introduction--docs).
|
|
6
6
|
|
|
7
7
|
## Requirements
|
|
8
8
|
|
|
@@ -72,6 +72,7 @@ The following components can be imported individually:
|
|
|
72
72
|
- `@automattic/charts/trend-indicator` - Trend Indicator component
|
|
73
73
|
- `@automattic/charts/hooks` - React hooks
|
|
74
74
|
- `@automattic/charts/providers` - Context providers
|
|
75
|
+
- `@automattic/charts/utils` - Shared chart utility functions
|
|
75
76
|
- `@automattic/charts/visx/group` - Visx group utilities
|
|
76
77
|
- `@automattic/charts/visx/legend` - Visx legend utilities
|
|
77
78
|
- `@automattic/charts/visx/text` - Visx text utilities
|
package/package.json
CHANGED