ebox/AGENTS.md
Kinneyzhang 79f5bc23d1 feat: add CSS sizing and native text interaction capabilities
Normalize size units and intrinsic sizing across Elisp and native layout. Add help, pointer, hover-style and keymap support with reusable interaction adapters.

Keep content updates local, preserve scroll caches and hover borders, and avoid rebuilding retained plans and ownership metadata for stable geometry.

Validation: make check and native-rust-tests passed; targeted native interaction and scroll publication regressions passed.
2026-09-09 22:25:18 +08:00

3.0 KiB

Ebox repository guidance

This repository is the standalone low-level Ebox package. It owns box nodes, style normalization, measurement, layout, rendering, semantic update planning, selector integration, Grid, and the optional Rust reflow module. Ebox plans publication scope and projects retained surface inputs; TP owns live buffer publication, diff execution, revisions, and rollback. ECSS owns selector parsing, matching, and cascade semantics while Ebox adapts nodes and candidate indexes. The sibling etaf repository owns the higher-level text-application framework; etaf-playground and ebox-playground are separate example packages.

Keep this repository independent from ETAF. Do not add Components, Runtime state, Data Controllers, UI controls, or application examples here. Ebox may call ECSS and TP only through their public APIs; private ebox--* functions remain internal to this package.

When authoring Ebox DSL, prefer the shortest declaration that preserves the intended behavior: omit redundant defaults, put shared inheritable text styles on an existing common parent, and declare only child differences. Keep explicit overrides and properties that an example is teaching. Check the actual layout context before omitting sizes; auto and stretch are not universal aliases, and background paint showing through is not property inheritance. Follow the authoring rules in docs/user/ebox-user-guide.en.md and verify example simplifications at multiple viewport sizes.

Use apply_patch for hand-edited changes. Keep each file lexically bound, document public APIs, preserve deterministic rendering, and add a focused regression test for behavior changes. Run make check EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs before claiming completion. Run make native-rust-tests when changing native/ and run make docs-contract-tests when changing documentation or the active file boundary.

The old emacs-box checkout is a historical full-stack source tree. It is intentionally not a dependency of this package and should not be edited as part of Ebox work unless a separate task explicitly targets that legacy repository.

For legacy public CSS size migrations, use python3 scripts/migrate-css-sizes.py PATH... first, then the same invocation with --write for reviewed public DSL/style callers. The tool preserves comments, strings, and source formatting, and reports dynamic/ambiguous values for manual review. Do not apply it to measured engine structs merely because they use the same property names. See its --help for input, exit-status, and cleanup contracts; use python3 -m unittest discover -s scripts -p 'test_migrate_css_sizes.py' to verify the tool. Extend this entry point instead of creating ad hoc migration probes. For mixed test/implementation files, add --callers ebox-build,ebox-create (or the actual public API names) to restrict migration to those call subforms. ETAF (styles ...) blocks are recognized as literal data; native Emacs (space ...) and image display specs retain their own size grammar.