Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): add register static method #70 #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sun-mota
Copy link

@sun-mota sun-mota commented Oct 24, 2024

Alaska Airlines Pull Request

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Resolves: #70

Summary:

  • Update dependency versions
  • AuroAlert.register is to easily register the element without extra importing
  • import "@aurodesignsystem/auro-alert" will still register this element to
  • import { AuroAlert } from '../src/auro-alert.js wont register this element until AuroAlert.register gets called

Type of change:

Please delete options that are not relevant.

  • New capability
  • Revision of an existing capability
  • Infrastructure change (automation, etc.)
  • Other (please elaborate)

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

Summary by Sourcery

Add a static method AuroAlert.register to facilitate element registration, update dependencies, and adjust the build configuration to include demo scripts.

New Features:

  • Introduce a static method AuroAlert.register to allow easy registration of the element without extra importing.

Enhancements:

  • Update dependency versions to the latest available.

Build:

  • Modify the Rollup configuration to include new build targets for demo files, generating index.min.js and api.min.js.

Documentation:

  • Update documentation to reflect the new AuroAlert.register method for registering custom elements.

- Update dependency versions
- `AuroAlert.register` is to easily register the element without extra importing
- `import "@aurodesignsystem/auro-alert"` will still register this element to <auro-alert>
- `import { AuroAlert } from '../src/auro-alert.js` wont register this element until `AuroAlert.register` gets called
@sun-mota sun-mota self-assigned this Oct 24, 2024
@sun-mota sun-mota linked an issue Oct 24, 2024 that may be closed by this pull request
Copy link

sourcery-ai bot commented Oct 24, 2024

Reviewer's Guide by Sourcery

This PR introduces a new static register method to the AuroAlert component to simplify the element registration process. The implementation replaces the direct customElements.define call with a more flexible registration approach, allowing custom element names. The changes also include updates to the build configuration and documentation to reflect the new registration pattern.

Class diagram for AuroAlert with new register method

classDiagram
    class AuroAlert {
        +static register(name="auro-alert")
        +firstUpdated()
        +render()
    }
    note for AuroAlert "The register method allows custom element registration."
Loading

File-Level Changes

Change Details Files
Added a new static register method for component registration
  • Added AuroAlert.register static method that accepts a custom element name
  • Removed direct customElements.define call
  • Updated registration to use AuroLibraryRuntimeUtils internally
src/auro-alert.js
Updated build configuration to support demo examples
  • Added indexExamplesConfig for demo/index.js
  • Added apiExamplesConfig for demo/api.js
  • Updated export configuration
rollup.config.mjs
Updated documentation and examples to reflect new registration pattern
  • Updated code examples to use AuroAlert.register
  • Fixed typo changing 'clement' to 'element'
  • Simplified demo script imports
demo/index.md
docs/partials/index.md
demo/index.html
demo/api.html

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @sun-mota - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

rollup.config.mjs Show resolved Hide resolved
demo/api.min.js Show resolved Hide resolved
demo/api.min.js Show resolved Hide resolved
demo/api.min.js Show resolved Hide resolved
demo/api.min.js Show resolved Hide resolved
demo/index.min.js Show resolved Hide resolved
demo/index.min.js Show resolved Hide resolved
demo/index.min.js Show resolved Hide resolved
demo/index.min.js Show resolved Hide resolved
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.

Auro-alert: Update component registration logic
1 participant