Dec v0.1.3-alpha
Pre-release
Pre-release
·
55 commits
to main
since this release
This release is a major milestone for Dec! This version adds standardizing and unit testing for VirtualInstance Directives; removes some API/syntax sugar that was confusing, unsafe, or had uncommon use cases; and adds API for more common use cases.
Some API changes:
- Added the
MapChildren,MapChildrenByKey, andMapChildrenByValuedirectives which meet some common use cases of turning a state into a list of children reactively. See https://dec.ambergracesoftware.com/docs/Chapter1/MappingChildComponents for a usage guide. - Removed the
ExtractChildTemplatedirective in favor of the more straightforwardDestroyPremadeChildren, which together withFindChildserve a similar use case. - Removed the instance parameter for
OnMount/OnMount` callbacks to improve the safety of handling side effects with those directives. - Added support for having observables return observables, and so on, as an argument for attributes like
SetPropertieswhich accept observable values. Each chained observable value will be unwrapped and subscribed/unsubscribed until a terminal value is found. - Tested and added true support for the input types that were defined on a directive's API where some edge cases that were described in the API documentation were not actually supported before.
- AddTags directive now behaves exactly as you would expect it to when calling AddTags with multiple directives on the same VirtualInstance, using an observable list of tags, or using a list of observable tags (and so on). So long as there is a mounted static/observable reference to a tag, it will remain on the instance until all references to the tag string are unmounted.
- Correctly handles multiple
:SetProperties()/:SetAttributes()directives on the same VirtualInstance, ignoring all but the last-defined value on the last directive for each key. Only exception to this rule is if two:SetProperties()directives connect to the same event, in which case both listeners from each directive will be handled. Covered by unit testing. - Removed "ChildPath" syntax sugar where you could do something like this:
VirtualInstance:AddChild({"Child", "Descendant"}, ...)as sugar forVirtualInstance:AddChild("Child", Dec.Premade("Descendant", ...)),, as it was a confusing syntax that could go wrong in many ways. - Removed
CopyandDeepCopydirectives, which lack a very common use case.
Pull Requests
- Chapter 1 Section 3 - Passing in Props by @AmberGraceSoftware in #27
- Add
MapChildrenutility functions for rendering/updating individual child elements from an input observable table by @AmberGraceSoftware in #30 - "Mapping Child Components" Tutorial by @AmberGraceSoftware in #31
- VirtualInstance Directives Refactor by @AmberGraceSoftware in #32
- Combine Directive by @AmberGraceSoftware in #33
- Test & Finalize SetProperties Functionality by @AmberGraceSoftware in #34
- Fix Edge cases for mounting VirtualInstance References by @AmberGraceSoftware in #35
- Coverage for all VirtualInstance Directives by @AmberGraceSoftware in #36
Full Changelog: v0.1.2-alpha...v0.1.3-alpha