-
Notifications
You must be signed in to change notification settings - Fork 44
[PLAYER-92] refacto components #163
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
[PLAYER-92] refacto components #163
Conversation
bc3b049 to
7386fee
Compare
7386fee to
c40ae3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request migrates legacy custom component factories to native Web Components, improving maintainability and leveraging browser standards. The refactor introduces six new custom elements (GmTextInput, GmSlider, GmSwitch, GmDropdown, GmChip, GmProgressBar) and updates all consuming plugins to use these components.
Changes:
- Introduced 6 new Web Components as custom elements replacing factory pattern components
- Migrated 10+ plugins (GPS, Battery, Network, Phone, Identifiers, IOThrottling, BasebandRIL, FingerPrint, Clipboard, GAPPSInstall) to use new components
- Updated test files to work with new event-based component APIs
- Added Babel parser configuration for ESLint to support private class fields
- Updated README with improved token authentication documentation
Reviewed changes
Copilot reviewed 38 out of 40 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/GmTextInput.js | New text input Web Component with validation and min/max constraints |
| src/components/GmSlider.js | New range slider Web Component |
| src/components/GmSwitch.js | New toggle switch Web Component |
| src/components/GmDropdown.js | New select dropdown Web Component |
| src/components/GmChip.js | New chip/tag Web Component |
| src/components/GmProgressBar.js | New progress bar Web Component |
| src/plugins/*.js | Updated plugins to use new Web Components |
| tests/unit/*.test.js | Updated tests to use new event-driven API |
| package.json | Added Babel dependencies for ESLint |
| .eslintrc.json | Configured Babel parser for private class fields |
| vitest.config.mjs | Added path alias for imports |
| src/scss/components/*.scss | Updated styles for new components |
| README.md | Enhanced token authentication documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b4ea2dc to
353b8f9
Compare
353b8f9 to
68c7a82
Compare
9ee7468 to
b3fea28
Compare
Co-authored-by: Julien Maneyrol <45173285+jmaneyrol69@users.noreply.github.com>
b3fea28 to
b7d73c5
Compare
In order, to address PR comments - **GmSlider**: Improve min/max attribute validation and value clamping logic. - **GmSwitch**: Fix infinite loop in checked setter, correctly handle 'disabled' attribute, and refactor using #updateUI pattern. - **GmDropdown**: - Extract rendering logic to #render method. - Simplify items setting logic (remove redundant length check). - Clarify supported item types in JSDoc. - **GmChip**: - Remove default 'success' type fallback to preventing masking issues. - Implement #updateUI pattern to fix attribute/setter recursion risks. - **GmTextInput**: - Split #updateUI into specific #updateAppendText and #updateUnitText methods. - Simplify 'strict-range' logic to be more generic. - **Battery Plugin**: Remove redundant bounds checking (Math.min/max) in favor of GmTextInput internal validation. - **Docs**: Correct API categorization in README.md.
Event send after each keystroke was 'change' instead of 'input' - **GmTextInput**: Stop dispatching 'change' event on every keystroke. It now correctly dispatches 'input' on keystroke and 'change' only on commit (blur/enter). - **Plugins**: Update all plugins relying on real-time feedback (Battery, GPS, Phone, Identifiers, IOThrottling, BasebandRIL) to listen to 'gm-text-input-input' instead of 'gm-text-input-change'. This separates the concerns of real-time validation (input) vs committed value (change) and eliminates duplicate event firing.
…om events µIn order to make integration test instead of unit test
b7d73c5 to
7371ded
Compare
caarmen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool to see this standardization of the different components! 🧩
Huge thanks to you Jeremy for the time you invested in the pair review 🙏🏻
Description
Migrate legacy custom components to Web Components.
This PR refactors the legacy component pattern to native Web Components, improving maintainability and leveraging browser standards.
New Web Components
GmTextInput: Text input component with validation, min/max constraints, and error messaging
GmSlider: Range slider component
GmSwitch: Toggle switch component
GmDropdown: Select dropdown component
GmChip: Chip tag
Updated Plugins
Technical Details
Migration Benefits