- [add] add
pkg.module
as helpful hint for compilers.
- [change] update now has this signature:
update(...args: any[])
, and default impl does aqueueRender
to be more provide more intuitive behaviour.
- [add]
tagName
toIComponentStatics
. - [change]
observedAttributes
is 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
, soobservedAttributes
are typed.
- [fix]
attr
return 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]
Component
now only refers to the plain component with a renderer that does nothing.ComponentFn
follows the same convention as above.- Dedicated components are prefixed - for instance,
LitComponent
refers to the component impl that useslit-html
,ReactComponent
for react, etc. - Being explicit seems to make the codebase less confusing and lot better to work with.
- support adapters no longer export
icomponent
primitives. 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 defaultComponent
impl andComponentFn
- [add] default
observedAttributes
- [change] [ts] make
attr
params optional
- [change] more generic typing-fu for better ergonomics.
ComponentFn
now works better.
- [change] Better and more ergonomic type definitions
- [BREAKING] The following have been renamed to simplify things:
IComponentCore
->ComponentCore
IComponent
->Component
IComponentFn
->ComponentFn
- [change] The project is now re-written in TypeScript, providing the
I
prefixed versions as interfaces.
- [add] Introduced
renderBegin
andrenderEnd
methods. - [add]
ComponentRenderer
that extendsRenderer
and calls the above render cycle methods.
- [add]
attr
method on IComponent that's a helper for raw html attributes.
- [BREAKING]
IComponentFn
now 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
IElement
andIComponent
. It's now simplified.IComponentCore
which is baseless class, andIComponent
is a class that inheritsHTMLElement
.IComponentCore
can be utilized to make lightweight virtual components. Renderer
is now handles all the rendering logic, which is a cheap per-instance object created throughcreateRenderer
createRender
is now a creates aRenderer
per instance.utils
have been removed. They are largely redundant, but created as helpers, but scraped to remove unnecessary API surface.IFnComponent
is nowIComponentFn
- Previously,
IDefault
only the rendering helpers, it's contents are now insideRenderer
, which is far more appropriate. - Since
IComponentCore
is now a baseless, class, any object can be made to extend it either with inheritance, or withIComponentCore.extend
- The latter also requires callingIComponentCore.init
inside the constructor.
- There are no longer
-
[BREAKING]
renderNow
method is now just calledrender
.queueRender
andrender
is obvious enough, and shorter form is just nicer in large codebases. -
[BREAKING] From v2, since
CustomElement
require 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.module
defined 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]
render
event 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 overriderendered
and 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
,hyperhtml
andlit-html
.
-
[BREAKING] This is a minor, but breaking release, due to an immediate, small rename.
registerTag
->defineTag
register
->defineComponents
This helps staying closer to standard
customElements.define
naming conventions.
- [BREAKING] This is a minor, but breaking release, due to an immediate, small rename.
IConfig
->IDefault
to better reflect intention.
-
[BREAKING] The project is now called
icomponent
.LiteElement
->IElement
LiteComponent
->IComponent
LiteFn
->IFnComponent
Everything else remains the same.
-
[BREAKING] The following methods have been renamed while retaining the same semantics.
load
->connected
unload
->disconnected
attrChanged
->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
render
event 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 intorendered
method. -
[note] The above can easily be disabled by overriding the _postRender method.