Repository navigation
Commit 7fb5cab
authored
feat(cli): built themes keep componentIcons slot functions (#9829)
* feat(Icon): a theme maps a component's own icon role by slot, starting with CodeBlock's copy button
defineTheme({componentIcons}) maps a component icon slot to a shared icon
name, null, a partial {icon, variant, size} request, or a pure function of
the slot's state. One shared resolution applies caller content, then the
theme's slot, then the component's fallback, field by field, and ignores a
malformed field with one development warning. CodeBlock's copy button is the
first slot, code-block-copy, with state {copied}. The static view reads back
through theme.componentIcons; theme build carries static slot values and
fails on a slot function. Component docs, the CLI, and the docsite registry
list a component's slots.
* fix(Icon): the static componentIcons view is a partial record of slot values
DefinedTheme['componentIcons'] keeps the same shape as a Partial<Record>, so
documentation that names DefinedTheme does not have to enumerate every icon
name a slot may hold.
* docs: the slot record names where Core's slots are listed; the theme template's componentIcons example builds
The icon slot architecture record's baseline points to ComponentIconSlotMap
and each owning component's docs for Core's slots. The theme template's
componentIcons example is a static value, which astryx theme build carries.
* feat(cli): built themes keep componentIcons slot functions
theme build traces each slot function to the import that supplies it and
writes static slot values beside it as JSON, including slots inherited from
a built, package, or family base. The built module keeps the values as
__componentIcons and reads back the same static componentIcons view as the
runtime theme. A slot function defined in the theme file still fails the
build.
* fix(cli): built slot values merge as defineTheme merges them
A theme's own componentIcons merge over its base's through a generated
function that skips an undefined slot, so an imported or family map that
leaves a slot undefined keeps the inherited one. Inside one object, an
undefined slot stays, as in the source. Static requests read unmutated
const bindings. A built base module is read through its export, like a
package theme. The docs say a family member supplies its own slot functions
through a named import of its whole map.
* fix(cli): built slot requests carry constants, member reads, and imported values
A static slot value may read unmutated const bindings, member reads on them,
and imported bindings, which the module imports. The const guard is scoped
to the current path, so one constant read twice is carried. A root's own
slot values pass through the theme merge, so an undefined slot is dropped as
defineTheme drops it. A value that is neither static nor imported gets an
error that says so.
* docs(cli): the theme template shows a componentIcons slot function, which built themes now carry
* fix(cli): a family root's imported slot map drops undefined slots; docs state the --out rule for slot imports
A family member's imported componentIcons map always passes through the
slot merge, so a root drops an undefined slot as defineTheme does. The
changeset and author-a-theme say that the module keeps each slot import as
the theme source spells it, which --icons-specifier does not change, so with
--out elsewhere a module must answer to it from the output directory. A
fixture builds with --out and loads the module. The theme template imports
its example slot function.
* test(cli): component output lists icon slots; the slot merge comment states only its reason
* chore: restore main's internal/interaction-harness/src/busy.ts
The merge commit's lint hook reformatted this unrelated file; it now
matches main again.1 parent b779b26 commit 7fb5cab
6 files changed
Lines changed: 1033 additions & 166 deletions
File tree
- .changeset
- packages/cli
- api/theme/build
- assets
- docs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments