element-vir 12.0.2 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,7 +6,7 @@ import { CssVarNameOrValueMap } from './properties/css-vars';
|
|
|
6
6
|
import { EventDescriptorMap, EventsInitMap } from './properties/element-events';
|
|
7
7
|
import { ElementPropertyDescriptorMap, PropertyInitMapBase } from './properties/element-properties';
|
|
8
8
|
import { HostClassNamesMap } from './properties/host-classes';
|
|
9
|
-
import { RenderCallback } from './render-callback';
|
|
9
|
+
import { RenderCallback, RenderParams } from './render-callback';
|
|
10
10
|
export type HostInstanceType<TagNameGeneric extends CustomElementTagName, InputsGeneric extends PropertyInitMapBase, StateInitMaybeAsyncGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap, HostClassKeys extends string, CssVarKeys extends string> = RequiredAndNotNullBy<DeclarativeElement<TagNameGeneric, InputsGeneric, StateInitMaybeAsyncGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys, any>, 'shadowRoot'>;
|
|
11
11
|
export type DeclarativeElementDefinition<TagNameGeneric extends CustomElementTagName = any, InputsGeneric extends PropertyInitMapBase = any, StateInitMaybeAsyncGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any, HostClassKeys extends string = string, CssVarKeys extends string = string, RenderOutputGeneric = any> = (new () => HostInstanceType<TagNameGeneric, InputsGeneric, StateInitMaybeAsyncGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>) & StaticDeclarativeElementProperties<TagNameGeneric, InputsGeneric, StateInitMaybeAsyncGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys, RenderOutputGeneric> & {
|
|
12
12
|
instanceType: HostInstanceType<TagNameGeneric, InputsGeneric, StateInitMaybeAsyncGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>;
|
|
@@ -24,6 +24,7 @@ export declare abstract class DeclarativeElement<TagNameGeneric extends CustomEl
|
|
|
24
24
|
static readonly hostClasses: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string, unknown>['hostClasses'];
|
|
25
25
|
static readonly cssVarNames: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string, unknown>['cssVarNames'];
|
|
26
26
|
static readonly cssVarValues: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string, unknown>['cssVarValues'];
|
|
27
|
+
abstract lastRenderedProps: Pick<RenderParams<any, InputsGeneric, StateInitMaybeAsyncGeneric, any, any, any>, 'inputs' | 'state'>;
|
|
27
28
|
abstract render(): unknown;
|
|
28
29
|
abstract readonly instanceState: MaybeAsyncStateToSync<StateInitMaybeAsyncGeneric>;
|
|
29
30
|
abstract readonly asyncStateHandlerMap: AsyncStateHandlerMap<StateInitMaybeAsyncGeneric>;
|
|
@@ -2,4 +2,4 @@ import { DeclarativeElementDefinition } from './declarative-element';
|
|
|
2
2
|
import { CustomElementTagName, DeclarativeElementInit } from './declarative-element-init';
|
|
3
3
|
import { EventsInitMap } from './properties/element-events';
|
|
4
4
|
import { PropertyInitMapBase } from './properties/element-properties';
|
|
5
|
-
export declare function defineElementNoInputs<TagNameGeneric extends CustomElementTagName = '-', InputsGeneric extends PropertyInitMapBase = {},
|
|
5
|
+
export declare function defineElementNoInputs<TagNameGeneric extends CustomElementTagName = '-', InputsGeneric extends PropertyInitMapBase = {}, StateInitMaybeAsyncGeneric extends PropertyInitMapBase = {}, EventsInitGeneric extends EventsInitMap = {}, HostClassKeys extends string = '', CssVarKeys extends string = '', RenderOutputGeneric = any>(initInput: DeclarativeElementInit<TagNameGeneric, InputsGeneric, StateInitMaybeAsyncGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys, RenderOutputGeneric>): DeclarativeElementDefinition<TagNameGeneric, InputsGeneric, StateInitMaybeAsyncGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys, RenderOutputGeneric>;
|
|
@@ -74,6 +74,10 @@ export function defineElementNoInputs(initInput) {
|
|
|
74
74
|
state: renderParams.state,
|
|
75
75
|
inputs: renderParams.inputs,
|
|
76
76
|
});
|
|
77
|
+
this.lastRenderedProps = {
|
|
78
|
+
inputs: { ...renderParams.inputs },
|
|
79
|
+
state: { ...renderParams.state },
|
|
80
|
+
};
|
|
77
81
|
return renderResult;
|
|
78
82
|
}
|
|
79
83
|
catch (caught) {
|
|
@@ -105,6 +109,7 @@ export function defineElementNoInputs(initInput) {
|
|
|
105
109
|
super();
|
|
106
110
|
this.initCalled = false;
|
|
107
111
|
this.hasRendered = false;
|
|
112
|
+
this.lastRenderedProps = undefined;
|
|
108
113
|
this.haveInputsBeenSet = false;
|
|
109
114
|
// this is set below in Object.defineProperties
|
|
110
115
|
this.definition = {};
|