Repository navigation
Conversation
`@astryxdesign/vega` declared no `@astryxdesign/*` dependency at all: it re-declared its own `TokenResolver`, hand-copied charts' 10-entry categorical token list, and `VegaChart` never applied `buildVegaLiteConfig` — so a Vega chart rendered unthemed out of the box. This is the "wire @astryxdesign/vega to depend on it for shared theming" half of the issue's stated remaining work. `CATEGORICAL_TOKENS` is now exported from charts as the single source of truth and consumed by vega, so the two lists cannot drift. `VegaChart` compiles through the new pure `withAstryxConfig()`, which layers the theme underneath the caller's config: theme is the base, `compileOptions.config` overrides it, and a spec's own inline `config` still wins over both (that last rule is vega-lite's, not ours). Merging uses vega's recursive `mergeConfig`, so a partial override no longer wipes the themed block. Test infrastructure had to move with it: the vitest `node` project resolves workspace packages through their `exports` map — dist, not src — and CI's test job runs with no build step, so every vega suite died at import. `ensureCoreBuilt` is the established precedent for exactly this, so it is generalized to `ensureBuilt(pkg, artifact, slug)` with its own signature preserved, and the global setup now also ensures charts. No changeset: both packages are `private: true`, and `check:changesets` rejects private packages outright, so any changeset here fails `pnpm lint`. Refs meta#977
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
Conflict: vitest.global-setup.node.mjs — upstream moved the shared build helper to packages/cli/clients/cli/commands/ in the CLI restructure; kept this branch's ensureChartsBuilt import at the new path. Also re-pinned vega's @astryxdesign/charts dependency (0.1.8 -> 0.1.9) and @astryxdesign/core peer (0.1.8 -> 0.3.0) to the current workspace versions so pnpm keeps linking the workspace packages, per the charts->core exact-pin convention.
# Conflicts: # packages/vega/README.md
There was a problem hiding this comment.
Thanks for wiring Vega to the shared charts palette — the shared token list and recursive config merge are a clean way to theme Vega-Lite by default.
Two fixes are needed before this can land:
- Keep theme changes from recreating native Vega views. The themed compile options currently participate in the view lifecycle for every spec, so a theme toggle finalises a native view even though native specs do not use that config, discarding live state. Please gate that reactivity to Vega-Lite and add a test that a native view survives a theme change.
- Align the new
@astryxdesign/corepeer in the Vega package with the version charts requires, so both peers can be satisfied by one core installation.
Please also add representative light/dark rendered evidence for the default theming and override precedence, plus a native chart control, so the visible change can be checked directly.
[Automated review]
Resolved conflicts: - packages/vega/src/VegaChart.tsx: kept upstream's value-compared View latch (meta#6051) and fed the PR's themed compile options into it as `compileOptions`, replacing the PR's effect dependency list. - packages/vega/README.md: merged the file manifest (upstream's viewInputs.ts row plus the PR's tsconfig.build.json and vegaLiteConfig.ts rows). - packages/vega/src/vegaLiteConfig.test.ts (add/add): kept upstream's suite and added the PR's shared-palette and withAstryxConfig tests. - vitest.global-setup.node.mjs: took upstream's version. Vega tests now run in the `ui` project (meta#4377), so the node global setup no longer needs to build charts. Merge fallout: - packages/cli/clients/cli/commands/ensure-core-built.mjs: took upstream's version, dropping the PR's ensureBuilt/ensureChartsBuilt generalization, which nothing uses any more. - vitest.config.ts: resolve the bare @astryxdesign/charts specifier to source, as core already is, so the `ui` project does not need a built charts dist. - packages/vega/src/VegaChart.test.tsx: the vega mock now keeps the real module (vegaLiteConfig needs mergeConfig), and the compileOptions test expects the caller's config merged over the default theme config. - packages/vega/src/VegaChart.doc.mjs: compileOptions notes that its config is merged over the Astryx theme config.
astracat F1: the themed compile options took part in the View lifecycle for every spec, so a theme or color-mode switch finalized and rebuilt a native Vega View (losing zoom, hover, and signal state) even though native specs never compile and never read that config. VegaChart now applies withAstryxConfig only when the spec's $schema is Vega-Lite, and feeds those options into the value-compared View latch (meta#6051). Native specs keep the caller's compileOptions untouched, so a theme switch no longer changes their inputs. `token` from useTheme is used directly: it keeps its identity until the resolved theme changes, so the old comment about a fresh closure every render was wrong. The README's View lifecycle section and the component docblock now say that a theme or mode change rebuilds a Vega-Lite View and never a native one. Proof: new VegaChart.test.tsx "theme changes" tests. "keeps a native Vega View when the color mode changes" failed before the gate ("expected [ FakeView, FakeView ] to have a length of 1 but got 2") and passes after it. "rebuilds a Vega-Lite View with the new mode's theme config" checks that a light->dark switch rebuilds once and compiles with the dark theme config.
astracat F2: the vega package pinned its @astryxdesign/core peer at 0.3.0 while charts (its direct dependency), lab, and core itself are at 0.6.3, so the two peers could not be met by one core install. The pin now matches charts' exact 0.6.3, and the vega importer in pnpm-lock.yaml carries the new specifier (only that hunk changed). Proof: a node check comparing vega's core peer with charts' peer and core's version exited 1 before (0.3.0 vs 0.6.3) and exits 0 after. `pnpm install --frozen-lockfile` is up to date. No changeset: the package is private.
F1 follow-up (verifier, repair round 1): the themed compile options were memoized on the caller's compileOptions identity. withAstryxConfig merges the caller's config into a new object, so mutating compileOptions.config in place and re-rendering handed the meta#6051 latch the stale merge, and the Vega-Lite View never rebuilt. That broke the README's View lifecycle promise that these props are compared by value and need no useMemo. - VegaChart.tsx: compute the gated options on every render (`isVegaLite ? withAstryxConfig(token, compileOptions) : compileOptions`) and drop the useMemo. The latch already compares by value, so equal inline options still keep the View, and native specs still get the caller's object untouched, so a theme change still never rebuilds them. - VegaChart.test.tsx: 'rebuilds a Vega-Lite View when compileOptions.config is mutated in place' failed first ("expected [FakeView] to have a length of 2 but got 1") and passes now. 'keeps a Vega-Lite View when a re-render passes equal inline compileOptions' guards the unmemoized merge against rebuilding on every render. Hooks skipped: lint-staged backs up through the git stash shared with other worktrees. eslint, prettier, check-sync, check-knowledge, check-package-boundaries, check-changesets and check-use-client were run by hand and pass.
|
Thanks for the review. Pushed through 88c1dcf. Merged main in. The PR now uses #6051's value-compared View latch, and vega tests run in the
Still to do: light/dark screenshots in the PR body showing the default theme, a |
There was a problem hiding this comment.
Thanks for wiring Vega to the shared charts palette, and for fixing the two issues from the last round — native Vega views now survive a theme or color-mode switch (with regression tests), and the core peer now matches the version charts requires.
Approval needs a maintainer decision first. This change adds a new direction — Vega depending on charts as the single source of the categorical palette, and Vega-Lite charts being themed by default with the caller's config and a spec's inline config overriding the theme — and no current governing spec settles that addition yet; the charts component spec is still a draft and the tracked issue points to a wiki write-up. A maintainer needs to provide or identify the governing spec for the dependency and palette ownership, and for the default-theming precedence with native Vega left unthemed.
Two things are also still outstanding, independent of that decision:
- Installing Vega through the repo's consumer-install path currently fails: the pinned
@astryxdesign/charts0.1.9dependency has no published version to resolve (charts ships only as canary builds), and the registry-contract check fails on it at this revision. Declaring charts the way the core peer is declared, or with a spec the canary release actually publishes, would fix the consumer install. - The light/dark screenshots you flagged as still to do — default theme, a
compileOptions.configoverride winning, and the native chart as an unchanged control — are still needed to check the visible change directly.
[Automated review]
The registry-contract check failed with ERR_PNPM_NO_MATCHING_VERSION for @astryxdesign/charts@0.1.9 "while installing the dependencies of @astryxdesign/vega@0.1.3". The ShadCN registry builds a package-backed item's install list by walking peers only, so charts never reached the consumer as a local file: package and pnpm resolved vega's direct dependency from npm, where canary-only charts has no 0.1.9. - Move @astryxdesign/charts from dependencies to peerDependencies with the same exact spec as the core peer (sync-internal-deps and the canary stamp manage it the same way). pnpm-lock.yaml is unchanged: the importer already lists the auto-installed peer as link:../charts (frozen install and --lockfile-only both report up to date). - README: install charts and core from the same @canary tag, since a canary pins both peers to its own build. - manifest.test.ts: every Astryx package vega imports is a peer and none is a direct dependency. Red before the move (charts missing from peers, present in dependencies), green after. Proof: rebuilt the VegaChart registry item from the workspace manifests with buildShadcnRegistry (canary target) and ran `pnpm add` of its file:-rewritten closure in a scratch consumer, as verify-full-catalog does. Before: the closure lacked charts and pnpm failed with the CI error. After: the closure includes charts, the install succeeds, and vega's charts peer links to the consumer's single charts copy.
|
Pushed 89b933b for the consumer-install failure. The governing-spec question and the light/dark screenshots are still open, as noted above. |
…arts Co-authored-by: AKnassa <AKnassa@users.noreply.github.com>
|
🤖 (Posted by Cindy's agent.) One more small addition, @AKnassa: a repository CI test listed which packages a Charts change typechecks. Since |
|
/approve-spec 9fecbb4 |
There was a problem hiding this comment.
Changes requested: the code follows the component:VegaChart record approved for this head, apart from one precedence case on axes whose side Vega-Lite picks itself.
- An orient-block override loses to the theme on an axis whose orient Vega-Lite chooses:
drawnAxes(packages/vega/src/vegaLiteConfig.ts:224-260) reads an axis's side only from the encoding, so on a dual-axis layer (where Vega-Lite moves the second axis to the top or right) or with anorientset in config,compileOptions={{config: {axisTop: {domain: false}}}}still draws the top domain line and{axisLeft: {domain: true}}also strips the theme from the right axis, contrary to the record's FR1 and the description's Precedence and partial-config sections; count Vega-Lite's own placement there and add real-compile tests for those cases.
Non-blocking:
- Six comment-style suggestions from earlier rounds remain open, each with a shorter rewrite on its thread.
- The
CompileOptions.configdoc comment still says it merges over the spec's own config (packages/vega/src/types.ts:39), which the README row this pull request corrected no longer says.
Reproduced locally with real Vega-Lite and Vega; the 88 vega tests pass locally, and CI's build and test jobs are deferred until review passes.
Claims and files checked
Review mode: same-head; reason: none
- Title (live), "feat(vega): theme Vega-Lite charts by default, with the charts package's palette": verified (
VegaChart.tsx:121-127,vegaLiteConfig.ts:130). - Carried forward by a maintainer, keeping the original author's commits, with main merged in and no rebase: verified (branch history).
- Charts does not export its categorical token list: verified (
getChartColors.ts:80is module-local; charts is unchanged here). - The categorical range comes from the charts palette resolver with ten slots, as before: verified (
vegaLiteConfig.ts:130; the same ten tokens in the same order). - The config-merge helper stays internal and the component applies it: verified (
packages/vega/src/index.tsis unchanged). - The core peer follows main's version, as charts' does: verified (0.7.18 in both and on main).
- The new record states the order in one requirement and its concepts table names the props as built: verified (FR1; the table matches
VegaChartProps). - Vega-Lite charts pick up the theme out of the box, share one palette with charts, and native Vega is unchanged: verified (tests run locally).
- The theme config comes from the active theme, where the base applied none: verified (the base compiled with the caller's options only).
- A series blue in a compositional chart is the same blue here, and vega kept its own token copy before: verified.
- Charts and core are peers, and a manifest test checks every imported Astryx package is one: verified (the wrapper's non-test sources import only those two).
- Native Vega specs are not themed and take
parseConfig: verified. - A chart with no spec renders an empty container and reports through
onError: verified (missing-spec test, run locally). - Precedence is theme, then caller config, then the spec's config, merged recursively: verified for axes whose side the encoding states; false on axes Vega-Lite places itself (finding).
- The theme sets four per-axis blocks, and Vega-Lite resolves the axis blocks in the order given: verified.
- A caller or spec key in an earlier axis block leaves out the theme's per-axis value: false on axes Vega-Lite places itself (finding); the two examples given hold.
- A partial config gets the theme for every key it leaves out, and field-derived titles are hidden: false for the right axis of a dual-axis chart under a left-axis key (finding); titles verified (
vegaLiteConfig.ts:77,:107). - No changeset: vega is private and outside the release group, the changeset check rejects private packages, no release-group package changes, and canary users get the change with both peers stamped to the canary build: verified (changeset config, changeset check, release workflow canary step).
- The lab interaction layers are out of scope: verified (no Lab files change).
- Writing rubric results for the new record: verified.
- The vega tests run in CI and cover the listed cases: reported (CI's test job is deferred until review passes); the listed cases exist and pass locally.
- Owner line: reported. Land path: the record's approval is recorded for this head: verified. A carry commit updates the typecheck-scope test because a Charts change now also typechecks vega: verified (the last commit touches only that test; the scope helper picks vega on this head and not on the base, run locally).
.github/scripts/typecheck-scope.test.mjs: clear.docs/specs/components/VegaChart/VegaChart.spec.md: clear (the code falls short of its FR1; see the finding).packages/vega/README.md: finding (precedence promise).packages/vega/package.json: clear.packages/vega/src/VegaChart.doc.mjs: finding (precedence promise).packages/vega/src/VegaChart.test.tsx: clear.packages/vega/src/VegaChart.tsx: finding (precedence promise in the component doc); one comment-style note.packages/vega/src/manifest.test.ts: clear.packages/vega/src/types.ts: finding (precedence promise); the inherited doc-comment note.packages/vega/src/vegaLiteConfig.test.ts: no case for axes Vega-Lite places itself (part of the finding).packages/vega/src/vegaLiteConfig.ts: finding (orient guess, and thewithAstryxConfigdoc promise); five comment-style notes.packages/vega/tsconfig.build.json: clear.packages/vega/tsup.config.ts: clear.pnpm-lock.yaml: clear.vitest.config.ts: clear.
|
🤖 (Posted by Cindy's agent.) A heads-up, @AKnassa: the latest automated review found one real bug, so we're adding a fix on your branch (credited to you as co-author) to keep this moving toward merge.
You're very welcome to review the commit when it lands. If anything doesn't match what you intended, just say so here. Thank you! |
…xis values A layer's second independent axis moves to the opposite side, and an orient in the axisX, axisY or axis config moves a channel's axes. The caller's orient blocks now keep their rank on those axes. Also shortens comments per review and corrects the CompileOptions.config doc. Co-authored-by: AKnassa <AKnassa@users.noreply.github.com>
|
🤖 (Posted by Cindy's agent.) Following up on my note above, @AKnassa: the fix is now on your branch in one commit, crediting you as co-author. Charts with two y-axes, or an axis side set with |
|
/approve-spec eeeaab2 |
There was a problem hiding this comment.
Changes requested: the component:VegaChart record approved for this head settles the direction, but in three cases the theme still overrides a caller's or a spec's config, against FR1 and the description's Precedence section.
- The theme's
lineandpointblocks override a caller's or a spec'smarkconfig, socompileOptions={{config: {mark: {strokeWidth: 6}}}}leaves a line chart at the theme's 2 px line (reproduced locally against real Vega-Lite and in Storybook); drop a themelineorpointkey thatmarksets, as the axis guard already does for axis keys. - The theme's
scale.bandPaddingInneroverrides the per-mark band padding keys, because Vega-Lite reads the generic key beforebarBandPaddingInner,rectBandPaddingInnerandtickBandPaddingInner, so{scale: {barBandPaddingInner: 0.5}}compiles to 0.1 (reproduced locally); set the theme's 0.1 through those three keys instead. - Axes Vega-Lite derives from an inherited encoding or a repeated layer are not counted, because
axesInreads only each node's ownencoding(vegaLiteConfig.ts:259-279), so with independent scales a layer child that inheritsxoryfrom the parent, or arepeat: {layer}chart, keeps the theme's top domain line underaxisTop: {domain: false}and drops the theme'saxisY.domainfrom the right axis when onlyaxisLeftis set; merge each child's encoding over its parent's and expand a repeated layer before counting.
The README, types.ts, VegaChart.tsx and VegaChart.doc.mjs describe the same caller-on-top order, so they become accurate once the code is fixed. A real-compile test for each case would pin it, like the existing precedence tests in vegaLiteConfig.test.ts.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim: Vega-Lite charts are themed by default with the charts package's palette: verified (code, the pull request's tests run locally, Storybook captures).
- Claim: charts keeps its token list private and Vega takes ten slots from it, the range used before: verified.
- Claim: the merge helper stays internal and the vega package does not export it: verified (the vega barrel is unchanged).
- Claim: the core peer follows main's version, as charts' peer does: verified.
- Claim: the new record states the order in one requirement and its table names the component's props: verified.
- Claim: the theme config is compiled as the base from the active theme, which the base never applied: verified.
- Claim: a series colored blue in a chart is the same blue here: verified (same ten tokens, same order).
- Claim: charts and core are peers and the manifest test checks every imported Astryx package is a peer: verified (test passes locally).
- Claim: native Vega specs are not themed: verified (tests; the native story is pixel-identical).
- Claim: a chart with no spec renders an empty container and reports through onError: verified (test).
- Claim: precedence is theme, then compile options, then the spec's own config: false (all three findings).
- Claim: merging is recursive, so a partial override replaces only that key: verified (tests).
- Claim: the theme sets four per-axis blocks, resolved in Vega-Lite's stated order: verified (code and Vega-Lite's source).
- Claim: a caller's or spec's axis key always outranks the theme's per-axis value: false (third finding).
- Claim: a partial-config caller gets the theme for every key it leaves out: false (third finding).
- Claim: field-derived axis and legend titles do not render under the theme: verified (compiled locally).
- Claim: vega is private and outside the release group, and the changeset check rejects private packages: verified.
- Claim: vega ships to canary from main with its peers stamped to the canary version: verified (release workflow).
- Claim: no package in the release group changes: verified (no changed file there; the API report lists no change).
- Claim: stable users get the change when vega is published with its own changeset: not checkable here (a future release step).
- Claim: the lab interaction layers are out of scope: verified (no such file changed).
- Claim: the writing rubric finds no narration, research, change evidence, alternatives, references, open questions or status in the record: verified by reading the record.
- Claim: the listed tests cover the compile path, a missing spec, the color-mode rebuild, the config, the palette, real-compile precedence and the manifest: verified (91 tests pass locally); CI has not run them at this head.
- Claim: the owner approved the record: verified (approval at this head).
- Claim: a Charts change now also typechecks vega: verified (scope computed locally).
- File
.github/scripts/typecheck-scope.test.mjs: clear. - File
docs/specs/components/VegaChart/VegaChart.spec.md: clear as a record; the code does not yet meet its FR1 (findings). - File
packages/vega/README.md: restates the precedence the findings break. - File
packages/vega/package.json: clear. - File
packages/vega/src/VegaChart.doc.mjs: restates the precedence the findings break. - File
packages/vega/src/VegaChart.test.tsx: clear. - File
packages/vega/src/VegaChart.tsx: clear apart from its doc comment restating the precedence. - File
packages/vega/src/manifest.test.ts: clear. - File
packages/vega/src/types.ts: clear apart from thecompileOptionsdoc restating the precedence. - File
packages/vega/src/vegaLiteConfig.test.ts: clear; does not cover the three cases. - File
packages/vega/src/vegaLiteConfig.ts: all three findings. - File
packages/vega/tsconfig.build.json: clear. - File
packages/vega/tsup.config.ts: clear. - File
pnpm-lock.yaml: clear (two workspace links). - File
vitest.config.ts: clear.
…rited or repeated layer axes, keep their rank over the theme Co-authored-by: AKnassa <AKnassa@users.noreply.github.com>
|
/approve-spec 19b5619 |
There was a problem hiding this comment.
Changes requested. The approved VegaChart record settles the direction, and the earlier precedence gaps are fixed: mark versus line/point, generic band padding, and inherited or repeated layer axes. One gap remains.
- The theme's axis, legend and title blocks override a caller's or a spec's guide and title styles: in a real render,
style['guide-label'],style['guide-title'],style['group-title'],style['group-subtitle']and a style named from the caller'saxisconfig all work without the theme but are ignored with it, against the record's FR1 and the description's "theme, thencompileOptions.config, then the spec's config" order (vegaLiteConfig.ts:385-459).
Next step: leave out a theme axis, legend or title key when the caller's or the spec's config sets the matching property in the style that paints that text, or in a style the config names, and add real-render tests for a caller and a spec guide-label fill. Giving the theme a rank that Vega-Lite places below every caller key would close this class at once. All 95 vega tests pass and the package typechecks when reproduced locally; CI has not run on this head because the pull request is a draft.
Claims and files checked
Review mode: full; reason: requested
Claims:
- Vega-Lite specs compile with the theme config from the active theme as their base: verified (
VegaChart.tsx:118-124; test "rebuilds a Vega-Lite View with the new mode's theme config"). - Before this change the chart rendered with Vega's defaults: verified by reading the base (
compile(spec, compileOptions)only) and by base frames. - The categorical range comes from the charts palette, so
<Chart>and Vega share the same blue: verified (same ten tokens in the same order;<Chart>resolves them from the same theme tokens; test "draws its categorical range from the shared token list"). - Charts and core are peers, and a manifest test checks every imported Astryx package is a peer: verified (
package.jsonpeers;manifest.test.tsscans every non-test source file; no other shipped file imports an Astryx package). - Native Vega specs are not themed and take
parseConfig: verified (VegaChart.tsx:121-124; Radial Plot frames identical). - A chart with no
specrenders an empty container and reports throughonError: verified (test "renders an empty container and reports through onError when spec is missing"). - Precedence is theme, then
compileOptions.config, then the spec's config: false for guide and title styles (blocking finding above). - Merging is recursive, so a partial axis override replaces only that key: verified (test "keeps theme values the user did not override").
- The theme sets the four per-axis blocks, and Vega-Lite's axis resolution order is as described: verified (
vegaLiteConfig.ts:77-92; Vega-Lite's axis config resolution). - A caller's or spec's key in an earlier axis block wins over the theme's per-axis value, so a generic axis grid adds the x grid and a y-channel grid off removes the y grid: verified (real-compile tests for caller and spec).
- A partial config gets the theme for the keys it leaves out; field-name titles do not render, and a caller restores a title in the encoding or by unsetting it in config: verified (story frames; local title probe).
- No changeset because vega is private, outside the release group, rejected by the changeset check, and shipped only to canary: verified (
.changeset/config.json,scripts/check-changesets.mjs:125, the canary publish step inrelease.yml). - No package in the release group changes: verified (file list).
- The lab interaction layers are out of scope: verified (no such file changed).
- The new record carries no narration, research, references, open questions or project status: verified (record read whole).
- The vega tests listed under Testing run in CI and cover the stated cases: verified (
vitest.config.tsincludes them in theuiproject; cases read; all 95 pass locally; CI skipped this draft head). - The owner approved the VegaChart record: verified (spec-owner approval for this head).
- A Charts change now also typechecks vega because vega peers on charts: verified by reading
typecheck-scope.mjs:95(followspeerDependencies). - Theme per-axis values follow the axes Vega-Lite places itself (second independent layer axis, configured orient): verified (tests under "axes Vega-Lite places itself").
- Charts does not export the categorical token list and the theme merge stays internal: verified (charts and vega entry points unchanged).
- The core peer follows main's version as charts' peer does: verified (0.7.18 on both).
- The record's Public concepts table names the component's props as built: verified (each row matches
VegaChartProps; inheriteddivattributes pass through and are not rows).
Files:
packages/vega/src/vegaLiteConfig.ts: finding (guide and title styles).packages/vega/src/VegaChart.tsx: clear.packages/vega/src/types.ts: clear (states the precedence the finding bounds).packages/vega/src/VegaChart.doc.mjs: clear (states the precedence the finding bounds).packages/vega/README.md: clear (states the precedence the finding bounds).docs/specs/components/VegaChart/VegaChart.spec.md: clear.packages/vega/src/vegaLiteConfig.test.ts: clear (no style case; see finding).packages/vega/src/VegaChart.test.tsx: clear.packages/vega/src/manifest.test.ts: clear.packages/vega/package.json: clear.pnpm-lock.yaml: clear.packages/vega/tsup.config.ts: clear.packages/vega/tsconfig.build.json: clear.vitest.config.ts: clear..github/scripts/typecheck-scope.test.mjs: clear.
| // Vega-Lite ranks a mark type's block above `mark`, so a theme `line` or | ||
| // `point` value would outrank a `mark` key the caller or the spec sets. | ||
| const markKeys = setIn('mark'); | ||
| for (const key of ['line', 'point']) { |
There was a problem hiding this comment.
This guard covers per-axis blocks and line/point, but the theme's axis, legend and title values (lines 63-108 and 175-181) still outrank the style entries Vega paints the same text with. In a real Vega-Lite 6.5.0 / Vega 6.4.0 render, compileOptions={{config: {style: {'guide-label': {fill: 'red', fontSize: 20}}}}} gives red 20px axis labels without the theme and the theme's 12px secondary text with it. A spec's own config.style loses the same way, as do guide-title on legend titles, group-title and group-subtitle, and a style named from the caller's axis config. component:VegaChart FR1 puts the caller's and the spec's config above the theme. Drop a theme axis, legend or title key when the caller or the spec sets the matching property in that style (or in a style its config names), and add real-render tests for a caller and a spec guide-label fill.
Co-authored-by: AKnassa <AKnassa@users.noreply.github.com>
|
/approve-spec e3d7c92 |
There was a problem hiding this comment.
Changes requested: the themed default is decided and the earlier precedence fixes hold, but filled points disappear under the theme and a few claims overstate what callers can override.
- The theme's point fill hides filled points and overrides a caller's point colour:
point.fill(packages/vega/src/vegaLiteConfig.ts:121) uses the card background token, so afilled: truepoint, a line'spoint: truedots, and a caller's or spec'smark/pointcolorwithfilled: trueall render in the background colour, againstcomponent:VegaChartFR1 (reproduced locally with real Vega-Lite renders and Storybook frames). - The precedence claims leave out the named-style gap: the description's Precedence section, the README Theming section and
compileOptionstable row, theVegaChart,CompileOptionsandwithAstryxConfigJSDoc, andVegaChart.doc.mjsstate the caller-wins order without the named-style exception the record now records, and "the config blocks FR1 lists" names no blocks. - The config title workaround in the description does not work: a title string in
compileOptions.config(for exampleaxisX.title) renders no axis title, so only an encoding title ortitle: undefinedin the config brings titles back.
Required CI has not run on this draft head; the vega tests pass locally.
Claims and files checked
Review mode: full; reason: author-not-engowner
- Claim: charts keeps its categorical token list private — verified (charts files unchanged; the list is module-private).
- Claim: Vega's categorical range comes from the charts palette, ten slots as before — verified (
vegaLiteConfig.ts:126, palette test). - Claim:
withAstryxConfigstays internal — verified (src/index.tsunchanged). - Claim: the core peer follows main's version, as charts does — verified (0.7.18 on main; charts peers 0.7.18).
- Claim: the new record states the order in one FR and its Public concepts table names the props as built — verified.
- Claim: Vega-Lite charts are themed by default and native specs are unchanged — verified (tests, frames).
- Claim: before this change no theme config was applied — verified (base
VegaChart.tsx:174). - Claim: a series blue in
<Chart>is the same blue here — verified (Chart.tsx:319uses the same palette). - Claim: charts and core are peers, and the manifest test checks every imported Astryx package is a peer — verified (test passes; vega imports only those two).
- Claim: native specs skip the theme; pass
parseConfig— verified (VegaChart.tsx:122-124). - Claim: a missing spec renders an empty container and calls
onError— verified (test). - Claim: precedence is theme, then caller config, then spec config — false (named styles; filled point colour).
- Claim: merging is recursive, so
{axis: {grid: true}}replaces one key — verified (tests). - Claim: per-axis theme values step aside for caller and spec axis keys, with the two examples — verified (tests).
- Claim: a partial config gets the theme for every key it leaves out — verified.
- Claim: titles can be set in the encoding or in the config — false for the config (no title renders).
- Claim: vega is private, outside the release group, and the changeset check rejects private packages — verified (
.changeset/config.json,check-changesets.mjs:125). - Claim: vega ships to canary from main — reported.
- Claim: no release-group package changes, and the lab interaction layers are out of scope — verified (diff).
- Claim: the vega tests run in CI under fork rules — reported (CI skipped at this draft head; 95 tests pass locally).
- Claim: named styles lose to the theme (Known limits) — verified; "the order holds for the config blocks FR1 lists" — false.
- Claim: the owner approved the record — verified (approval for this head).
- Claim: a Charts change now also typechecks vega — verified by reading the scope script.
- Claim: carried fixes for drawn axes, inherited and repeated layer axes, and per-mark band padding — verified (tests); line and point values stepping aside for mark keys — false for
mark.colorwithfilled. - Claim: writing rubric results — reported.
- File
.github/scripts/typecheck-scope.test.mjs— clear. - File
docs/specs/components/VegaChart/VegaChart.spec.md— gap row bound (precedence claims finding). - File
packages/vega/README.md— precedence claims finding. - File
packages/vega/package.json— clear. - File
packages/vega/src/VegaChart.doc.mjs— precedence claims finding. - File
packages/vega/src/VegaChart.test.tsx— clear. - File
packages/vega/src/VegaChart.tsx— precedence claims finding (JSDoc). - File
packages/vega/src/manifest.test.ts— clear. - File
packages/vega/src/types.ts— precedence claims finding. - File
packages/vega/src/vegaLiteConfig.test.ts— no filled-point case (point fill finding). - File
packages/vega/src/vegaLiteConfig.ts— point fill finding. - File
packages/vega/tsconfig.build.json— clear. - File
packages/vega/tsup.config.ts— clear. - File
pnpm-lock.yaml— clear. - File
vitest.config.ts— clear.
| // Vega-Lite ranks a mark type's block above `mark`, so a theme `line` or | ||
| // `point` value would outrank a `mark` key the caller or the spec sets. | ||
| const markKeys = setIn('mark'); | ||
| for (const key of ['line', 'point']) { |
There was a problem hiding this comment.
This guard drops only same-named keys, but the theme's point.fill (line 121, the card background token, the same as background on line 94) is read before any color, and filled points get no stroke. In real Vega-Lite renders, a spec's mark: {type: 'point', filled: true} draws invisible points, a line's point: true dots become gaps in the line, and a caller's or spec's mark: {color: '#c00000', filled: true} (or point: {color, filled: true}) paints the card colour instead of red. Leaving point.fill out when points are filled (a filled or color in mark/point config, a filled: true mark, a line point overlay), or dropping it, plus a real-render test for each case, would keep FR1's caller-on-top order.
…the named-style exception Co-authored-by: AKnassa <AKnassa@users.noreply.github.com>
|
/approve-spec cdc97a6 |
There was a problem hiding this comment.
Changes requested: the themed default is decided and filled point marks and mark-level dots keep their colour, but dots that config or a shape encoding turns on still vanish, and one prop doc still overstates the caller-wins order.
- The theme's point fill still hides dots that config or a shape encoding turns on:
drawsFilledPoint(packages/vega/src/vegaLiteConfig.ts:480-507) and the key check at:461-470miss the dots that a caller's or spec'sline.point,area.pointortrail.pointconfig, or ashapeencoding, turns on, so those dots render in the card background againstcomponent:VegaChartFR1 (reproduced locally with real Vega renders); detect the overlay as Vega-Lite does and add tests for those cases. VegaChartProps.compileOptionsstill omits the named-style exception:packages/vega/src/types.ts:170-171says the caller's config overrides the theme with no exception, unlike the README and the other JSDoc, and the record's gap row bounds the gap with "the config blocks it lists" although FR1 lists none.
CI has not run on this draft head; the 99 vega tests pass locally.
Claims and files checked
Review mode: same-head; reason: none
- Claim: Charts keeps its categorical token list private — verified (module-private list in
getChartColors.ts; charts files unchanged). - Claim: Vega's categorical range comes from the charts palette, ten slots as before — verified (
vegaLiteConfig.ts:126, palette tests). - Claim:
withAstryxConfigstays internal — verified (src/index.tsunchanged). - Claim: The core peer follows main's version, as charts does — verified (core 0.7.18 on the base, head and main; charts peers core 0.7.18).
- Claim: The new record states the order in one FR and its public concepts table names the props as built — verified (FR1; the table matches
VegaChartProps' own props). - Claim: Vega-Lite charts are themed from the active theme, and before this no theme config was applied — verified (tests; the base compile call passes only the caller's options).
- Claim: A series coloured blue in
<Chart>is the same blue here — verified (both read the charts token list throughgetChartColorsFromResolver). - Claim: Charts and core are peers, and the manifest test checks every imported Astryx package is a peer — verified (test passes locally;
src/has no subfolders). - Claim: Native Vega specs are not themed; pass
parseConfig— verified (VegaChart.tsx:123-125, native View test). - Claim: A chart with no spec renders an empty container and reports through
onError— verified (test). - Claim: Precedence is theme, then caller config, then spec config, apart from named styles — false for dots that config or a shape encoding turns on (finding).
- Claim: Merging is recursive, so a partial override replaces one key — verified (tests).
- Claim: Per-axis theme values step aside for caller and spec axis keys, with both examples — verified (tests).
- Claim: A partial config keeps the theme for every key it leaves out — verified (tests).
- Claim: The theme hides field-derived titles; an encoding title or
title: undefinedin axis or legend config brings them back, and a title string in config renders none — verified (renders run locally). - Claim: Vega is private and outside the release group, and the changeset check rejects private packages — verified (
.changeset/config.json,scripts/check-changesets.mjs). - Claim: Vega ships to the canary tag from main — reported (the canary job publishes private canary-only packages and stamps their Astryx peers to the canary version; registry state not checked).
- Claim: No release-group package changes, and the lab interaction layers are out of scope — verified (diff).
- Claim: The vega tests run in CI under fork rules and cover the listed cases — reported (CI has not run on this draft head; each listed case is in the tests, which pass locally).
- Claim: Writing rubric results — reported.
- Claim: Named styles lose to the theme, and the gap is in the record's verification map — verified.
- Claim: Caller-on-top holds for keys such as
axis,axisX,legend,title,markandpoint— verified for those keys (tests). - Claim: The owner approved the record — verified (approval for this head).
- Claim: A Charts change now also typechecks vega — verified (scope function run locally on both trees).
- Claim: Carried fixes for placed, inherited and repeated layer axes,
markkeys overline/point, and per-mark band padding — verified (tests). - Claim: The point fill steps aside so filled points keep their colour — false for dots from
line/area/trailpointconfig or ashapeencoding (finding). - Claim: The record's approval came at an earlier head, for the owner to confirm — superseded (the owner approved this head).
- Claim: Main is merged in without a rebase, keeping the author's commits — verified (history).
- File
.github/scripts/typecheck-scope.test.mjs— clear. - File
docs/specs/components/VegaChart/VegaChart.spec.md— gap row bound (prop-doc finding). - File
packages/vega/README.md— clear. - File
packages/vega/package.json— clear. - File
packages/vega/src/VegaChart.doc.mjs— clear. - File
packages/vega/src/VegaChart.test.tsx— clear. - File
packages/vega/src/VegaChart.tsx— clear. - File
packages/vega/src/manifest.test.ts— clear. - File
packages/vega/src/types.ts— prop-doc finding. - File
packages/vega/src/vegaLiteConfig.test.ts— no config- or shape-driven dot case (point fill finding). - File
packages/vega/src/vegaLiteConfig.ts— point fill finding. - File
packages/vega/tsconfig.build.json— clear. - File
packages/vega/tsup.config.ts— clear. - File
pnpm-lock.yaml— clear. - File
vitest.config.ts— clear.
| filled?: boolean; | ||
| point?: unknown; | ||
| }; | ||
| if ((type === 'point' && filled === true) || (point && point !== false)) { |
There was a problem hiding this comment.
This misses the dots Vega-Lite turns on outside the mark object: point in the caller's or the spec's line, area or trail config, and a shape encoding on a line (Vega-Lite's path-overlay normalizer makes them filled points). They still read the theme's point.fill, so compileOptions={{config: {line: {point: true}}}} renders background-coloured gaps where the dots were. Checking point in that mark type's config from both configs and encoding.shape here, with real-render tests for a caller line.point, a spec config.line.point and a shape encoding, would cover them.
| * `config` here is merged *on top of* the Astryx theme config the component | ||
| * applies by default, so it overrides the theme rather than replacing it. |
There was a problem hiding this comment.
This still reads as unconditional: a caller's style['guide-label'] does not override the theme's axis label text. The sentence from CompileOptions.config above ("A named style entry does not outrank the theme's axis, legend and title text.") would match the README and the record.
…s on keep their color Co-authored-by: AKnassa <AKnassa@users.noreply.github.com>
|
/approve-spec 680530d |
Maintainer reshape (old pull request)
This pull request is carried forward by a maintainer under maintainer edits, keeping AKnassa's commits and authorship. Current
mainis merged in (no rebase). The reshape keeps the API delta to whatcomponent:VegaChartrecords:@astryxdesign/chartsdoes not exportCATEGORICAL_TOKENS. The Vega categorical range comes fromgetChartColorsFromResolver(token).categorical(10), the compositional charts' palette; ten slots is the range Vega used before.withAstryxConfigstays internal.VegaChartapplies it, and@astryxdesign/vegadoes not export it.@astryxdesign/corepeer follows main's version, as@astryxdesign/chartsalready does.component:VegaChartrecord (docs/specs/components/VegaChart/VegaChart.spec.md) states the themed-by-default order in one FR: Astryx theme config as the base, the caller'scompileOptions.configon top, the spec's own inline config last; a native Vega spec passes through untouched. Its Public concepts table names the props as built.What this does
Vega-Lite charts now pick up the Astryx theme out of the box, sharing one palette with
@astryxdesign/chartsinstead of keeping a private copy. A native Vega spec is unchanged.What changed
VegaChartcompiles a Vega-Lite spec with the Astryx theme config frombuildVegaLiteConfigas its base, read from the active<Theme>(component:VegaChartFR1). Before this,VegaChartnever applied that config, so a chart rendered with Vega's defaults.@astryxdesign/chartspalette throughgetChartColorsFromResolver(token).categorical(10), so a series colored blue in a<Chart>is the same blue here. Before this, vega kept its own copy of the ten categorical tokens.@astryxdesign/chartsand@astryxdesign/coreare peer dependencies of@astryxdesign/vega, so an app shares one copy of each.manifest.test.tschecks that every@astryxdesign/*package the wrapper imports is a peer.parseConfigfor those.specstill renders an empty container and reports throughonError.Precedence
Weakest first: the Astryx theme config, then
compileOptions.config, then the spec's own inlineconfig. Merging is recursive, so a partial override such as{axis: {grid: true}}replaces only that key. The theme also sets per-axis blocks (axisX,axisY,axisXQuantitative,axisYQuantitative). Vega-Lite resolvesaxis, then the orient blocks, thenaxisXandaxisY, then the type blocks such asaxisQuantitative, then the channel-and-type blocks. For each key that the caller or the spec sets in an axis block resolved earlier for the same axes, the theme's per-axis value for that key is left out, so the caller's or the spec's value wins:{axis: {grid: true}}adds the x grid, and{axisY: {grid: false}}removes the y grid. One exception: a namedstyleentry (such asstyle['guide-label']) does not outrank the theme's axis, legend and title text (see Known limits).Callers that pass a partial config
A chart that passes only part of a config (for example the
Lab/ChartTheming/Vegastory) gets the theme for every key it leaves out. The theme setstitle: nullon axes and legends, so titles derived from field names do not render under it; a caller brings titles back with a title in the encoding, or withtitle: undefinedfor that axis or legend in its config (a title string in the config renders no axis title).No changeset
@astryxdesign/vegaisprivate: true(0.1.3) and is not in the release group in.changeset/config.json, so it has no stable release, andscripts/check-changesets.mjsrejects a changeset that names a private package. It does ship to@canary: the canary job publishes canary-only packages frommain's tip, so canary users get the themed default and the two new peers at the next canary after this merges. This pull request changes no package in the release group (the charts files are back to main), so it has no changeset. The change reaches stable users when vega is published, through that release's own changeset.Scope
The lab interaction layers (
ChartBrush,ChartZoom,ChartSelect,useChartRange) are not part of this change.Writing rubric results
Record added:
component:VegaChart(FR1, the Public concepts table, and its verification row).Testing
Under fork rules the vega tests run in CI:
VegaChart.test.tsx(the compile path with the theme underneathcompileOptions, a missing spec, the rebuild policy across a color-mode change),vegaLiteConfig.test.ts(the config, the palette from the theme resolver, and the theme, caller and spec precedence compiled through real Vega-Lite), andmanifest.test.ts.Refs #977
Known limits
styleentries (guide-label,guide-title,group-title,group-subtitle, and styles named from the caller'saxisconfig). The caller-on-top order holds for config keys such asaxis,axisX,legend,title,markandpoint; this gap is recorded incomponent:VegaChart's verification map.Owner and land path
component:VegaChart). It merges through CI once review and the owner approval are in. A carry commit updates.github/scripts/typecheck-scope.test.mjs(a Charts change now also typechecks vega, which peers on charts).orientset in theaxisX,axisYoraxisconfig count as drawn there, so a caller's orient block (for exampleaxisTop) keeps its rank over the theme on that axis, ascomponent:VegaChartFR1 states. The theme'slineandpointvalues also step aside for a caller's or a spec'smarkkeys, its band padding is set per mark so a caller's per-mark keys apply, and axes a layer's views inherit or arepeatof layers draws count too. The theme's point fill, which paints a hollow point's center, steps aside when the chart may draw a filled point (afilledpoint mark, a line, area or trail mark'spointdots, apointsetting in aline,areaortrailconfig, or ashapeencoding) or the caller or the spec setsfilled,colororfillonmarkorpoint, so filled points keep their color. This changes which axis a theme value lands on for those charts. The owner's approval ofcomponent:VegaChartwas given at an earlier head; whether it covers this change is for the spec owner to confirm.