Repository navigation
fix(cli): export keeps a built one-mode theme in its mode in any viewer - #12683
josephfarina wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec e372e52 |
PR Analysis Report🔎 Preview ·
|
| Before | After | Change | |
|---|---|---|---|
| Job-minutes per PR update | 172.6 | 172.6 | 0 |
| Runner pool, runner-minutes a day | 51,495 | 51,495 | 0 (0%) |
| Average concurrent jobs | 35.8 | 35.8 | 0 |
| Time to green (median → this run) | 27.8 min | — | — |
| Runs a day | 298 | 298 | 0 |
Not measured (the jobs that use these keep their recent minutes above): .github/scripts/render-interaction-parity.browser.test.mjs.
Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.
Current run: CI concluded cancelled; parts of this report may be missing.
Generated by PR Enrichment workflow | View full report
|
/approve-spec fe4b155 |
There was a problem hiding this comment.
Changes requested: the engineering owner's approval settles the export's one-scheme rule, but the stylesheet fallback misreads real themes in both directions and the render worker now runs files the page only imports as text.
- The stylesheet fallback (
render-page.mjs:1086-1091) forces light on pages whose theme sets no colours of its own, such as a fonts-only or accent-only theme that followed a dark viewer before, so the changeset's and description's "written as before" claims are false. - A light-only theme built with
astryx theme buildthat sets a surface or card colour and exports nocolorModesstill exportslight darkand stays black on the dark canvas, because the build adds derivedlight-dark()status roles, so narrow the title, changeset and guide to themes that exportcolorModes(or fix the rule) and add a test that exports a built theme. rootThemeColorModes(page-worker.mjs:1503-1509) imports every local file beside an imported stylesheet, including files imported only as?rawtext, and the main module of any package whose stylesheet the page imports, so the export now executes code the page never runs.render-page.mjs:1084-1085re-implements the theme build'soneColorMode, and both files read the root theme name with a new regex besiderootThemeAttrs, so move the lookup into one shared helper and trust the worker's normalised value.- The description says a two-mode
colorModesexport keeps both modes, but the worker turns it intonull(page-worker.mjs:1520) so the stylesheet rule decides, and the test atrender.test.mjs:345passes only because its stylesheet useslight-dark(). - Miss: the worker reads
colorModesby running theme modules, whilebuiltColorModeinfoundation/discovery/theme-imports.mjsalready reads it without running anything fortheme addand the theme preview, so call it with the root theme's module file, which also removes the execution above. - The description cites the CLI architecture record and the export guide for "a rendered file shows the page in any viewer as the app shows it", but neither says that (the guide said colours follow the viewer's setting), so cite the owner's decision on this pull request instead.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Changeset: a page whose root theme draws in light only stays readable in a dark viewer: false for a built light-only theme with no
colorModes(it still exportslight dark); true with a one-modecolorModesexport. - Changeset: before, the file declared both schemes, so a dark viewer showed its dark canvas behind dark text: verified on the base export.
- Changeset and description: the modes come from the theme's
colorModesexport when it has one: verified for one mode; false for a two-mode export (page-worker.mjs:1520). - Changeset and description: otherwise from the built stylesheets, where no dark rule means light only: implemented as described (
render-page.mjs:1070,:1086-1091), but built themes that set colours always carry derivedlight-dark()roles. - Changeset and description: a one-mode page declares only that scheme and paints the theme's page colour: verified (
render-page.mjs:1101-1103,:1764,:1771, and in Chromium). - Changeset and description: a two-mode theme, or a page with no theme, is written as before, byte for byte: false for themes that set no colours; true for themes with a dark rule and pages with no theme.
- Description: the file shows the page as the app shows it, per the CLI architecture record and the export guide: false; neither states it.
- Description: the app shows a light-only theme in light whatever the system setting: true only when the app passes the theme's mode to
Theme, which already exported light before this change. - Description: the theme module is looked up only beside a stylesheet the page imports: partly false; any local file in that folder is imported, text-only imports included.
- Description: before the change the light-only page gets both schemes; after it, Chromium in dark shows
light, the page colour and dark heading text: verified for the test fixture and for acolorModestheme; not for a built light-only theme withoutcolorModes. - Description: a two-mode theme keeps
light darkwith a transparent root: verified for themes with alight-dark()value; false for themes that set no colours. - Description: in a phone and dark-mode page set, every page under a two-mode theme or no theme is byte-identical: contradicted for fonts-only and accent-only themes.
- Description: the listed tests pass: verified at this head (four node suites, 376 tests; the Chromium case, 2 tests); the two-mode export case does not isolate the export.
- Description: eslint passes on the changed files: verified (0 errors).
- Description: one defect is restored and no default or visual change hides under the bug-fix label: false for two-mode themes that set no colours, whose exported scheme changes.
- Description: public text holds no internal context: verified.
Files:
.changeset/export-light-only-theme.md: two false claims (above)..github/scripts/render-interaction-parity.browser.test.mjs: passes, but only with hand-written theme stylesheets the build never writes.packages/cli/api/render/render.test.mjs: passes, with hand-written theme stylesheets.packages/cli/assets/docs/tree/export-pages.doc.mjs: repeats the stylesheet rule that misreads fonts-only and built light-only themes.packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear.packages/cli/foundation/render/page-worker.mjs: executes text-only imports; drops a two-mode export; duplicatesbuiltColorModeand the root-theme lookup.packages/cli/foundation/render/render-page.mjs: forces light on two-mode pages; misses built light-only themes; copied predicate.packages/cli/foundation/render/render.test.mjs: the two-mode export case does not test what it claims.
|
/approve-spec 09be70c |
There was a problem hiding this comment.
Changes requested: light-only themes now stay light in a dark viewer and two-mode themes are unchanged, but the stylesheet inference also turns the dark-only Gothic theme light, and the description no longer matches the code.
oneColorModeOf(render-page.mjs:1130-1131) calls any theme with plain page colours light, so pages under the published dark-only Gothic theme are now writtencolor-scheme: light, and in a dark viewer its Slider and Spinner track turns#CCD3DBon the dark card (fill against track 5.68:1 to 1.32:1); inferlightonly from light page colours, keep Gothic dark or two-mode, and add a test that exports the Gothic template.- The export guide's new sentence "A page whose root theme draws in one mode keeps it" (
export-pages.doc.mjs:60) is false for Gothic until the inference is fixed. - The description still says
page-worker.mjsreadscolorModeswith the theme build'soneColorModeand that any of four dark markers decides, while this head changesrender-page.mjs,color-modes.mjsandtheme-imports.mjsand reads only three page-colour tokens, so update its restoration and Scope sections to the code. - The description cites the CLI architecture record and the export guide for "a rendered file shows the page in any viewer as the app shows it", but neither says that, so cite the engineering owner's decision on this pull request instead.
The six issues from the previous review (fonts-only themes forced light, built light-only themes missed, executed text imports, the copied mode predicate, two-mode colorModes ignored, and the duplicate colorModes reader) are fixed.
Claims and files checked
Review mode: incremental; reason: none
Claims:
- Changeset: a page whose root theme draws in light only stays readable in a dark viewer: verified for a light-only theme built with
astryx theme buildand in the Chromium case. - Changeset: before, the file declared both schemes, so a dark viewer showed its dark canvas behind dark text: verified on the base export.
- Changeset: the export reads the theme module's
colorModeswithout running it: verified (color-modes.mjsreads the file text; its test throws if the module runs). - Changeset: otherwise a theme that sets its page or text colours with no dark value draws in light only: implemented as written (
render-page.mjs:1084-1131), but false for the dark-only Gothic theme, which is written light. - Changeset: a fonts-only or accent-only theme keeps both modes: verified (built fonts-only page byte-identical to the base; unit cases).
- Changeset and description: a one-mode page declares only that scheme and paints the theme's page colour: verified (
render-page.mjs:1211-1213,:1879,:1886, and in Chromium). - Changeset and description: a page under a two-mode theme, or with no theme, is written as before, byte for byte: verified for the six two-mode published themes and a fonts-only theme.
- Description: the light-only page turns black-on-black in a dark viewer on the base: verified.
- Description: the fix uses
colorModes, otherwise no dark rule in the theme's stylesheets means light only: partly false; only the three page-colour tokens count. - Description: a rendered file shows the page as the app shows it, per the CLI architecture record and the export guide: false; neither says it.
- Description: the app shows a light-only theme in light whatever the system setting: true only when the app passes the theme's mode to
Theme. - Description:
page-worker.mjsfinds the theme module and readscolorModeswith the theme build'soneColorMode: false;page-worker.mjsis unchanged andrender-page.mjs:1144reads it withdeclaredColorModes. - Description:
oneColorModeOftakes a one-mode export, else four dark markers decide: partly false; the markers count only around page-colour declarations. - Description: Chromium before and after results, and the unchanged two-mode path: verified.
- Description: an 82-page set is byte-identical for two-mode and no-theme pages: not rerun in full; consistent with the nine themes exported here.
- Description: the listed regression tests exist and pass, and eslint passes: verified (383 node tests, 2 Chromium tests, 0 lint errors).
- Description: the Scope lists
page-worker.mjsandrender-page.mjs: incomplete;color-modes.mjsandtheme-imports.mjschange,page-worker.mjsdoes not. - Description: one defect is restored and no default or visual change hides under the fix: false for Gothic, whose written scheme changes.
- Description: public text holds no internal context: verified.
Files:
.changeset/export-light-only-theme.md: its light-only rule reads the dark-only Gothic theme as light..github/scripts/render-interaction-parity.browser.test.mjs: clear.packages/cli/api/render/render.test.mjs: clear; it has no dark-only theme case.packages/cli/assets/docs/tree/export-pages.doc.mjs: "keeps it" is false for Gothic; "page and text colors" differs from the code's "page or text".packages/cli/foundation/discovery/color-modes.mjs: clear.packages/cli/foundation/discovery/color-modes.test.mjs: clear.packages/cli/foundation/discovery/theme-imports.mjs: clear.packages/cli/foundation/render/render-page.mjs: dark-only themes written light (:1130-1131).packages/cli/foundation/render/render.test.mjs: clear; it has no case for dark plain page colours.
09be70c to
552c2c3
Compare
552c2c3 to
d1d014b
Compare
|
/approve-spec d1d014b |
There was a problem hiding this comment.
Changes requested: the export now keeps a theme that draws in one mode in that mode, and pages under two-mode themes are written byte for byte as before, but one claim in the description is false.
- Miss: the description says the file shows the page "as the app shows it", but a theme with no
colorModesexport gets no mode fromtheme add, so in an app itsThemefollows the viewer while the file now keeps one mode; reword it to say the file keeps the theme's one mode, read fromcolorModesor inferred from its root page and text colors, and that for a theme withoutcolorModesthis differs from the app.
CI has not run at this head because its commit message ends with [skip ci], so the required checks still need a run before merge. Non-blocking: a dark rule written with an attribute flag ([data-theme="dark" i]) or a class selector is not read as a mode condition, so such a theme is written in the mode its root colors give.
Claims and files checked
Review mode: full; reason: rebase
Claims (changeset):
- A page whose root theme draws in one mode stays readable in a viewer of the other scheme: verified (exports on both trees and Chromium).
- Before, the file always declared both schemes: verified (the base scheme rules and meta tag).
- The theme module's
colorModesdecides when present, read without running it: verified (built and packaged modules; the re-export test that throws if run). - Otherwise a light page with dark text is light only and a dark page with light text is dark only: verified (render tests, exports).
- Any color form the theme editor reads counts: verified (named,
hsl(),oklch()cases). - Fonts-only, accent-only,
light-dark(), unreadable and one-scheme colors keep both modes: verified (render tests). - A one-mode page declares only that scheme and paints the theme's page color: verified.
- Two-mode and no-theme pages are written as before: verified (six two-mode templates byte-identical; two-mode control).
Claims (description):
- The base file declared both schemes for every page: verified.
colorModesfirst, else the root's page and text colors from the page's stylesheets: verified.- One shared static
colorModesreader for theme add, the preview and the export, keeping two modes as its own value: verified. - The export,
render()and guide docs describe the rule: verified. resolvePackageModuleis exported for the module lookup: verified.- The color reader moves unchanged and its users import it from the new module: verified (moved bodies identical; theme editor and palette tests pass).
- The listed rules (three tokens, derived status colors ignored, one-scheme conditions, root rule only, quoting, translucent page colors, zero specificity, lookup order, editor pages keep both): verified, except attribute flags (non-blocking).
- The export runs no theme module: verified.
- The Chromium cases (light-only in a dark viewer, Gothic in both viewers, the two-mode control): verified (they pass).
- The file shows the page "as the app shows it": false for themes without
colorModes. - The listed regression tests exist and pass: verified.
- Theme add, theme build, discovery, export and render suites pass at this head: verified.
- The 82-page phone set, the earlier heads' CI and the squash statement: not checkable from this pull request's history.
Files:
.changeset/export-light-only-theme.md: clear..github/scripts/render-interaction-parity.browser.test.mjs: clear.packages/cli/api/render/render.doc.mjs: clear.packages/cli/api/render/render.test.mjs: clear.packages/cli/api/theme-edit/_color.mjs: clear.packages/cli/api/theme-edit/_css.mjs: clear.packages/cli/api/theme-edit/_tables.mjs: clear.packages/cli/api/theme/palette/generate/color.mjs: clear.packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear.packages/cli/clients/cli/commands/experimental-export.doc.mjs: clear.packages/cli/foundation/color/css-color.mjs: clear.packages/cli/foundation/discovery/color-modes.mjs: clear.packages/cli/foundation/discovery/color-modes.test.mjs: clear.packages/cli/foundation/discovery/module-exports.mjs: clear.packages/cli/foundation/discovery/theme-imports.mjs: clear.packages/cli/foundation/render/render-page.mjs: non-blocking note on attribute flags and class-based dark rules.packages/cli/foundation/render/render.test.mjs: clear.packages/cli/foundation/runtime/css-tree.mjs: clear.packages/cli/foundation/runtime/word-table.mjs: clear.
d1d014b to
76bca97
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the two record changes this head adds; the code change itself has no blocking finding.
- This head adds
architecture:cli-surfaceDEC-19 and rewords the last sentence ofspec:AST-050FR7, and neither has spec-owner approval yet: an engineering owner approves both as written by commenting/approve-spec 76bca97d0aba31f2fdae5346d97a45812ee751fe, or asks for changes, and the author may do so as an engineering owner. - Miss (optional wording fix): the export guide (
export-pages.doc.mjs) could say that a theme whosecolorModeslists both modes always follows the viewer, even when its root colors read as one mode.
In Chromium, exports under a light-only and a dark-only theme now keep their mode in a viewer of the other scheme, and pages under two-mode themes are byte-identical to before. CI has not run on this head yet, because its commit message carries [skip ci].
Claims and files checked
Review mode: full; reason: rebase
- Claim: a page whose root theme draws in one mode stays readable in a viewer of the other scheme: verified in Chromium, light-only theme in a dark viewer and the Gothic template in a light viewer.
- Claim: before, the file declared both schemes, so a dark viewer showed its dark canvas behind a light-only theme's dark text: verified on the base export.
- Claim:
colorModesis read without running the module, following re-exports, and a two-mode export keeps both modes: verified by the color-modes and render tests. - Claim: without
colorModes, the root page and text colors decide by lightness, and fonts-only, accent-only,light-dark(),var(), translucent or conditional colors keep both modes: verified by the unit and render tests and by exports in both trees. - Claim: a one-mode page declares one scheme and paints the theme's page color on the document: verified (
render-page.mjs:1445,:2252,:2260). - Claim: a page under a two-mode theme or no theme is written byte for byte as before: verified for the six two-mode template themes and two hand-written themes against the base.
- Claim: for a theme without
colorModesthe file keeps one mode while an app follows the viewer: verified against the app-themes spec (FR5) and the Theme component's system mode. - Claim: the theme editor's color reader and the luminance formula move unchanged, and the theme editor and palette generator import them: verified line by line.
- Claim:
resolvePackageModuleis exported, and theme add and the theme preview use the sharedcolorModesreader: verified. - Claim: the listed regression tests exist and pass at this head: verified (the render, discovery, theme editor and palette suites pass); the earlier head's CI run and the 82-page phone set were not reproduced.
- Claim: DEC-19 states the rule as the code applies it, and FR7 changes one sentence: verified.
- Claim: the title's scope (a built one-mode theme keeps its mode in any viewer): verified.
- Files: all 22 changed files visited; the two record files wait on owner approval,
export-pages.doc.mjscarries the optional wording note, and the other 19 are clear.
76bca97 to
8d5a88d
Compare
|
/approve-spec 8d5a88d |
8d5a88d to
3fe66d2
Compare
|
/approve-spec 3fe66d2 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The head commit's message carries [skip ci], so the required checks need a run before merge.
No blocking findings; an engineering owner approved the two record changes for this head. Two small, non-blocking suggestions sit inline: two file headers say the palette generator uses the new color reader, which it no longer does, and the export guide's colorModes sentence reads as if only a one-mode export stops the color inference.
Claims and files checked
Review mode: full; reason: rebase
- Claims
- A one-mode root theme's exported page stays readable in a viewer of the other scheme: verified (Chromium frames in a dark viewer; the light-only case in
api/render/render.test.mjs). - Before, the file always declared both schemes: verified (the base writes
light darkfor the same page). colorModesis read without running the module, following re-exports, and a two-mode export keeps its own value: verified (foundation/discovery/color-modes.mjsand its tests).- Without
colorModes, agreeing opaque root page and text colors decide, in any CSS color form the theme editor reads: verified (render-page.mjs:1311-1375and the unit cases). - Fonts-only or accent-only themes,
light-dark(), unreadable or translucent page colors, and page or text colors under a light or dark condition keep both modes, and media-surface colors do not count: verified (unit cases). - Only the root rule, or
:scopein an@scopethat starts there, sets the root colors, however attributes are quoted or flagged, with.light/.darkclasses read as conditions: verified (unit cases). - A one-mode page declares only that scheme and paints the theme's page color at zero specificity: verified (
render-page.mjs:1456-1457, frames). - Two-mode and theme-less pages, and the theme editor's markup-only previews, are written as before: verified (the scheme strings are unchanged when no mode is found; tests).
theme addand the theme preview read through the same reader and still carry only one mode: verified (theme-imports.mjs:277-279,_preview.mjs:2508, tests).- The theme module is found beside the stylesheet, then through the package's
./builtentry, then its own entry, by the imported package name, linked and nested-distpackages included: verified (render-page.mjs:1395-1446, tests). - The dark-only Gothic theme exports dark: verified (the built-Gothic test).
- The color reader moved unchanged, its two formula copies pinned to the generated palette engine: verified (line comparison;
css-color.test.mjs). foundation/never imports fromapi/: verified (no non-test import at this head).- Two-mode and theme-less pages are byte-identical across an 82-page set: not reproduced; the code path writes the same bytes for them.
- The two record changes state the rule as coded: verified (DEC-19 and the FR7 sentence against
render-page.mjs). - The changed suites pass at this head: verified for the suites run here; the browser parity cases were not run.
- A one-mode root theme's exported page stays readable in a viewer of the other scheme: verified (Chromium frames in a dark viewer; the light-only case in
- Files
.changeset/export-light-only-theme.md: clear..github/scripts/render-interaction-parity.browser.test.mjs: clear.docs/architecture/cli-surface.md: clear.docs/specs/AST-050-app-themes/spec.md: clear.packages/cli/api/render/render.doc.mjs: clear.packages/cli/api/render/render.test.mjs: clear.packages/cli/api/theme-edit/_color.mjs: clear.packages/cli/api/theme-edit/_css.mjs: clear.packages/cli/api/theme-edit/_tables.mjs: clear.packages/cli/assets/docs/tree/export-pages.doc.mjs: non-blocking wording suggestion.packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear.packages/cli/clients/cli/commands/experimental-export.doc.mjs: clear.packages/cli/foundation/color/css-color.mjs: non-blocking header suggestion.packages/cli/foundation/color/css-color.test.mjs: clear.packages/cli/foundation/discovery/color-modes.mjs: clear.packages/cli/foundation/discovery/color-modes.test.mjs: clear.packages/cli/foundation/discovery/module-exports.mjs: clear.packages/cli/foundation/discovery/theme-imports.mjs: clear.packages/cli/foundation/render/render-page.mjs: clear.packages/cli/foundation/render/render.test.mjs: clear.packages/cli/foundation/runtime/css-tree.mjs: non-blocking header suggestion.packages/cli/foundation/runtime/word-table.mjs: clear.
3fe66d2 to
7ee89de
Compare
|
/approve-spec 7ee89de |
There was a problem hiding this comment.
Changes requested: a built light-only theme whose stylesheet the page imports now stays light in a dark viewer, and the two record changes carry an engineering owner's approval for this head, but two gaps remain on lines unchanged since the earlier approval.
- Miss: the mode read uses the raw text of the stylesheets the page imports (
packages/cli/foundation/render/render-page.mjs:2255), so the same built theme reached through@import './retro.css'in the page's CSS is writtencolor-scheme: light darkand shows black on black in a dark viewer, which DEC-19 does not allow; follow each@importasexpandImportsdoes and add a test. - Miss: the changeset (
.changeset/export-light-only-theme.md:5), the export guide, the share-a-page guide, the command doc and therender()doc promise that any one-mode theme keeps its mode, but a theme passed toThemeunbuilt injects its CSS only at runtime and is still exportedlight dark; name built themes in those sentences or read unbuilt themes too.
The two earlier non-blocking suggestions still apply (the palette-generator lines in two file headers, and the export guide's two-mode colorModes wording). CI has not run on this head yet because its commit message carries [skip ci].
Claims and files checked
Review mode: full; reason: rebase
- Claims
- A one-mode root theme's exported page stays readable in a viewer of the other scheme: verified for a built theme whose stylesheet the page imports directly (Chromium frames, the light-only test, the browser parity cases); false for a stylesheet reached through
@importand for an unbuilt theme (blocking findings). - Before, the file always declared both schemes: verified (the base writes
light darkfor the same page). colorModesis read without running the module, following re-exports, and a two-mode export keeps both: verified (foundation/discovery/color-modes.mjsand its tests).- Without
colorModes, agreeing opaque root page and text colors decide, in any CSS color form the theme editor reads: verified for stylesheets the page imports directly; false through@import(first blocking finding). - Fonts-only or accent-only themes,
light-dark(), unreadable or translucent page colors, and page or text colors under a light or dark condition keep both modes; media-surface colors do not count: verified (unit cases). - Only the root rule, or
:scopein an@scopethat starts there, sets the root colors, however attributes are quoted or flagged, with.light/.darkclasses read as conditions: verified (unit cases). - A one-mode page declares only that scheme and paints the theme's page color at zero specificity: verified (
render-page.mjs:1505-1506,:2370,:2378, frames). - Two-mode and theme-less pages, and the theme editor's markup-only previews, are written as before: verified (the scheme strings are unchanged when no mode is found; tests).
theme addand the theme preview read through the same reader and still carry only one mode: verified (theme-imports.mjs:277-280, tests).- The theme module is found beside the stylesheet, then through the package's
./builtentry, then its own entry, by the imported package name, linked and nested-distpackages included: verified (render-page.mjs:1444-1495, tests). - The dark-only Gothic theme exports dark: verified (the built-Gothic test, and a build of the published theme).
- The color reader moved unchanged, its two formula copies pinned to the generated palette engine: verified (line comparison,
css-color.test.mjs). foundation/never imports fromapi/: verified (no non-test import).resolvePackageModuleresolves the exports map, elsemodule,mainor the index file: verified (module-exports.mjs:420-460).- The two record changes state the rule as the code applies it: false for a stylesheet reached through
@import(first blocking finding). - Two-mode and theme-less pages are byte-identical across an 82-page set: not reproduced; the code path writes the same bytes for them.
- The changed suites and the Chromium cases pass: verified for the suites run here; three older export tests fail the same way on the base.
- A one-mode root theme's exported page stays readable in a viewer of the other scheme: verified for a built theme whose stylesheet the page imports directly (Chromium frames, the light-only test, the browser parity cases); false for a stylesheet reached through
- Files
.changeset/export-light-only-theme.md: blocking (unbuilt themes)..github/scripts/render-interaction-parity.browser.test.mjs: clear.docs/architecture/cli-surface.md: clear.docs/specs/AST-050-app-themes/spec.md: clear.packages/cli/api/render/render.doc.mjs: blocking (unbuilt themes).packages/cli/api/render/render.test.mjs: clear; needs an@importcase.packages/cli/api/theme-edit/_color.mjs: clear.packages/cli/api/theme-edit/_css.mjs: clear.packages/cli/api/theme-edit/_tables.mjs: clear.packages/cli/assets/docs/tree/export-pages.doc.mjs: blocking (unbuilt themes); non-blocking two-mode wording.packages/cli/assets/docs/tree/share-a-page.doc.mjs: blocking (unbuilt themes).packages/cli/clients/cli/commands/experimental-export.doc.mjs: blocking (unbuilt themes).packages/cli/foundation/color/css-color.mjs: non-blocking header suggestion.packages/cli/foundation/color/css-color.test.mjs: clear.packages/cli/foundation/discovery/color-modes.mjs: clear.packages/cli/foundation/discovery/color-modes.test.mjs: clear.packages/cli/foundation/discovery/module-exports.mjs: clear.packages/cli/foundation/discovery/theme-imports.mjs: clear.packages/cli/foundation/render/render-page.mjs: blocking (@import).packages/cli/foundation/render/render.test.mjs: clear.packages/cli/foundation/runtime/css-tree.mjs: non-blocking header suggestion.packages/cli/foundation/runtime/word-table.mjs: clear.
A page whose root theme draws in one mode is exported in that mode: the theme's colorModes export decides, read without running the module, and otherwise the opaque page and text colors the theme's root sets decide by lightness. Any page or text color set under a light or dark condition keeps both modes, as before. The theme editor's color reader moves to foundation/color so the export reads colors the same way. [skip ci]
7ee89de to
ee95725
Compare
|
/approve-spec ee95725 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because its commit message carries [skip ci].
astryx experimental export now keeps a built one-mode theme in its mode in any viewer, including a theme stylesheet the page reaches through @import, and the two record changes carry an engineering owner's approval for this head. The earlier @import and unbuilt-theme findings are fixed, as are the earlier header and export-guide suggestions.
- Non-blocking: the changeset's first sentence still reads as covering every one-mode theme; adding "built" ("a page whose root theme is built and draws in one mode stays readable in a viewer of the other scheme") would match the title and the docs.
Claims and files checked
Review mode: full; reason: rebase
- Claims
- A page whose root theme draws in one mode stays readable in a viewer of the other scheme: verified for built themes imported directly or through
@import(tests, Chromium frames); the changeset's first sentence also reads as covering unbuilt themes, which the same entry then excludes (non-blocking wording). - Before, the file always declared both schemes: verified (the base writes
light darkfor the same pages). colorModesis read without running the module, following re-exports, and a two-mode export keeps both: verified (color-modes.mjs, its tests).- Without
colorModes, agreeing opaque root page and text colors decide by lightness, in any CSS color form the theme editor reads: verified (unit cases for hex, named,rgb(),hsl(),oklch()). - A theme stylesheet reached through
@importin the page's CSS counts, with the inliner's resolution and conditions, and one imported for a single scheme keeps both: verified (three export tests). - Fonts-only and accent-only themes,
light-dark(), unreadable or translucent page colors, and page or text colors under a light or dark condition keep both; media-surface colors and the derived status colors built themes carry do not count, and text counts by its own color whatever its alpha: verified (unit cases, the built-theme export test). - Only the root rule, or
:scopein an@scopethat starts there, sets the root colors, however attributes are quoted or flagged, with.light/.darkclasses read as conditions: verified (unit cases). - A theme passed to
Themeunbuilt counts only by what the page's own stylesheets set on its root: verified (the mode read uses only stylesheet text). - A one-mode page declares only that scheme and paints the theme's page color with no added specificity, so a page's own unlayered
htmlbackground still wins: verified (render-page.mjs:1581,:2465,:2473, frames). - Two-mode and theme-less pages, and the theme editor's previews, are written as before: verified (exact two-scheme string test, markup-only test).
theme addand the theme preview use the same reader and still carry only one mode: verified (theme-imports.mjs:277, tests).- The theme module is found beside the stylesheet, then through the package's
./builtentry, then its own entry, linked and nested-distpackages included: verified (render-page.mjs:1520, tests). - The dark-only Gothic theme exports dark: verified (built-Gothic export test).
- The color reader moved unchanged, with its two formula copies pinned to the generated palette engine: verified (line comparison,
css-color.test.mjs). foundation/code never imports fromapi/: verified for non-test code;css-color.test.mjsimports the palette engine only to pin the copies.resolvePackageModuleresolves the exports map, elsemodule,mainor the index file: verified (existing body, now exported).- The two record changes state the rule as the code applies it: verified.
- Two-mode and theme-less pages are byte-identical across an 82-page set: not reproduced; the code writes the base's bytes when no mode is found.
- The changed suites, ESLint and the knowledge check pass at this head: verified for the suites, ESLint and the knowledge check run here; the Chromium parity cases run only in CI, which has not run at this head.
- The full local CI half passed at an earlier head: not checkable at this head and not relied on.
- A page whose root theme draws in one mode stays readable in a viewer of the other scheme: verified for built themes imported directly or through
- Files
.changeset/export-light-only-theme.md: non-blocking wording suggestion..github/scripts/render-interaction-parity.browser.test.mjs: clear.docs/architecture/cli-surface.md: clear.docs/specs/AST-050-app-themes/spec.md: clear.packages/cli/api/render/render.doc.mjs: clear.packages/cli/api/render/render.test.mjs: clear.packages/cli/api/theme-edit/_color.mjs: clear.packages/cli/api/theme-edit/_css.mjs: clear.packages/cli/api/theme-edit/_tables.mjs: clear.packages/cli/assets/docs/tree/export-pages.doc.mjs: clear.packages/cli/assets/docs/tree/share-a-page.doc.mjs: clear.packages/cli/clients/cli/commands/experimental-export.doc.mjs: clear.packages/cli/foundation/color/css-color.mjs: clear.packages/cli/foundation/color/css-color.test.mjs: clear.packages/cli/foundation/discovery/color-modes.mjs: clear.packages/cli/foundation/discovery/color-modes.test.mjs: clear.packages/cli/foundation/discovery/module-exports.mjs: clear.packages/cli/foundation/discovery/theme-imports.mjs: clear.packages/cli/foundation/render/render-page.mjs: clear.packages/cli/foundation/render/render.test.mjs: clear.packages/cli/foundation/runtime/css-tree.mjs: clear.packages/cli/foundation/runtime/word-table.mjs: clear.
| '@astryxdesign/cli': patch | ||
| --- | ||
|
|
||
| [experimental] `astryx experimental export`: a page whose root theme draws in one mode stays readable in a viewer of the other scheme. Before, the file declared both color schemes, so a dark viewer showed its dark canvas behind a light-only theme's dark text. The export reads the theme module's `colorModes` export when it has one, without running the module. Otherwise it reads the page or text colors the theme's compiled stylesheet, which the page imports (directly or through an `@import` in its own CSS), sets on its root: a light page with dark text draws in light only, and a dark page with light text in dark only. Any color the theme editor reads counts (hex, a named color, `rgb()`, `hsl()`, `oklch()` and the other CSS color forms). A theme that sets neither (a fonts-only or accent-only theme), sets a `light-dark()` color (a value for each mode), sets one the export cannot fix (such as a `var()`), or sets any page or text color under a light or dark condition keeps both modes, as before. A one-mode page declares only that scheme and paints the theme's own page color on the document. For a theme passed to `Theme` unbuilt, whose CSS is injected only at run time, only what the page's own stylesheets set on that theme's root counts. A page whose theme draws in both modes, or that has no theme, is written as before. |
There was a problem hiding this comment.
Non-blocking: this first sentence reads as covering a theme passed to Theme unbuilt, which the same entry later excludes. Naming built themes here, as the title does, says it once:
[experimental] `astryx experimental export`: a page whose root theme is built and draws in one mode stays readable in a viewer of the other scheme.
- #12843 feat(Table): column headings follow the Table's textOverflow Author: @josephfarina - #12924 docs(Table): how long tokens wrap in a data-driven table Author: @josephfarina - #12683 fix(cli): export keeps a built one-mode theme in its mode in any viewer Author: @josephfarina
|
Landed in #12973. |
User impact
Someone exports a page whose theme draws in light only (a theme with no dark tokens, such as a retro desktop theme) and opens the file in a viewer that is set to dark mode. The page turns black-on-black: the viewer paints its dark canvas, and the theme's dark text sits on it. The same file written for a dark-only theme must stay dark in a light viewer, or Core's tracks and fills, which follow the page's scheme, turn light under the theme's dark surfaces.
Problem and solution fit
The fix reads which modes the page's root theme draws. It uses the theme's
colorModesexport when it has one. Otherwise the page and text colors the theme's root sets in the stylesheets the page imports (its built stylesheet, or the page's own CSS) decide: a light page with dark text draws in light only, and a dark page with light text in dark only. A page whose theme draws in one mode declares only that scheme and paints the theme's own page color on the document, so it stays readable in a viewer of the other scheme.Expected behavior and authority
The owner's decision on this pull request: a page whose theme draws in one mode is exported in that mode, so a light-only theme stays light in a dark viewer. The file keeps the theme's one mode, read from
colorModesor inferred from its root page and text colors. For a theme withoutcolorModesthis differs from an app:theme addpasses such a theme no mode, so in the app itsThemefollows the viewer. A theme that draws in both modes, or a page with no theme, keeps following the viewer.Smallest restoration
foundation/discovery/color-modes.mjs: one shared reader of a theme's modes. It reads the theme module'scolorModesexport statically, following re-exports, without running the module (the same readertheme addand the theme preview use), and keeps a two-mode export as its own value.experimental exportandrender()docs and the share-a-page guide: the file follows the viewer's scheme unless the page's root theme draws in one mode, which the file keeps.foundation/discovery/module-exports.mjs: exportsresolvePackageModule, the package's exports map, else itsmodule,mainor index file, for a bare specifier, which the theme module lookup uses.foundation/color/css-color.mjs(withcss-color.test.mjs, which pins its formula copies to the generated palette engine over a grid): the theme editor's CSS color reader (hex, named colors,rgb(),hsl(),oklch()and the other CSS color forms) and its relative luminance move here unchanged, so the theme editor and the export read colors one way.api/theme-edit/_color.mjs,_css.mjsand_tables.mjsimport them from there. The palette'scolor.mjsis generated from Core and stays as generated; the reader keeps its own OKLab-to-linear and sRGB-to-linear helpers (the same formulas), becausefoundation/never imports fromapi/.foundation/render/render-page.mjs: when the root theme exports nocolorModes, the export reads the page and text colors (--color-background-body,--color-background-surface,--color-text-primary) that the theme's own compiled stylesheet sets on its root; that stylesheet counts whether the page imports it directly or through an@importin its own CSS (followed with the sameresolveImportthe refusal pre-scan and the inliner use, and read inside the import's@media,supports()andlayer()conditions through the inliner's ownunderImportConditions, so a theme imported for one scheme keeps both modes). A theme passed toThemeunbuilt injects its CSS only at run time, which the render does not read, so only what the page's own stylesheets set on that theme's root counts; the docs, the changeset and DEC-19 say so. A light page with dark text draws in light only. A dark page with light text draws in dark only (covered by theoneColorModeOfunit cases; the dark-only Gothic theme is decided by its owncolorModes = ['dark']export). A theme that sets neither (a fonts-only or accent-only theme), or sets alight-dark()color (a value for each mode) or one the color reader cannot fix (such as avar()), keeps both modes. Derived status colors that every built theme carries don't count. Any page or text color set under a light or dark condition anywhere in a stylesheet that names the theme (aprefers-color-schemequery,notforms included, or adata-themerule, nested or in a selector list) keeps both modes, as before: the export never guesses one mode past such a rule. A media surface's own colors (data-astryx-media) don't count, while a component's light or dark block that only keeps out of media surfaces (:not(... [data-astryx-media] ...)) does. Only the root theme's own root rule (its attribute, or:scopein an@scopewhose start is exactly that attribute) sets the root's colors; a nested rule, a part, or ato (...)limit does not. Attribute selectors read the same however they are quoted, and a flagged one ([data-theme="dark" i]) by its flag, and a.light/.darkclass counts as a light or dark condition. A translucent page color keeps both modes (the guide says an opaque page color); text is light or dark by its own color, whatever its alpha. The one-mode rule adds no specificity, so a page's own unlayeredhtmlbackground still wins (one inside@layerdoes not). The theme module is looked up from the theme's stylesheet: the module with the stylesheet's name beside it, then the installed package's./builtentry, then its own entry (by the package name the page imports the stylesheet as, resolved from the importing file astheme addfinds packages, so a linked package and a nesteddist/package.jsondon't hide it; a stylesheet the page reaches by path uses the installed package folder after the lastnode_modules). The theme editor's markup-only pages keep both schemes, since the editor shows each mode itself. A one-mode page gets:where(:root){color-scheme:<mode>;background-color:var(--color-background-body)}and<meta name="color-scheme" content="<mode>">.Evidence
color-scheme: light dark, the bug.light, the theme's page color on<html>, and dark heading text on it.astryx theme build, exportscolor-scheme: dark(through itscolorModesexport). In Chromium, Core's track color resolves to its dark value in both a dark and a light viewer.light darkwith a transparent<html>, and its file is unchanged.foundation/discovery/color-modes.test.mjs(the static reader, re-exports, a two-mode export),foundation/render/render.test.mjs(the decision: an export wins, a two-mode export keeps both even over a stylesheet with no dark value, light from the theme's own page and text colors, fonts-only and accent-only themes keep both, no theme),api/render/render.test.mjs(a light-only theme exports light with its page color; acolorModesexport wins over the stylesheet, for one mode and for both; themes built withastryx theme build: light page colors export light only, and a fonts-only or accent-only theme keeps both modes; the two-mode control; the dark-only Gothic theme built withastryx theme buildexports dark only), and.github/scripts/render-interaction-parity.browser.test.mjs(the Chromium cases: a light-only theme in a dark viewer, and the dark-only Gothic theme with Core's track color in a dark and a light viewer).Scope
Components: cli export (
foundation/render/render-page.mjs,foundation/discovery/color-modes.mjs,foundation/discovery/theme-imports.mjs), the shared color reader (foundation/color/css-color.mjs,foundation/runtime/word-table.mjs,foundation/runtime/css-tree.mjsheader),foundation/discovery/module-exports.mjsand its users in the theme editor (they importcss-color.mjs); recordsarchitecture:cli-surface(DEC-19) andspec:AST-050(FR7)Records
architecture:cli-surfaceDEC-19 states the export's one-mode rule as the code applies it:colorModesdecides; without it, fixed root page and text colors that all read as one mode keep that mode, unless a stylesheet naming the theme sets a page or text color under a light or dark condition (a media surface's own colors aside); everything else keeps both schemes.spec:AST-050FR7: one sentence now scopes "a theme that exports none draws both" to an app and points to cli-surface DEC-19. Nothing else in FR7 changes.Writing rubric results
Rejected:line.Testing
check:knowledge, Prettier and ESLint on the changed files.@imports to the theme's stylesheet, the "built theme" wording, cli-surface DEC-19 and the AST-050 FR7 sentence, the.light/.darkclass andi-flag conditions, the@scopestart and text-alpha predicates, the media-surface:not(...)rule, the package lookup by the name the page imports the package as (so a linked package'scolorModesis read), the export guide's wording, and their tests.ASTRYX_RENDER_PARITY_BROWSER=1 pnpm exec vitest run .github/scripts/render-interaction-parity.browser.test.mjs -t "theme in a dark viewer"(Chromium, the light-only and dark-only cases and the two-mode control): passes.preflight: pass ee95725