Repository navigation
Move syntax colours, Leaf's icons and the obligation tally into the library - #6932
Merged
Merged
Conversation
…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
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
leaf-agent
approved these changes
Nov 24, 2026
This was referenced Nov 24, 2026
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsand its generatedsyntax-languages.js), Leaf's icons (icon-paths.js,icons.js) and the obligation tally (nowobligation-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:
langForPathreads the extension table a page installs from its composed registry.actionOffers, which draws a control role's action symbol, moved into its one caller,element-markers.js; no package used it.offerActionandnameActiontake now live in a library module. The references link it.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, andleaf-dev probe --baseon alert-review and pr-walkthrough in Chromium and Firefox, where both arms draw the same tokens, icons and tally.