Skip to content

add html attribute validation & completions #849

Merged
NullVoxPopuli merged 9 commits into
typed-ember:mainfrom
patricklx:html-validation
Mar 31, 2025
Merged

add html attribute validation & completions #849
NullVoxPopuli merged 9 commits into
typed-ember:mainfrom
patricklx:html-validation

Conversation

@patricklx
Copy link
Copy Markdown
Contributor

@patricklx patricklx commented Mar 26, 2025

Screenshot 2024-01-03 at 12 45 12 Screenshot 2024-01-03 at 12 48 52

@patricklx patricklx force-pushed the html-validation branch 2 times, most recently from 3c223c2 to 83fbaff Compare March 26, 2025 21:30
@patricklx patricklx marked this pull request as ready for review March 27, 2025 11:05
@patricklx
Copy link
Copy Markdown
Contributor Author

unable to test completions at the moment...

@patricklx patricklx force-pushed the html-validation branch 2 times, most recently from 5f9a02c to b736e0b Compare March 27, 2025 12:14
@NullVoxPopuli
Copy link
Copy Markdown
Contributor

Current test failure looks like a path hash mismatch.

@patricklx can you update that snapshot?

I wonder also if you happen to know how to do custom stapshot serializers, and have an idea for these sorts of paths?

Thank you!

Comment thread packages/core/src/transform/template/template-to-typescript.ts
Copy link
Copy Markdown
Contributor

@NullVoxPopuli NullVoxPopuli Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the 'generated by' text up top

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these needed on the global type?

On rather, why do we need to add a property to the existing elements?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because I need to find the correct html attributes for an HtmlElement type.

The current flow for it is:

  • Element Type -> find html name -> find attribute names in elements.d.ts
    but some elements share the same type for example HtmlHeadingElement, HtmlTableTRElement etc which then make error show unrelated element info.

e.g. key does not exist on AttributesForElement<Tr> instead of AttributesForElement<h1>

But looking at this now. I think I can merge both so that elemts.d.ts has a mapping of
HtmlElementType -> Html Attributes
instead of using element name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't work...
I cannot make a map of type to another type...

"sums-up": "^2.1.0",
"aria-attributes": "^2.0.1",
"html-element-attributes": "^3.3.0",
"html-event-attributes": "^2.2.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a package for mathml?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, https://github.com/wooorm/mathml-tag-names
it only has tag names, no attributes exists for them

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread scripts/build-augmentations.mjs Outdated
}`);
}

const prefix = `//generated by scrips/build-augmentations.mjs\n`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add to the comment block about why this is needed, how it's used, etc?

Thanks!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh, i'm surprised no existing package has this information for us already.

How strange

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

Very excited for this!

@patricklx patricklx marked this pull request as draft March 27, 2025 13:32
@patricklx patricklx force-pushed the html-validation branch 9 times, most recently from 3af6cca to dd91e0a Compare March 31, 2025 15:13
@patricklx patricklx marked this pull request as ready for review March 31, 2025 15:13
Comment thread scripts/build-elements.mjs
@NullVoxPopuli NullVoxPopuli added the enhancement New feature or request label Mar 31, 2025
@NullVoxPopuli NullVoxPopuli merged commit faab42c into typed-ember:main Mar 31, 2025
4 checks passed
@github-actions github-actions Bot mentioned this pull request Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants