Closed zefir-git closed 3 hours ago
[!WARNING]
Rate limit exceeded
@zefir-git has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 29 seconds before requesting another review.
⌛ How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR. We recommend that you space out your commits to avoid hitting the rate limit.🚦 How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our [FAQ](https://coderabbit.ai/docs/faq) for further information.📥 Commits
Files that changed from the base of the PR and between d1947300d4294ba108f222aad545724582cbc20a and b527052b5c23a53aa1a4002482826cc4c82dcd55.
The pull request introduces several changes across multiple files, primarily focusing on the addition of the DocumentComponent
class and modifications to the ElementComponent
and NodeComponent
classes. A new file, DocumentComponent.ts
, is created, defining the DocumentComponent
class that extends NodeComponent
with a generic type of DocumentFragment
. This class includes a constructor that can accept an optional HTML string, allowing for the creation of a DocumentFragment
.
In ElementComponent.ts
, the existing method for handling HTML is replaced by a new implementation that constructs a DocumentComponent
using the DocumentComponent.tag
method, which allows for dynamic content insertion. Additionally, two new methods are added to NodeComponent.ts
: context
, which executes a function in the context of the component, and empty
, which removes all child nodes from the component. Finally, index.ts
is updated to export the new DocumentComponent
.
src/ElementComponent.ts
involve modifications to the html
method, which now utilizes the DocumentComponent.tag
method, directly relating to the new DocumentComponent
class introduced in the main PR.NodeComponent
class in this PR is foundational for the DocumentComponent
, as it extends NodeComponent
, establishing a direct relationship between the two components.documentation
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai full review
Adds handling for HTML template literals with components.
The
ElementComponent#html()
method is a template literal tag function.Example usage:
.tag()
can be used the same way, except the return value isDocumentComponent
. Example:This is a breaking change. For the old behaviour of
.html()
that removes the component's children, call the.empty()
method first.I sneaked in another method,
NodeComponent#context()
, which lets you access this component's instance in a function without breaking the chaining.