Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3d20b5d
experimental theme test: the selected-pill expectation returns ahead …
josephfarina Nov 18, 2026
9d44445
experimental theme: the states Core marks on a part's own element are…
josephfarina Nov 16, 2026
cd3a9fb
experimental theme: a part Core marks open is drawn open, so --state …
josephfarina Nov 16, 2026
fef7b50
fix(cli): --only always works as an escape from a group, a menu radio…
josephfarina Nov 16, 2026
bc13d48
experimental theme: a faint link keeps its own hue in its fix line, a…
josephfarina Nov 16, 2026
6803f4f
experimental theme how: one reader for a color with a shape, so a sel…
josephfarina Nov 16, 2026
fc89962
experimental theme pictures: a sample's plain text field drawn as the…
josephfarina Nov 16, 2026
f245fb3
experimental theme pictures: a page wider than the window is pictured…
josephfarina Nov 16, 2026
48c7dc2
experimental theme: a border on a bar is the bar's own unless its pie…
josephfarina Nov 16, 2026
d3ede62
experimental theme how: rows said of a part are its own rows; a part …
josephfarina Nov 16, 2026
9283091
experimental theme: a one-mode theme's text color on an image fill is…
josephfarina Nov 16, 2026
1b3bb72
experimental theme: how gives a text color for every variant only whe…
josephfarina Nov 16, 2026
97b65a1
experimental theme how: a part word right before a noun the editor kn…
josephfarina Nov 16, 2026
55297c3
changeset: one note for round 15 part 2
josephfarina Nov 18, 2026
2786aa9
test(theme pictures): the open states test draws for real
josephfarina Nov 18, 2026
80025af
fix(cli): editor show keeps its base step; a paired text color keeps …
josephfarina Nov 18, 2026
98f8b57
fix(cli): a fill word's "with" joins only when no color follows the f…
josephfarina Nov 18, 2026
e00e7f9
fix(cli): a tint word in a clause that names no part tints the part i…
josephfarina Nov 18, 2026
164e6da
fix(cli): a text color asked with a tinted fill reads on it: the tint…
josephfarina Nov 18, 2026
618c68b
fix(cli): a text color asked with a tint is measured on every part th…
josephfarina Nov 19, 2026
35974df
experimental theme editor tests: the current page is Pagination's own…
josephfarina Nov 19, 2026
f16f7e8
experimental theme: an element drawn open records no disabled rule; a…
josephfarina Nov 19, 2026
a7998c1
experimental theme: a part drawn on another part's element keeps its …
josephfarina Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/experimental-theme-host-keeps-own-states.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astryxdesign/cli': patch
---

[experimental] `astryx experimental theme editor`: a part drawn on another part's element keeps its states to itself. A Button that a pagination cell is drawn on no longer takes the cell's `selected` state, so the button family reads the Button again and a selected look on a list row no longer reaches every Button; a part that always rides another (a list item on its Item) still takes that one's states.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note describes a fix for a problem no release had. Census states arrive in this same pull request (addCensusStates in _parts.mjs), and on the base a Button has no selected state, how "button match the theme" offers nothing for it, and a list item takes no selected at all. People reading the CLI changelog would look for a Button problem they never had. Delete this note, or add one clause to the round note's census line, for example "a state Core marks for one part (a pagination cell's selected) stays on that part".


@josephfarina
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[experimental] The pictures an agent opens show the overlays, and the output keeps what was missed where a cut output still shows it:

- `preview.png` (the sample page) ends with a strip of a tooltip, a popover, a menu and a select list drawn open, from the overlays the sheet draws.
- `sheet-overlays.png` shows the small overlays first, five to a row, each cell at most 300px tall, and no part of an overlay alone, so it stays under about 1600px.
- `sheet-overlays.png` shows the small overlays first, about five to a row, a panel over the page cropped to its top, and no part of an overlay alone.
- A change without `--png` names `show --png` and the two pictures it writes to open.
- A change counts, near its top, the parts the theme's changes did not reach; `show` lists them, with their lines, last before its closing look line.

Expand Down
2 changes: 1 addition & 1 deletion .changeset/experimental-theme-sheet-cells-b.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
'@astryxdesign/cli': patch
---

