Skip to content

Conversation

@disconcision
Copy link
Member

@disconcision disconcision commented Jul 20, 2025

This adds a minimal HTML/DOM ADT and associated projector, porting over the code from the old LLM branch. This might be usable to @gcrois to accelerate livelit work, or might be worth merging separately if we can resolve a few issues.

This intentionally supports a very limited subset of tags and attributes, and does css styles entirely via strings. More can be added straightforwardly going forward, but if we want to add many more we need to think about how to handle lexically larger types for display; at it stands, these already affect perf for the value display and the context inspector.

Screenshot 2025-07-20 at 6 41 22 PM

This also supports a couple handlers; the provided handler should do a functional update of the entire HTML value. This isn't very ergonomic, but can in principle be used to do some fun things; the example in the screenshot strips the element style when clicked. This also just uses the lexical syntax of the handler at the moment, so only built-in functions will work. This isn't an inherent limitation, but I didn't want to add a closure picker at the moment.

TODO:

  • One thing I haven't found a great approach for is how to determine a placeholder for the projector view. Right now it's just a fixed inline length and overflows.
  • Might want to improve the ADT api, perhaps use some labelled tuples
  • The updater might be more ergonomic if it could target specific element ids for partial replacement.
  • If there are type errors, instead of drawing the element it just draws the code. This isn't telegraphed very effectively though.

@gcrois
Copy link
Contributor

gcrois commented Jul 21, 2025

Very fun! I am having some issues using variables (I guess we have to use literals?).

Also, I noticed this file had some pretty poor performance (maybe due to complicated types?)

Eventually we would like this use modules, is that correct?

@codecov
Copy link

codecov bot commented Jul 21, 2025

Codecov Report

❌ Patch coverage is 17.79661% with 97 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.23%. Comparing base (b90744a) to head (a2f8636).
⚠️ Report is 2 commits behind head on dev.

Files with missing lines Patch % Lines
src/haz3lcore/projectors/HazelDOM.re 0.00% 73 Missing ⚠️
...c/haz3lcore/projectors/implementations/HTMLProj.re 0.00% 14 Missing ⚠️
src/language/term/Typ.re 0.00% 4 Missing ⚠️
src/language/ProjectorKind.re 25.00% 3 Missing ⚠️
src/haz3lcore/projectors/ProjectorInit.re 0.00% 1 Missing ⚠️
src/language/builtins/BuiltinsADT.re 95.23% 1 Missing ⚠️
src/web/app/editors/code/ContextMenu.re 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1812      +/-   ##
==========================================
- Coverage   50.37%   50.23%   -0.14%     
==========================================
  Files         230      232       +2     
  Lines       25368    25484     +116     
==========================================
+ Hits        12780    12803      +23     
- Misses      12588    12681      +93     
Files with missing lines Coverage Δ
src/haz3lcore/projectors/ProjectorInit.re 69.56% <0.00%> (-3.17%) ⬇️
src/language/builtins/BuiltinsADT.re 98.73% <95.23%> (+0.42%) ⬆️
src/web/app/editors/code/ContextMenu.re 0.89% <0.00%> (-0.01%) ⬇️
src/language/ProjectorKind.re 84.61% <25.00%> (-4.28%) ⬇️
src/language/term/Typ.re 62.17% <0.00%> (-0.21%) ⬇️
...c/haz3lcore/projectors/implementations/HTMLProj.re 0.00% <0.00%> (ø)
src/haz3lcore/projectors/HazelDOM.re 0.00% <0.00%> (ø)

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@disconcision
Copy link
Member Author

@gcrois yah I can make it so you can use externally defined variables in the handler, it's just more work since there's now an ambiguity about which value of the externally defined variables to use, i.e. if your HTML literal is in a function body and uses the function parameter. so in fully generality would need a closure selector, which currently only exists for the probe projector, but will be factored out of that at some point so it can apply to any projector.

the performance issue is due to a dev bug

@disconcision disconcision mentioned this pull request Feb 9, 2026
@disconcision
Copy link
Member Author

Subsumed by #2115

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