docs for form-associated custom elements in Stencil#1247
Merged
alicewriteswrongs merged 1 commit intomainfrom Oct 16, 2023
Merged
docs for form-associated custom elements in Stencil#1247alicewriteswrongs merged 1 commit intomainfrom
alicewriteswrongs merged 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
2 tasks
rwaskiewicz
requested changes
Oct 9, 2023
Member
rwaskiewicz
left a comment
There was a problem hiding this comment.
I think this is a good start!
One larger question I have is how this would interact with our guide for forms - https://stencil-docs-git-ap-form-associated-ionic1.vercel.app/docs/next/forms. Should we update that as well?
tanner-reits
approved these changes
Oct 10, 2023
Contributor
tanner-reits
left a comment
There was a problem hiding this comment.
LGTM. One super small grammatical fix
rwaskiewicz
approved these changes
Oct 13, 2023
Member
rwaskiewicz
left a comment
There was a problem hiding this comment.
LGTM - FWIW, you have one (non-version related) typo, but non-blocking
alicewriteswrongs
added a commit
to stenciljs/core
that referenced
this pull request
Oct 16, 2023
This adds support for building form-associated custom elements in Stencil components, allowing Stencil components to participate in HTML forms in a rich manner. This is a popular request in the Stencil community (see #2284). A minimal Stencil component that uses the new APIs to integrate with a form could look like this: ```tsx import { Component, h, AttachInternals } from '@stencil/core'; @component({ tag: 'my-component', styleUrl: 'my-component.css', shadow: true, formAssociated: true }) export class MyComponent { @AttachInternals() internals: ElementInternals; render() { return <div>Hello, World!</div>; } } ``` The new form-association technology is exposed to the - A new option called `formAssociated` has been added to the [`ComponentOptions`](https://github.com/ionic-team/stencil/blob/06f6fad174c32b270ce239afab5002c23d30ccbc/src/declarations/stencil-public-runtime.ts#L10-L55) interface. - A new `@AttachInternals()` decorator can be used to indicate a property on a Stencil component to which an [`ElementInternals`](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals) object will be bound at runtime. - Using `@AttachInternals()` is supported both for lazy builds ([`www`](https://stenciljs.com/docs/www), [`dist`](https://stenciljs.com/docs/distribution)) as well as for [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements). The new behavior is implemented at compile-time, and so should result in only very minimal increases in code / bundle size. Support exists for using form-associated components in both the lazy and the CE output targets, as well as some extremely minimal provisions for testing. Documentation for this feature was added to the Stencil site here: stenciljs/site#1247
alicewriteswrongs
added a commit
to stenciljs/core
that referenced
this pull request
Oct 16, 2023
This adds support for building form-associated custom elements in Stencil components, allowing Stencil components to participate in HTML forms in a rich manner. This is a popular request in the Stencil community (see #2284). A minimal Stencil component that uses the new APIs to integrate with a form could look like this: ```tsx import { Component, h, AttachInternals } from '@stencil/core'; \@component({ tag: 'my-component', styleUrl: 'my-component.css', shadow: true, formAssociated: true }) export class MyComponent { @AttachInternals() internals: ElementInternals; render() { return <div>Hello, World!</div>; } } ``` The new form-association technology is exposed to the - A new option called `formAssociated` has been added to the [`ComponentOptions`](https://github.com/ionic-team/stencil/blob/06f6fad174c32b270ce239afab5002c23d30ccbc/src/declarations/stencil-public-runtime.ts#L10-L55) interface. - A new `@AttachInternals()` decorator can be used to indicate a property on a Stencil component to which an [`ElementInternals`](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals) object will be bound at runtime. - Using `@AttachInternals()` is supported both for lazy builds ([`www`](https://stenciljs.com/docs/www), [`dist`](https://stenciljs.com/docs/distribution)) as well as for [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements). The new behavior is implemented at compile-time, and so should result in only very minimal increases in code / bundle size. Support exists for using form-associated components in both the lazy and the CE output targets, as well as some extremely minimal provisions for testing. Documentation for this feature was added to the Stencil site here: stenciljs/site#1247
alicewriteswrongs
added a commit
to stenciljs/core
that referenced
this pull request
Oct 16, 2023
This adds support for building form-associated custom elements in Stencil components, allowing Stencil components to participate in HTML forms in a rich manner. This is a popular request in the Stencil community (see #2284). The new form-association technology is exposed to the component author via the following changes: - A new option called `formAssociated` has been added to the [`ComponentOptions`](https://github.com/ionic-team/stencil/blob/06f6fad174c32b270ce239afab5002c23d30ccbc/src/declarations/stencil-public-runtime.ts#L10-L55) interface. - A new `@AttachInternals()` decorator can be used to indicate a property on a Stencil component to which an [`ElementInternals`](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals) object will be bound at runtime. - Using `@AttachInternals()` is supported both for lazy builds ([`www`](https://stenciljs.com/docs/www), [`dist`](https://stenciljs.com/docs/distribution)) as well as for [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements). The new behavior is implemented at compile-time, and so should result in only very minimal increases in code / bundle size. Support exists for using form-associated components in both the lazy and the CE output targets, as well as some extremely minimal provisions for testing. Documentation for this feature was added to the Stencil site here: stenciljs/site#1247
Form-associated custom elements were added to Stencil in stenciljs/core#4784 for version 4.5.0. This adds documentation explaining the changes to the component authoring DSL and also breaking down some examples of how the functionality could be used to build out a component.
a4abd7d to
961b81e
Compare
github-merge-queue bot
pushed a commit
to stenciljs/core
that referenced
this pull request
Oct 16, 2023
) This adds support for building form-associated custom elements in Stencil components, allowing Stencil components to participate in HTML forms in a rich manner. This is a popular request in the Stencil community (see #2284). The new form-association technology is exposed to the component author via the following changes: - A new option called `formAssociated` has been added to the [`ComponentOptions`](https://github.com/ionic-team/stencil/blob/06f6fad174c32b270ce239afab5002c23d30ccbc/src/declarations/stencil-public-runtime.ts#L10-L55) interface. - A new `@AttachInternals()` decorator can be used to indicate a property on a Stencil component to which an [`ElementInternals`](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals) object will be bound at runtime. - Using `@AttachInternals()` is supported both for lazy builds ([`www`](https://stenciljs.com/docs/www), [`dist`](https://stenciljs.com/docs/distribution)) as well as for [`dist-custom-elements`](https://stenciljs.com/docs/custom-elements). The new behavior is implemented at compile-time, and so should result in only very minimal increases in code / bundle size. Support exists for using form-associated components in both the lazy and the CE output targets, as well as some extremely minimal provisions for testing. Documentation for this feature was added to the Stencil site here: stenciljs/site#1247
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.
This adds documentation of:
AttachInternalsdecorator added in feat(compiler): add support for form-associated custom elements core#4784formAssociatedoption added to the argument passed to the@Componentdecorator, also added in feat(compiler): add support for form-associated custom elements core#4784