[experimental] `astryx experimental theme editor show --png` cuts a family's picture taller than 1600px into pictures of at most that height, in order (`sheet-inputs-1.png`, `-2` …), each cut between parts, so a reader takes each in whole. The pictures show a looping animation (a skeleton, a pulsing dot) at a frame a person sees, a status dot in its color, a vertical divider at a height, each table, code and app shell variant on a row of its own, and a section's sample text; a deprecated part, and a closed overlay the open states draw open (the mobile navigation drawer), are no longer drawn as empty cells.
[experimental] `astryx experimental theme editor show --png` cuts a family's picture taller than 1600px between rows of parts into pictures of about that height (a row taller than that is a picture of its own), in order (`sheet-inputs-1.png`, `-2` …), each cut between parts, so a reader takes each in whole. The pictures show a looping animation (a skeleton, a pulsing dot) at a frame a person sees, a status dot in its color, a vertical divider at a height, each table, code and app shell variant on a row of its own, and a section's sample text; a deprecated part, and a closed overlay the open states draw open (the mobile navigation drawer), are no longer drawn as empty cells.

@josephfarina
34 changes: 34 additions & 0 deletions .changeset/theme-round15-part-02.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
'@astryxdesign/cli': patch
---

[experimental] `astryx experimental theme editor`: a border asked of a part that draws none goes to the pieces inside it only where those pieces draw borders of their own (a date and time field's two boxes), so "top nav with a 1px bottom border" writes the border on the top nav, not under each nav item, and "sidebar with a 1px right border" on the sidebar, not beside each link.

- `astryx experimental theme editor` keeps what a change reports to what it did: a border set for light alone no longer reports the dark frame it left as the theme draws it.

- `astryx experimental theme editor how`: "the active nav item should be a #e8def8 pill" again gives pill corners on the selected item only. There is now a single reader for a color and shape, so the item's state is kept.

- `astryx experimental theme editor how` now gives a text color for every variant of a part whose variants each take a color of their own ("buttons with white text", "badges with dark text") to each variant only in the modes where it reads; text a part's variants read from shared tokens (a card's) is not measured this way unless the same answer gives them a fill. It measures against the variant's own fill, see-through fills over the page, or the fill the same answer gives it. Variants it can't read on keep their own text, and the answer says which.

Other fixes:

- "tinted <color>" fills with the color at a low strength over what's beneath, not the solid color. A text color asked with the tint, on any part it fills (a button variant, a card, a selected nav item), deepens the tint along its own hue until that text reads (to 95% for white on blue); only when no strength of that hue reads is the text kept to the modes it reads in, with a readable ink named.
- A rule with its own verb said after a part's clause ("3px corners on cards, never use pure black for text") now applies to the whole theme.

- `astryx experimental theme editor set … --only` always works as an escape from a group: on a member of a group that spreads it keeps the change to that member, and on a part that is styled on its own already (a sub-part, a card) it is taken and said, in place of a refusal; only a group itself, which has no one member to keep to, refuses it. A menu's radio is kept apart from every other radio: "square corners but keep menu radios round" says its circle is left as it is, and a round ask on a menu radio the theme squared offers the undo that gives the circle back.

- `astryx experimental theme editor`: a part Core marks open is drawn open, so `--state expanded` reaches a dropdown menu's submenu row (open while its flyout is, though it is highlighted too) and a top nav's menu trigger (a control on the page, now kept as drawn open).

- `astryx experimental theme editor`: the states Core marks on a part's own element are the part's to set. A list item (and so a checkbox list's row) takes `--state selected`, written as the attribute Core marks; a checkbox's or radio's box takes `--state hover` and the other moment states, shown from the part holding its invisible input instead of refused; a state asked of a container names the part inside it that has it, so `--on pagination --state selected` points to the selected page's item (`--on pagination-item --state selected`); and a part the drawing shows open in an overlay records its open state for `--state expanded`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--on pagination --state selected answers the same on the base: it already says "pagination-item has it" and suggests --on pagination-item --state selected, because pagination-item carries its own selected there. (This is the wording the previous review suggested; that suggestion also described base behaviour.) Use an example this pull request changes: --on list --state selected now names list-item and item where the base names no part, and --on dropdown-menu --state expanded now names dropdown-menu-item.


- `astryx experimental theme editor show` draws a doc sample's plain HTML text field as the theme's own text input, a submenu's flyout once beside the menu it opens from instead of a second time below it, a control drawn pressed at the moment of its press (a press flash no longer fades back to rest), a command palette with an item highlighted on the open states page, and the mobile navigation drawer's panel inside its cell.

- The pictures of `astryx experimental theme editor show --png` show their whole page: a page laid out wider than the picture window is pictured to its own width instead of cut at the window's edge; the mobile navigation drawer, which draws nothing closed, has no empty cell on the navigation pictures either; an overlay drawn open after its part (a toolbar's menu) sits under the control that opens it; and a step name cut by less than a pixel is shown whole too.

