Skip to content

Move syntax colours, Leaf's icons and the obligation tally into the library - #6932

Merged
max-sixty merged 3 commits into
mainfrom
agent-ab32637b89964bf84
Nov 24, 2026
Merged

max-sixty merged 3 commits into
mainfrom
agent-ab32637b89964bf84

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

One step of the package-interface redesign: shared web code leaves the package API for the library a module imports by path (browser/runtime/lib/). Syntax colouring (syntax-tokens.js and its generated syntax-languages.js), Leaf's icons (icon-paths.js, icons.js) and the obligation tally (now obligation-tally.js) move there, and the packages import ten functions from them instead. The package API goes from 202 names to 192.

What the diff doesn't show:

  • Left in the API. langForPath reads the extension table a page installs from its composed registry.
  • Split. actionOffers, which draws a control role's action symbol, moved into its one caller, element-markers.js; no package used it.
  • Worth a look. The action names that offerAction and nameAction take now live in a library module. The references link it.
  • Boot. A compiled kernel's boot still loads 17 files (+569 bytes).

Max approved the redesign and asked for small steps. He hasn't read this diff, which a fresh agent reviewed.

Tests: pnpm run check, pre-commit, 22 tests by node id, and leaf-dev probe --base on alert-review and pr-walkthrough in Chromium and Firefox, where both arms draw the same tokens, icons and tally.

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

max-sixty and others added 2 commits November 23, 2026 17:54
…ibrary

One step of the package-interface redesign: shared web code leaves the
package API for the library a module imports by path
(`browser/runtime/lib/`). `syntax-tokens.js`, its generated
`syntax-languages.js`, `icon-paths.js`, `icons.js` and the obligation tally
(now `obligation-tally.js`) move there, and packages import `syntax`,
`syntaxNow`, `synNodes`, `tokenLines`, `codeLanguage`,
`ensureSyntaxLanguage`, `iconTemplate`, `actionTemplate`, `tally` and
`tallyWords` from it. The package API goes from 207 names to 197.

`langForPath` stays in the package API: it reads the extension table a
page installs from its composed registry (`language-paths.js`).
`icon-paths.js` gave the role constructors' glue (`actionOffers`) to its one
caller, `element-markers.js`, since it served Leaf's control roles and no
package. The references keep `langForPath`, `dressCode` and where the
action names live, and describe no library function.

A compiled kernel's boot still loads 17 files.

Co-Authored-By: Claude <[email protected]>
# Conflicts:
#	browser/runtime/syntax.js
#	packages/file-editor/widgets/lf-file-editor.js
leaf-agent
leaf-agent previously approved these changes Nov 24, 2026
# Conflicts:
#	browser/runtime/control-labels.js
#	browser/runtime/kernel-registry.json
#	packages/deck/widgets/lf-deck.js
#	packages/default/widgets/lf-code.js
#	packages/default/widgets/lf-tabs.js
#	packages/default/widgets/lf-text-document.js
#	packages/diff/widgets/lf-diff.js
#	packages/playwright/widgets/lf-trace.js
@max-sixty
max-sixty merged commit 20377d3 into main Nov 24, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-ab32637b89964bf84 branch November 24, 2026 02:26
leaf-agent added a commit that referenced this pull request Nov 24, 2026
…6949)

#6932 moved syntax colouring out of the package API into the library
(`browser/runtime/lib/syntax-tokens.js`, listed as a public kernel entry
in `kernel-registry.json`), but
`test_shell_commands_share_colors_in_plain_code_widgets_and_diffs` still
read `syntax` from `window.__lfWidgetApi()`. Every call threw
`TypeError: syntax is not a function`, so `ci` on main went red ([run
45313963639](https://github.com/max-sixty/leaf/actions/runs/45313963639),
the only failure among 7,916 tests). The test changed nothing else about
what it checks: in every language the registry lists, the tokens must
add up to the exact source. Browser tests don't run on pull requests
unless the PR edits them, so #6932 merged green.

The render harness now exposes `window.__lfLibImport(name)` next to
`__lfVendorImport`. It resolves against the same compiled entry base,
and the test's two direct `syntax` calls import through it. No other
test pulls one of the ten names #6932 moved (`syntax`, `syntaxNow`,
`synNodes`, `codeLanguage`, `ensureSyntaxLanguage`, `tokenLines`,
`actionTemplate`, `iconTemplate`, `tally`, `tallyWords`) from the
package API.

Verification: on main at `4660b588e` the test fails by node id; with
this change it passes.

Closes #6948 — automated triage

Co-authored-by: leaf-agent <[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