-
Notifications
You must be signed in to change notification settings - Fork 206
fix: events system #411
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
fix: events system #411
Conversation
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 PR improves the events system in Formeo by adding comprehensive support for component-specific event callbacks and DOM events. It introduces the formeoChanged event as an alias for formeoUpdated and adds granular events for add, update, and remove operations on rows, columns, and fields.
Key changes include:
- Added
formeoChangedevent that fires alongsideformeoUpdated - Added callback options for component-specific operations:
onAddRow,onAddColumn,onAddField,onRemoveRow,onRemoveColumn,onRemoveField - Added corresponding DOM events:
formeoAddedRow/Column/FieldandformeoRemovedRow/Column/Field - Added comprehensive test coverage (both unit tests and Playwright e2e tests)
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/js/constants.js | Adds constants for new events (formeoChanged, added/removed events) |
| src/lib/js/common/events.js | Implements new event dispatching logic and callback handlers |
| src/lib/js/components/data.js | Dispatches component-specific update events from the data layer |
| src/lib/js/components/component.js | Dispatches remove events when components are deleted |
| src/lib/js/components/component-data.js | Dispatches add events when components are created |
| src/lib/js/components/stages/stage.js | Uses optional chaining for safer component access |
| src/lib/js/components/edit-panel/edit-panel.js | Adds defensive check for i18n.current existence |
| src/lib/js/editor.js | Adds loadData method as an alias for setting formData |
| src/lib/js/common/events.test.js | Comprehensive unit tests for the events system |
| tests/events.spec.js | Playwright e2e tests for event functionality |
| test-events.html | Manual testing page for both callback and DOM event approaches |
| docs/options/events/README.md | Updated documentation for event system (missing new callbacks/events) |
| package.json | Renamed playwright script from test:headed to test:ui |
| src/demo/js/options/config.js | Example usage of the new onRemove callback |
| CLAUDE.md | Updated command documentation for new playwright script name |
Comments suppressed due to low confidence (1)
src/lib/js/common/events.test.js:7
- Unused import clear.
import { clear } from 'node:console'
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
|
@kevinchappell I've opened a new pull request, #412, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: kevinchappell <[email protected]>
|
🎉 This PR is included in version 4.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Improves support for events and adds an formeoChanged event that fires once per setData
Adds support for the following event callbacks:
onUpdateStageonUpdateRowonUpdateColumnonUpdateFieldonAddonAddRowonAddColumnonAddFieldonRemoveonRemoveRowonRemoveColumnonRemoveFieldAdds support for the following events:
formeoLoadedformeoSavedformeoUpdatedformeoChangedformeoUpdatedStageformeoUpdatedRowformeoUpdatedColumnformeoUpdatedFieldformeoClearedformeoOnRenderformeoConditionUpdatedformeoAddedRowformeoAddedColumnformeoAddedFieldformeoRemovedRowformeoRemovedColumnformeoRemovedField