- `astryx experimental theme editor how`: rows said of a part that holds no table rows are that part's own rows, the items it draws, so "menus with 32px rows" sizes the menu items and never every table row; and a part word right before a noun the editor knows as nothing ("a radio station", "a button factory", "a card game") begins a compound subject, never the part: it is named and nothing is written for it, and the rest of the ask is read as before.

- `astryx experimental theme editor` measures a state's fill against the text that state draws, in its own variant: a part that draws no text (a switch's track, a tab's underline) gets no text problem, and a primary button's hover fill is measured against the primary button's own text, not another variant's. A page change that leaves the loading placeholder as faint as the base drew it no longer reports it as a new problem.

- In a light-only or dark-only theme, a text color set on a part whose own background is an image (a gradient button face) is written for both modes. Inside a lightbox or overlay, which Core draws in the other scheme, the text stays on that face: it no longer turns white on a light gel button. The contrast check measures it the same way.

@josephfarina
51 changes: 35 additions & 16 deletions packages/cli/api/theme-edit/_catalog.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,21 @@ export const SAMPLE_PAGE = h(
),
);

/**
* The few fixed items of the sample search source a page hands a part that
* requires one (a typeahead): the editor's pages and the catalog the part
* data is read from use these same items.
*/
export const SAMPLE_SEARCH_ITEMS = Object.freeze([
{id: 'design', label: 'Design'},
{id: 'engineering', label: 'Engineering'},
{id: 'research', label: 'Research'},
{id: 'marketing', label: 'Marketing'},
]);

/** The prop value that stands for the page's sample search source. */
export const SAMPLE_SOURCE = Object.freeze({__code: 'SAMPLE_SOURCE'});

/**
* Overlays the overlays section draws open in a deeper state than their docs
* show: a menu with its submenu open, a popover that holds a form, a date and
Expand Down Expand Up @@ -280,6 +295,19 @@ export const OPEN_SCENES = Object.freeze([
},
}),
},
{
name: 'CommandPalette',
label: 'highlighted',
// Its picker highlights the chosen item once its first results come,
// so it is drawn as the browser shows it after mounting.
mounted: true,
tree: h('CommandPalette', {
isOpen: true,
isInline: true,
searchSource: SAMPLE_SOURCE,
value: SAMPLE_SEARCH_ITEMS[1].id,
}),
},
{
name: 'MobileNav',
label: 'open',
Expand Down Expand Up @@ -398,21 +426,6 @@ export function elementNames(v, out = new Set()) {
/** The module a binding imports. @param {Binding} b */
export const bindingFrom = b => (typeof b === 'string' ? b : b.from);

/**
* The few fixed items of the sample search source a page hands a part that
* requires one (a typeahead): the editor's pages and the catalog the part
* data is read from use these same items.
*/
export const SAMPLE_SEARCH_ITEMS = Object.freeze([
{id: 'design', label: 'Design'},
{id: 'engineering', label: 'Engineering'},
{id: 'research', label: 'Research'},
{id: 'marketing', label: 'Marketing'},
]);

/** The prop value that stands for the page's sample search source. */
export const SAMPLE_SOURCE = Object.freeze({__code: 'SAMPLE_SOURCE'});

