-
-
Notifications
You must be signed in to change notification settings - Fork 155
Initial commit of Components #766
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
- Adds Component existential wrapper used for nesting App - Adds `notify` for bidirectional communication between components (parent, child or siblings) - Modifies diff.js to mount / unmount components - Creates top-level ComponentMap used to store sinks and threads for each Component - Adds components example (modified from simple.jsexe) - Renames Notify to Waiter (reuse 'notify' elsewhere) - Creates Miso.Internal
Contributor
|
Let's go! |
Contributor
|
Perhaps effectful can be a useful guide/inspiration on how to implement static safety? |
Owner
Author
|
@brakubraku Will check it out. We have options. Want to keep it simple for the LLMs too. You can join our matrix server if you want to discuss more. |
- Update interface for haskell-miso
- Major diff.js refactoring (tests pass) to handle 'vcomp' - Added mounting and unmounting of Components - removeEventListener called during unmount - Fix 'destroy' name clash in tests - Bring in synchronous callbacks from ghcjs-base for the ghcjs build - Export code coverage from top-level
- Add mail function (like notify) - Use strict Map
- Adds syncCallback, and uses it with lifecycle hooks
c1cee59 to
fb4d9b7
Compare
- Adds a builder for packaging wasm built from cabal - Updates components to remove -threaded, add hs_start export
- Remove allowUnfree, allowUnbroken - Move releases into top-level export
- Since syncCallback' has not yet been included there are bugs when attempting to free resources (when doing it async). - When syncCallback' is added to jsaddle-wasm, incorporate it.
0a1caa3 to
297fcdb
Compare
99bb975 to
7076c8c
Compare
Owner
Author
|
cc @Bobris |
This was referenced Apr 3, 2025
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🍜 Miso Components
Adds React-style components to Miso. This allows the embedding of
AppwithinAppusing an existential wrapperSomeComponentimplemented as a new branch of theViewtree.This is a work in progressAPI
SomeComponentexistential wrapper used for nestingAppnotifyfor bidirectional communication between components (parent, child or siblings)diff.jsto mount / unmount componentsComponentMapused to storeSinks andThreads for eachComponentsimple.jsexe)NotifytoWaiter(reuses 'notify' elsewhere)Miso.InternalOutstanding:
examples/componentscomponentAppstartComponentconsole.errorinmountComponentif a component has already been mounted w/ the same name.Componentmounting and unmounting, and syncChildrenAppnames and mountPoints (e.g.App "todo-app" model action)[Attribute action]onComponent(allows events, attributes to be placed onComponent)data-component-idattribute for identifyingComponentsConsider definingEffectasTransitionsyncCallback'(sync callbacks that return a value), under wasm, ghcjs, new js backend and native.KeyonComponentEffectto be aStatemonad somwon't be required for use withnotify(will just addmailfunction inTransitioninterface for now.diff.jsonMounted,onUnmounted, etc.)removeEventListenerfor all events in aComponentonunmountPitfalls:
It is possible to create cycles in the component graph by sending mutually recursive notifications. This is true currently in miso as well (vanilla non-component miso has the same issue). So just be responsible.
Components can accidentally be nested recursively and mutually recursively. This is near impossible to catch statically w/o introducing GADTs (we tried
HRose), and while it works, it significantly alters the UI. The component implementation as it exists right now is completely backwards compatible. Simplicity is in the spirit of the project so we don't plan on introducing fancy types to ameliorate the situation. Component names should always be unique, and the nesting of components should always form an acyclic graph.