- [add] add
pkg.moduleas helpful hint for compilers.
- [change] update now has this signature:
update(...args: any[]), and default impl does aqueueRenderto be more provide more intuitive behaviour.
- [add]
tagNametoIComponentStatics. - [change]
observedAttributesis now optional inIComponentStatics.
- [change] render immediately on
connected, instead ofqueueRender, to have more intuitive and predictable behavior. One can always override connected and change the behavior.
- [add]
IComponentStatics, soobservedAttributesare typed.
- [fix]
attrreturn type asany.
- Lots of internal changes. Massive simplification, and better mixin architecture, and the core should now support extending any classes like HTMLElement derived classes like HTMLDivElement, etc.
- [change] State management methods have been removed entirely. They are simple enough that the application can choose to write them manually. So much so that, in most change it wouldn't even be a breaking change. So no need to keep them in the core interfaces.
- [remove]
update,dispatch
-
[BREAKING]
Componentnow only refers to the plain component with a renderer that does nothing.ComponentFnfollows the same convention as above.- Dedicated components are prefixed - for instance,
LitComponentrefers to the component impl that useslit-html,ReactComponentfor react, etc. - Being explicit seems to make the codebase less confusing and lot better to work with.
- support adapters no longer export
icomponentprimitives. For the advantage of saving adding one dependency manually, this only added more confusion than worth. The semantics are just simpler to add it and use it manually if needed.
-
[internal]
core- an internal module for the base interfaces and methodscomponent- provides the defaultComponentimpl andComponentFn
- [add] default
observedAttributes - [change] [ts] make
attrparams optional
- [change] more generic typing-fu for better ergonomics.
ComponentFnnow works better.
- [change] Better and more ergonomic type definitions
- [BREAKING] The following have been renamed to simplify things:
IComponentCore->ComponentCoreIComponent->ComponentIComponentFn->ComponentFn
- [change] The project is now re-written in TypeScript, providing the
Iprefixed versions as interfaces.
- [add] Introduced
renderBeginandrenderEndmethods. - [add]
ComponentRendererthat extendsRendererand calls the above render cycle methods.
- [add]
attrmethod on IComponent that's a helper for raw html attributes.
- [BREAKING]
IComponentFnnow passes in the component itself rather than justthis.attributes. This is simpler, provides more control, and is more performant.
- [BREAKING] Almost complete rewrite. The following changes have been done.
- There are no longer
IElementandIComponent. It's now simplified.IComponentCorewhich is baseless class, andIComponentis a class that inheritsHTMLElement.IComponentCorecan be utilized to make lightweight virtual components. Rendereris now handles all the rendering logic, which is a cheap per-instance object created throughcreateRenderercreateRenderis now a creates aRendererper instance.utilshave been removed. They are largely redundant, but created as helpers, but scraped to remove unnecessary API surface.IFnComponentis nowIComponentFn- Previously,
IDefaultonly the rendering helpers, it's contents are now insideRenderer, which is far more appropriate. - Since
IComponentCoreis now a baseless, class, any object can be made to extend it either with inheritance, or withIComponentCore.extend- The latter also requires callingIComponentCore.initinside the constructor.
- There are no longer
-
[BREAKING]
renderNowmethod is now just calledrender.queueRenderandrenderis obvious enough, and shorter form is just nicer in large codebases. -
[BREAKING] From v2, since
CustomElementrequire a reasonably modern browser anyway, es5 modules are no longer provided. Previously, icomponent provided both es6 modules, that can be accessed asicomponent/lib, and cjs, by default. Also hadpkg.moduledefined for es6 bundlers, like webpack. This no longer holds. So, if you use polyfills and use an older browser that doesn't support es6, you should to set your bundler configs to let icomponent transpile to es5. -
[BREAKING]
renderevent is no no emitted by default, and_postRender(which is a bit redundant anyway due torendered) has been removed. Since this observation is not required in most cases, it makes sense for components that need it to manually overriderenderedand dispatch the event.
- [fix] Incorrect function call for functional components
- [fix] A bug that caused functional components to always implement the default IElement. It now works correctly.
- [change] Functional components now implement IComponent instead of just IElement
- [add] Supported adaptors for
react,hyperhtmlandlit-html.
-
[BREAKING] This is a minor, but breaking release, due to an immediate, small rename.
registerTag->defineTagregister->defineComponents
This helps staying closer to standard
customElements.definenaming conventions.
- [BREAKING] This is a minor, but breaking release, due to an immediate, small rename.
IConfig->IDefaultto better reflect intention.
-
[BREAKING] The project is now called
icomponent.LiteElement->IElementLiteComponent->IComponentLiteFn->IFnComponent
Everything else remains the same.
-
[BREAKING] The following methods have been renamed while retaining the same semantics.
load->connectedunload->disconnectedattrChanged->attributeChanged
This has been done to not only stay in line with DOM spec, but also to avoid misconceptions due to the name such as
load. connected does not mean the component is fully loaded. It just means it's connected to the DOM tree.
-
[change] A
renderevent is now emitted on after every render. This is useful for external components to know when a render has occurred. This can also be used to execute code once on immediate next render, without having to hook intorenderedmethod. -
[note] The above can easily be disabled by overriding the _postRender method.