Skip to content

Split the default theme by widget, and hold widget-api to names behavior modules read - #2475

Merged
max-sixty merged 3 commits into
mainfrom
kernel-package-boundary
Oct 12, 2026
Merged

max-sixty merged 3 commits into
mainfrom
kernel-package-boundary

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Two items from the code-quality survey's kernel/package boundary branch (F110, F91).

Default package theme by widget (F110). packages/default/styles/theme.css was one 2,482-line source; each widget's rules now live in styles/<widget>.css beside shot.css, and theme.css holds the package header and the ordered imports, which are the cascade order. Three interleaved fragments moved beside their widgets (lf-code's containment, lf-draft's source fallback, lf-text-document's preview rules). The generated packages/default/theme.css differs from main only in those three positions and esbuild's file-boundary comments; no rule between a fragment's old and new position matches the same elements, so no computed style changes.

widget-api holds only names behavior modules read (F91). Six re-exports with no package, kernel widget, example, fixture or reference reader are gone: inUi, layerLanding, renderInlineMarkdown, effectiveScroller, readingRegionFor and repaint. The suite's reading-region probes import /runtime/reading-regions.js instead. A new test in tests/test_interact_layer.py parses widget-api's exports and the behavior modules' imports, and fails on an export that has neither an importer nor a mention in a reference's code. A name only probes or tests need then goes in check-api.js or its owning module. textNodesUnder, which the survey proposed moving to check-api.js, stays because lf-suggestion imports it.

Checks: build/browser/build.mjs --check, check:framework, test:runtime, the layer guards, and the seven browser tests whose probes were repointed.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 3 commits October 11, 2026 20:21
Continues #2252's split: each widget's rules now live in
`packages/default/styles/<widget>.css`, and `styles/theme.css` holds the
package header and the ordered imports, which are the cascade order. The
apparatus-voice rule, which spans several widgets, has its own file at
its old position.

Three interleaved fragments moved beside their widgets: lf-code's
containment and lf-draft's source fallback (merged into its other
`> pre` rule) from the shared block before the chart rules, and
lf-text-document's preview rules from after the draft rules. The
generated `packages/default/theme.css` differs from the old one only in
those positions and esbuild's file-boundary comments; no rule between a
fragment's old and new position matches the same elements, so no
computed style changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
widget-api.js drops six re-exports no package, kernel widget, example,
fixture package or reference reads: `inUi`, `layerLanding`,
`renderInlineMarkdown`, `effectiveScroller`, `readingRegionFor` and
`repaint`. The suite's reading-region probes now import
`/runtime/reading-regions.js`, the owner.

A layer test parses the exports and the behavior modules' imports and
fails on an export with neither an importer nor a mention in a
reference's code, so a name added for a probe or a test lands in
check-api.js or its owner instead. `textNodesUnder`, which the survey
proposed moving to check-api.js, stays: lf-suggestion imports it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 6869bfe into main Oct 12, 2026
3 checks passed
@max-sixty
max-sixty deleted the kernel-package-boundary branch October 12, 2026 03:46
max-sixty added a commit that referenced this pull request Oct 12, 2026
…kage to widget-api (#2517)

Survey item F87. The physical annotation overlay moves from
`skills/leaf/packages/default/runtime/annotation-overlay/` into the
kernel at `skills/leaf/assets/runtime/annotation-overlay/` (a `git mv`;
`index.js` shows as delete+add because its header grew). It keeps its
`/runtime/annotation-overlay/*` URLs, and `leaf.js` still imports it
dynamically only for overlay presentation, so a `data-annotations=page`
page loads none of it.

This reverses #1652's placement. Every overlay module imports private
runtime owners (126 imports of 60 kernel modules), which no package may
do, so the package boundary held only through exemptions. All of them
are deleted:

- `layer.py`: the default package's runtime is no longer a protected
kernel path, and the default package is no longer skipped by the
private-import check.
- `.dependency-cruiser.mjs`: the `/runtime/annotation-overlay` alias,
`.dependency-cruiser-resolve.mjs`, and the per-name directory fallback
are gone. The overlay's imports are now relative, like every other
kernel owner's, and `core-independent-of-overlay` still keeps other
owners from reaching it (checked with a deliberate violating import).
- `dev/leaf_dev/distribution.py` no longer deletes a second runtime
tree, and `build/runtime-bundle.mjs` no longer names the overlay as an
extra install entry. In a prepared install the overlay is now a lazily
loaded chunk, as it already was on the website.
- eslint and the pre-commit depcruise hook drop their
`packages/*/runtime` globs.

With the default package's exemption removed, the check also caught its
vendored Sortable importing `/runtime/dom-move.js`. It now gets the same
`move` from `/runtime/widget-api.js`, which already exported it
(`build/vendor.mjs` and the committed bundle; `check:browser` reproduces
the bytes). The default package now holds only widgets, their initial
drawing, styles, theme, registry, and vendored libraries, and every
bundled package passes the private-import check.

The layer-returns lint message also changes. It sent packages to
`runtime/focus.js` for `layerLanding`, which widget-api stopped
exporting in #2475. It now names `layerLanding` as kernel-only and says
a package gets `closeLayer` and `handBack` from `widget-api.js`.

Checks: pre-commit (eslint, depcruise, prettier, ruff), `check:browser`,
`test:browser`, `test:runtime`, a real `prepare()` of the install tree,
and focused pytest for distribution, revision delivery, and layer
composition.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
…3238)

A decision laid its options across when an option held `lf-chart` or
`lf-shot`, which `ask.css` named by tag, so a picture widget under any
other name, `lf-diagram` or a project package's, did not count.
Stylesheets read registry declarations through `$marks`, which paints
each on the element, as pane layout already does for `x-reading-role`;
`x-visual` was not among them.

`x-visual` now paints `data-lf-visual`
(`skills/leaf/assets/registry.json`), and `ask.css` reads it beside
HTML's own picture elements, so any widget that declares it draws a
picture counts. Its `$keys` entry says the declaration now also sets
layout. The runtime's generated `marks.js` and the kernel are rebuilt.

`test_options_holding_pictures_lay_across` adds a project package's
picture widget with no module, which fails on the tag list and passes
now. `lf-shot`'s reduced-motion rule moves from `toc.css`, where the
theme split (#2475) left it, to `shot.css`; the compiled theme changes
only in its position.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants