Skip to content

Make the elements plugin work#75

Open
DmitrySharabin wants to merge 87 commits intomainfrom
elements-plugin
Open

Make the elements plugin work#75
DmitrySharabin wants to merge 87 commits intomainfrom
elements-plugin

Conversation

@DmitrySharabin
Copy link
Member

No description provided.

LeaVerou and others added 30 commits December 8, 2025 18:32
- Allow kebab-case, camelCase OR underscore_case for hook name
- Remove unused argument from `add()`
- Remove unused signatures from `add()` (multiple callbacks at the same hook or the same callback on multiple hooks)
- Remove unised logic from constructor (new Hooks(hooksObj))
- New `Hook` class to manage hook metadata
…text

Unused right now, but the intent is we can replace `init`, `setup` etc that way
Co-authored-by: Dmitry Sharabin <dmitrysharabin@gmail.com>
Co-Authored-By: Dmitry Sharabin <dmitrysharabin@gmail.com>
Co-Authored-By: Dmitry Sharabin <dmitrysharabin@gmail.com>
Co-authored-by: Dmitry Sharabin <dmitrysharabin@gmail.com>
Co-authored-by: Dmitry Sharabin <dmitrysharabin@gmail.com>
Co-authored-by: Dmitry Sharabin <dmitrysharabin@gmail.com>
Co-authored-by: Dmitry Sharabin <dmitrysharabin@gmail.com>
- Port formAssociated to the new syntax,
- Split to three
- Rename to "form behavior"
- Make it easier for subclasses to `setup()`
- Declarative way to include plugins
- Don't error if internals are already attached or when it's not supported
DmitrySharabin and others added 18 commits December 12, 2025 15:44
Inspired by first-class protocols
Deleted apply-mixins.js and define-mixin.js from src/mixins as they are no longer needed.
Still missing dynamic slots and auto-slotting by selector
So that subclasses do not overwrite parent class hooks and plugins don't need to be installed separately on every subclass
Co-authored-by: Dmitry Sharabin <dmitrysharabin@gmail.com>
- Don’t shadow `attachShadow` from `HTML.prototype`
- Avoid infinite recursion
}
},

constructed () {
Copy link
Member Author

Choose a reason for hiding this comment

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

Interestingly, the code of this hook should run at a different time depending on cases:

  • It should run before we begin to work with internals, form-associated, events, etc
  • But at the same time, it should run after an element is connected, so all other custom elements used inside the element are connected and ready to be queried

I can't think of a hook that we should use here. I'm puzzled. 😕

Copy link
Member Author

Choose a reason for hiding this comment

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

first_connected might be a better choice? Hm...

Copy link
Contributor

Choose a reason for hiding this comment

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

I think perhaps we should use a proxy, like I did with slots. Then it's only queried when needed.

LeaVerou and others added 2 commits December 16, 2025 10:29
Co-Authored-By: Dmitry Sharabin <dmitrysharabin@gmail.com>
@LeaVerou LeaVerou force-pushed the hooks-plugins branch 2 times, most recently from 9df45a0 to b667ca4 Compare December 28, 2025 03:03
Base automatically changed from hooks-plugins to main January 11, 2026 17:55
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.

2 participants