Repository navigation
feat(vega): theme Vega-Lite charts by default, with the charts package's palette #4411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
AKnassa
wants to merge
24
commits into
meta:main
Choose a base branch
from
AKnassa:ak-977-vega-charts-theming
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,394
−55
Draft
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ff12429
feat(vega): theme Vega charts from the charts package
AKnassa 3bbd262
Merge upstream/main into ak-977-vega-charts-theming
AKnassa b846f95
Merge remote-tracking branch 'origin/main' into review-4411-5pm
cixzhang bf81326
Merge upstream/main into ak-977-vega-charts-theming
AKnassa 74f380c
fix(vega): keep native Vega views across theme changes
AKnassa 73b4e15
fix(vega): align the core peer with the version charts requires
AKnassa 88c1dcf
fix(vega): catch in-place compileOptions edits on Vega-Lite charts
AKnassa 89b933b
fix(vega): declare charts as a peer so the consumer install resolves
AKnassa 0eead76
Merge main into ak-977-vega-charts-theming; theme from the charts pal…
cixzhang 731ad95
fix(vega): a caller's generic axis key outranks the theme's per-axis …
cixzhang 8410123
fix(vega): a caller's or spec's axis key in any earlier axis block ou…
cixzhang 296afab
fix(vega): an orient block counts only for an orient the chart draws
cixzhang 3f53ef0
fix(vega): a key in one orient block keeps the other orients themed; …
cixzhang 1eee702
fix(vega): a caller's axisX or axisY key keeps every axis of that cha…
cixzhang 9237958
Merge main into ak-977-vega-charts-theming
cixzhang a1c0214
chore(vega): pin @astryxdesign/core to the workspace version
cixzhang d09431f
Merge main into ak-977-vega-charts-theming
cixzhang 840c760
Merge main into ak-977-vega-charts-theming
cixzhang 9fecbb4
test(ci): a Charts change now also typechecks vega, which peers on ch…
cixzhang eeeaab2
fix(vega): count the axes Vega-Lite places itself when moving theme a…
cixzhang 19b5619
fix(vega): the caller's mark and per-mark band padding keys, and inhe…
cixzhang e3d7c92
docs(VegaChart): record named-style precedence as a known FR1 gap
cixzhang cdc97a6
fix(vega): a filled point keeps its color under the theme; docs name …
cixzhang 680530d
fix(vega): dots a line, area or trail config or a shape encoding turn…
cixzhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| --- | ||
| schema_version: 3 | ||
| template_version: 7 | ||
| kind: component | ||
| id: component:VegaChart | ||
| authority: current | ||
| archive_reason: null | ||
| superseded_by: null | ||
| approved_by: cixzhang | ||
| approved_at: 2026-11-12 | ||
| owners: [cixzhang] | ||
| review_triggers: [behavior, theming, public-api] | ||
| verified_by: | ||
| [ | ||
| packages/vega/src/VegaChart.test.tsx, | ||
| packages/vega/src/vegaLiteConfig.test.ts, | ||
| ] | ||
| modules: [] | ||
| families: [] | ||
| design_specs: [] | ||
| architecture: [] | ||
| contributing: [] | ||
| system_specs: [] | ||
| --- | ||
|
|
||
| # VegaChart component contract | ||
|
|
||
| ## Contract at a glance | ||
|
|
||
| | Area | Contract | | ||
| | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Public contract | The props in Public concepts, as built. | | ||
| | Behavior | A Vega-Lite spec compiles with the Astryx theme config as its base, the caller's `compileOptions.config` on top, and the spec's own inline config last. A native Vega spec is not themed. | | ||
| | End-user impact | A chart matches the active theme's axes, legends, marks and categorical palette without extra setup. | | ||
| | Builder impact | A builder overrides any theme key through `compileOptions.config` or the spec's own `config`; a native Vega spec takes its config through `parseConfig`. | | ||
| | Compatibility/readiness | Canary-only package. | | ||
| | Review checks | Reject a Vega-Lite spec that renders without the theme config, a caller config that the theme overrides, or a native Vega spec that the theme changes. | | ||
| | Governing rules | None recorded. | | ||
|
|
||
| This table is a review projection; the body below is authoritative. | ||
|
|
||
| ## Intent | ||
|
|
||
| VegaChart renders a Vega or Vega-Lite specification inside a container that | ||
| follows the active Astryx theme. This record states how the theme config | ||
| reaches a chart. Consumer usage lives in `VegaChart.doc.mjs` and the package | ||
| README. | ||
|
|
||
| ## Compatibility and migration | ||
|
|
||
| - Released default preserved: `no` for a Vega-Lite spec, which compiles with the theme config as its base (FR1). | ||
| - Compatibility class: behavioral, canary-only. | ||
| - Controlled/uncontrolled behavior: not applicable. | ||
| - Migration decision: none. A builder who wants a key without the theme sets it in `compileOptions.config` or in the spec. | ||
|
|
||
| ## Ownership boundary | ||
|
|
||
| **Owns** | ||
|
|
||
| - The order in which the theme config, the caller's compile config and the spec's own config apply (FR1). | ||
|
|
||
| **Does not own / non-goals** | ||
|
|
||
| - The categorical palette, which comes from `@astryxdesign/charts`. | ||
| - The Vega and Vega-Lite runtimes and their own config semantics. | ||
|
|
||
| ## Public concepts | ||
|
|
||
| | Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior | | ||
| | ---------------- | ----------------------------------------- | --------------------------------------------------------------------------- | ----------------------------------------- | ------- | --------------------- | ------------ | ------------------------------- | | ||
| | `spec` | A Vega or Vega-Lite spec with a `$schema` | The chart to render; `$schema` selects Vega or Vega-Lite | Always | None | `component:VegaChart` | experimental | `onError` with the schema error | | ||
| | `data` | Named dataset values | Initial values for named datasets, read once when the View is built | Always | None | `component:VegaChart` | experimental | Not applicable | | ||
| | `compileOptions` | Vega-Lite `compile()` options | Options for Vega-Lite compilation; its `config` applies over the theme | Vega-Lite specs only | None | `component:VegaChart` | experimental | Ignored for a native Vega spec | | ||
| | `parseConfig` | A Vega config | Config passed to `vega.parse()` | Always | None | `component:VegaChart` | experimental | Not applicable | | ||
| | `parseOptions` | Vega parse options | Options passed to `vega.parse()` | Always | None | `component:VegaChart` | experimental | Not applicable | | ||
| | `viewOptions` | Vega View options without `container` | Options passed to the Vega View; the component sets `container` | Always | None | `component:VegaChart` | experimental | `container` is overridden | | ||
| | `onReady` | Callback with the live View | Called once the chart has rendered | Always | None | `component:VegaChart` | experimental | Not applicable | | ||
| | `onError` | Callback with an error | Called when the schema is invalid, compilation fails, or the runtime throws | Always | None | `component:VegaChart` | experimental | Not applicable | | ||
| | `ref` | A ref to the root `div` | Ref forwarded to the root container | Always | None | `component:VegaChart` | experimental | Not applicable | | ||
|
|
||
| ## Behavioral and layout contract | ||
|
|
||
| | ID | Invariant | Basis | | ||
| | --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | | ||
| | FR1 | A Vega-Lite spec MUST compile with the Astryx theme config as its base, the caller's `compileOptions.config` on top, and the spec's own inline config last. A native Vega spec MUST pass through untouched. | The package README's themed-by-default promise | | ||
|
|
||
| ## Accessibility contract | ||
|
|
||
| None recorded. | ||
|
|
||
| ## Design relationships | ||
|
|
||
| | Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract | | ||
| | ---------------- | ------------------ | ------------------------ | -------------- | ------------------ | | ||
| | Chart | None recorded | Not applicable | primary | FR1 | | ||
|
|
||
| The component implements design requirements without copying their rationale. | ||
|
|
||
| ## Family and system relationships | ||
|
|
||
| None recorded. | ||
|
|
||
| ## Verification map | ||
|
|
||
| | Contract | Verification | Representative states | Mutation or failure expectation | Audit section | | ||
| | -------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------- | | ||
| | FR1 | `VegaChart.test.tsx` theming cases; `vegaLiteConfig.test.ts` merge and range cases | Vega-Lite with no config, with a caller config, with an inline config; native Vega | A themeless Vega-Lite chart, a caller config the theme overrides, or a themed native Vega spec fails it | None | | ||
|
|
||
| ## Decision log | ||
|
|
||
| None. | ||
|
|
||
| ## Open questions | ||
|
|
||
| None. | ||
|
|
||
| ## Content boundary | ||
|
|
||
| This file does not duplicate consumer prop tables/examples, current audit | ||
| results, implementation steps, or family/system rules. It links to their owners. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.