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 #82 #38

Merged
merged 2 commits into from
Oct 23, 2024
Merged

Conversation

sun-mota
Copy link
Contributor

@sun-mota sun-mota commented Oct 23, 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: #82

Summary:

  • Update dependency versions

  • AuroSideNav.register is to easily register the element without extra importing

  • import "@aurodesignsystem/auro-sidenav" will still register this element to

  • import { AuroSideNav } from '../src/auro-sidenav wont register this element until AuroSideNav.register gets called

  • Same changes on AuroSideNavItem and AuroSideNavSection

  • Fixed the typo on Recommended Use and Version Control: clement -> element

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 static register methods to AuroSideNav, AuroSideNavItem, and AuroSideNavSection for easier custom element registration. Update dependencies and documentation, and introduce a new Rollup build configuration for demo purposes.

New Features:

  • Introduce static register methods for AuroSideNav, AuroSideNavItem, and AuroSideNavSection to allow custom element registration without extra imports.

Bug Fixes:

  • Correct typo in documentation from 'clement' to 'element'.

Enhancements:

  • Update dependency versions to the latest releases.

Build:

  • Add a new Rollup configuration for building a minified index.js for demo purposes.

Documentation:

  • Update documentation to reflect the new register method for custom elements and correct a typo.

- Update dependency versions

- `AuroSideNav.register` is to easily register the element without extra importing
- `import "@aurodesignsystem/auro-sidenav"` will still register this element to <auro-sidenav>
- `import { AuroSideNav } from '../src/auro-sidenav` wont register this element until `AuroSideNav.register` gets called
- Same changes on `AuroSideNavItem` and `AuroSideNavSection`

- Fixed the typo on Recommended Use and Version Control: `clement` -> `element`
@sun-mota sun-mota requested a review from a team as a code owner October 23, 2024 18:40
@sun-mota sun-mota linked an issue Oct 23, 2024 that may be closed by this pull request
@sun-mota sun-mota self-assigned this Oct 23, 2024
Copy link

sourcery-ai bot commented Oct 23, 2024

Reviewer's Guide by Sourcery

This pull request introduces a new static register method to the AuroSideNav, AuroSideNavItem, and AuroSideNavSection classes. This method allows for easier and more flexible registration of these custom elements. The PR also updates the documentation and demo to reflect these changes, and makes some minor improvements to the component's functionality.

Class diagram for AuroSideNav, AuroSideNavItem, and AuroSideNavSection

classDiagram
    class AuroSideNav {
        +static register(name="auro-sidenav")
        +connectedCallback()
        +initItems()
    }
    class AuroSideNavItem {
        +static register(name="auro-sidenavitem")
    }
    class AuroSideNavSection {
        +static register(name="auro-sidenavsection")
    }
    note for AuroSideNav "Added static register method"
    note for AuroSideNavItem "Added static register method"
    note for AuroSideNavSection "Added static register method"
Loading

File-Level Changes

Change Details Files
Added static register method to AuroSideNav, AuroSideNavItem, and AuroSideNavSection classes
  • Implemented register method in AuroSideNav class
  • Implemented register method in AuroSideNavItem class
  • Implemented register method in AuroSideNavSection class
  • Removed default element definitions
  • Updated documentation to use new register method
src/auro-sidenav.js
src/auro-sidenavsection.js
src/auro-sidenavitem.js
demo/index.md
docs/partials/index.md
Updated demo and documentation to reflect new registration method
  • Removed old registration code from demo/index.html
  • Added new demo/index.min.js script
  • Updated rollup configuration to build demo/index.min.js
  • Updated documentation with new registration examples
demo/index.html
rollup.config.mjs
demo/index.md
docs/partials/index.md
Improved AuroSideNav component functionality
  • Updated initItems method to select elements with auro-sidenavitem attribute
  • Fixed typo in documentation: 'clement' to 'element'
src/auro-sidenav.js
demo/index.md
docs/partials/index.md

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

github-actions bot commented Oct 23, 2024

Surge demo deployment failed! 😭

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 - here's some feedback:

Overall Comments:

  • The change in the initItems() method to include elements with [auro-sidenavitem] attribute is not explained in the PR description. Could you provide more context on why this change was made and its potential impacts?
  • Removing the default component registration might break existing implementations that rely on automatic registration. Have you considered the potential backwards compatibility issues, and if so, what's the recommended migration path for existing users?
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟡 Documentation: 1 issue found

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.

src/auro-sidenav.js Show resolved Hide resolved
demo/index.md 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
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
Copy link
Member

@jason-capsule42 jason-capsule42 left a comment

Choose a reason for hiding this comment

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

Demo API page needs to import the same as the index page.

@sun-mota sun-mota merged commit 2275d78 into main Oct 23, 2024
6 of 7 checks passed
@sun-mota sun-mota deleted the sunMota/easyRegistry/37 branch October 23, 2024 23:43
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-sidenav: Update component registration logic
2 participants