/**
* The page module source for a list of items. Each item renders on its own,
* so one component that throws leaves the rest of the page. With a theme,
Expand Down Expand Up @@ -755,6 +768,9 @@ export const SHEET_CSS = [
// An overlay shown in place keeps its own width (a popover that holds a
// form, a date input's calendar): its cell grows to hold it.
'.cs-cell [popover][data-astryx-layer-root]{display:block!important;position:relative!important;inset:auto!important;margin:8px 0 0!important;translate:none!important;transform:none!important;box-sizing:border-box!important}',
// A layer opened from inside another (a submenu's flyout) sits beside it.
'.cs-cell [data-astryx-layer-nest]{display:flex;align-items:flex-start;gap:4px}',
'.cs-cell [data-astryx-layer-nest] > [data-astryx-layer-root]{margin-top:8px!important}',
// A part shown for its open look that opened nothing has no cell.
'.cs-cell:has(.cs-open):not(:has(.cs-open [data-astryx-layer-root])){display:none}',
// The overlays section's own page (sheet-overlays.png): five to a row,
Expand All @@ -768,6 +784,9 @@ export const SHEET_CSS = [
'.cs-states-cell{min-width:0;overflow:clip;overflow-clip-margin:8px;padding:6px}',
// A panel wider than its cell (a narrow screen's navigation drawer) is
// drawn from its start, never cut at the start.
'.cs-cell dialog > *{max-width:100%!important}',
// A dialog drawn in place holds its panel in place too: a panel placed
// over the window (a navigation drawer at the window's edge) would leave
// the dialog with no height, and the cell empty.
'.cs-cell dialog > *{max-width:100%!important;position:relative!important;inset:auto!important}',
'.cs-cell dialog{display:block!important;position:relative!important;inset:auto!important;margin:0!important;max-width:100%!important;max-height:300px!important;translate:none!important;transform:none!important}',
].join('');
81 changes: 56 additions & 25 deletions packages/cli/api/theme-edit/_check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4781,22 +4781,25 @@ function checkOne(
});
// --only is checked on a part this Core has; a part in other letters or
// misspelt gets the part's own refusal first, with --only kept.
// --only keeps a change to the part named. On a group itself, or with no
// part, it names nothing to keep to, and is refused. On a part that is
// styled on its own already (a part in no group that spreads, such as a
// sub-part or a member of a group that spreads only when named), it asks
// for what the change does anyway: the change is made, without it, and
// said, so the escape always works.
if (s.only && (!s.on || TARGET.has(s.on) || FAMILIES[s.on])) {
const fam = s.on ? familyOf(s.on) : null;
if (!fam || FAMILIES[/** @type {string} */ (s.on)])
if (!s.on || FAMILIES[s.on])
refuse(
E.ERR_INVALID_ARGUMENT,
'--only is for one member of a group, such as text-input (how --list groups).',
{run: [`${HOW} --list groups`]},
);
if (!AUTO_SPREAD.includes(/** @type {string} */ (fam)))
refuse(
E.ERR_INVALID_ARGUMENT,
`${s.on} is styled on its own already: only ${AUTO_SPREAD.join(' and ')} spread to their group, so drop --only.`,
// The same command with only --only dropped: every other scope
// (a variant, a state, a mode) kept, never a wider write.
{run: [setLine(slug, thing, v, {...s, only: undefined}, unset)]},
);
if (!fam || !AUTO_SPREAD.includes(fam)) {
s.only = undefined;
if (!unset)
s.note = `${s.on} is styled on its own already (only the ${AUTO_SPREAD.join(' and ')} groups spread), so --only changes nothing: it is saved without it`;
}
}
// A font role in other letters (Body, CODE) is that role.
if (
Expand Down Expand Up @@ -5102,16 +5105,23 @@ function checkOne(
);
if (s.state && !statesHold(states, s.state)) {
// A part drawn inside this one that has the state (a calendar's day
// is today; the calendar is not): that part's line, with the state.
// is today; the calendar is not; a pagination's page button is the
// current one): that part's line, with the state. Its own pieces
// first, then the parts the census finds drawn inside it.
const state = String(s.state);
const holds = (/** @type {string} */ k) =>
statesHold(partStates(ctx, k), state);
const inner = meant
? []
: [...ctx.project.target.keys()]
.filter(
k =>
k.startsWith(`${s.on}-`) &&
statesHold(partStates(ctx, k), state),
)
: [
...new Set([
...[...ctx.project.target.keys()].filter(k =>
k.startsWith(`${s.on}-`),
),
...(ctx.C.MAP[String(s.on)]?.contains ?? []),
]),
]
.filter(k => ctx.project.target.has(k) && holds(k))
.slice(0, 3);
refuse(
E.ERR_THEME_UNKNOWN_STATE,
Expand Down Expand Up @@ -5182,7 +5192,10 @@ function checkOne(
/^(hover|active|focus|focus-visible|focus-within)$/.test(String(s.state))
) {
const all = partsOf(ctx, s);
const under = all.filter(t => ctx.C.MAP[t]?.underInput != null);
// (A part whose input sits in a part the theme names takes the state
// from that part, and the build writes it so; only one whose input no
// themed part holds is refused.)
const under = all.filter(t => ctx.C.MAP[t]?.underInput === '');
if (under.length && under.length === all.length) {
const holders = [
...new Set(under.map(t => ctx.C.MAP[t]?.underInput).filter(Boolean)),
Expand Down Expand Up @@ -5901,7 +5914,7 @@ function checkOne(
if (thing === 'corners') {
if (s.on) {
refuseInvisibleCorners(ctx, slug, s, data);
refuseRadioCorners(ctx, slug, s);
refuseRadioCorners(ctx, slug, s, data);
}
// With no corners setting yet, a step starts from the base theme's
// own radius.
Expand Down Expand Up @@ -7940,21 +7953,39 @@ function checkOne(
* @param {import('./_settings.mjs').Ctx} ctx
* @param {string} slug
* @param {import('./_settings.mjs').Setting} s
* @param {import('./_settings.mjs').ThemeData} data
*/
function refuseRadioCorners(ctx, slug, s) {
function refuseRadioCorners(ctx, slug, s, data) {
if (ctx.unchecked) return;
const parts = partsOf(ctx, s);
if (!parts.length || !parts.every(t => radioCircle(ctx.C, t))) return;
// A radius set on the part itself overrides the circle: a square radio
// is asked of this component, by name.
// is asked of this component, by name. A fully round ask (pill, round)
// is the circle it has: with a radius the theme set on it, the undo of
// that radius gives the circle back.
const px = cornerPxOf(String(s.value));
const own =
Number.isFinite(px) && px < 9999
? setLine(slug, 'border-radius', px === 0 ? '0' : `${px}px`, s)
: null;
const saved = (data?.settings ?? []).find(
(/** @type {any} */ x) =>
x.thing === 'border-radius' &&
x.on === s.on &&
!x.when &&
!x.state &&
!x.mode,
);
// (A step, "rounder" or "sharper", is no length: only "more" is round,
// and "less" gets no line, since a circle has no corner to sharpen.)
const step = Number.isFinite(px) ? null : String(s.value);
const round = step ? step === 'more' : px >= 9999;
const own = round
? saved
? `${P} undo ${slug} border-radius --on ${s.on}`
: null
: step
? null
: setLine(slug, 'border-radius', px === 0 ? '0' : `${px}px`, s);
refuse(
E.ERR_THEME_NO_EFFECT,
`${s.on} is a radio's circle (border-radius 50%), not a corner, so the corners dial leaves it and changes nothing you see.${own ? ` A border-radius on it sets its shape: ${own.replace(`${P} `, '')}.` : ''}`,
`${s.on} is a radio's circle (border-radius 50%), not a corner, so the corners dial leaves it and changes nothing you see.${round ? (saved ? ` ${slug} sets border-radius ${saved.value} on it; undoing that gives the circle back: ${String(own).replace(`${P} `, '')}.` : ` It is fully round already.`) : own ? ` A border-radius on it sets its shape: ${own.replace(`${P} `, '')}.` : ''}`,
{run: own ? [own] : [`${HOW} ${s.on}`]},
);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/api/theme-edit/_context.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
} from './_tables.mjs';
import {makeCompiler} from './_compiler.mjs';
import {openProject, installLine} from './_project.mjs';
import {partData} from './_parts.mjs';
import {addCensusStates, partData} from './_parts.mjs';
import {writeWhole} from './_palette.mjs';
import {
assetRef,
Expand Down Expand Up @@ -146,6 +146,7 @@ export async function context(cwd) {
let uncheckedCode = null;
try {
parts = await partData(project);
addCensusStates(project, parts);
} catch (e) {
if (!isRenderFailure(e)) throw e;
unchecked = renderCause(project, /** @type {Error} */ (e).message);
Expand Down
Loading