element-vir 6.1.4 → 6.1.6
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequiredBy } from 'augment-vir';
|
|
1
|
+
import { RequiredAndNotNullBy, RequiredBy } from 'augment-vir';
|
|
2
2
|
import { CSSResult, LitElement, TemplateResult } from 'lit';
|
|
3
3
|
import { CssVarNameOrValueMap } from './css-vars';
|
|
4
4
|
import { DeclarativeElementInit } from './declarative-element-init';
|
|
@@ -6,8 +6,9 @@ import { EventDescriptorMap, EventsInitMap } from './element-events';
|
|
|
6
6
|
import { ElementPropertyDescriptorMap, PropertyInitMapBase } from './element-properties';
|
|
7
7
|
import { HostClassNamesMap } from './host-classes';
|
|
8
8
|
import { RenderCallback } from './render-callback';
|
|
9
|
-
export declare type
|
|
10
|
-
|
|
9
|
+
export declare type HostInstanceType<InputsGeneric extends PropertyInitMapBase, StateGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap, HostClassKeys extends string, CssVarKeys extends string> = RequiredAndNotNullBy<DeclarativeElement<InputsGeneric, StateGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>, 'shadowRoot'>;
|
|
10
|
+
export declare type DeclarativeElementDefinition<InputsGeneric extends PropertyInitMapBase = any, StateInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any, HostClassKeys extends string = string, CssVarKeys extends string = string> = (new () => HostInstanceType<InputsGeneric, StateInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>) & StaticDeclarativeElementProperties<InputsGeneric, StateInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys> & {
|
|
11
|
+
instanceType: HostInstanceType<InputsGeneric, StateInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>;
|
|
11
12
|
};
|
|
12
13
|
export declare abstract class DeclarativeElement<InputsGeneric extends PropertyInitMapBase = any, PropertyInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any, HostClassKeys extends string = string, CssVarKeys extends string = string> extends LitElement {
|
|
13
14
|
static readonly tagName: StaticDeclarativeElementProperties<PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string>['tagName'];
|
|
@@ -15,6 +16,7 @@ export declare abstract class DeclarativeElement<InputsGeneric extends PropertyI
|
|
|
15
16
|
static readonly isStrictInstance: StaticDeclarativeElementProperties<PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string>['isStrictInstance'];
|
|
16
17
|
static readonly renderCallback: StaticDeclarativeElementProperties<PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string>['renderCallback'];
|
|
17
18
|
static readonly inputsType: StaticDeclarativeElementProperties<PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string>['inputsType'];
|
|
19
|
+
static readonly stateType: StaticDeclarativeElementProperties<PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string>['stateType'];
|
|
18
20
|
static readonly events: StaticDeclarativeElementProperties<PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string>['events'];
|
|
19
21
|
static readonly stateInit: StaticDeclarativeElementProperties<PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string>['stateInit'];
|
|
20
22
|
static readonly init: StaticDeclarativeElementProperties<PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, string, string>['init'];
|
|
@@ -29,14 +31,15 @@ export declare abstract class DeclarativeElement<InputsGeneric extends PropertyI
|
|
|
29
31
|
abstract markInputsAsHavingBeenSet(): void;
|
|
30
32
|
abstract readonly definition: DeclarativeElementDefinition<InputsGeneric, PropertyInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>;
|
|
31
33
|
}
|
|
32
|
-
export interface StaticDeclarativeElementProperties<InputsGeneric extends PropertyInitMapBase,
|
|
34
|
+
export interface StaticDeclarativeElementProperties<InputsGeneric extends PropertyInitMapBase, StateInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap, HostClassKeys extends string, CssVarKeys extends string> {
|
|
33
35
|
/** Pass through the render callback for direct unit testability */
|
|
34
|
-
readonly renderCallback: RenderCallback<InputsGeneric,
|
|
36
|
+
readonly renderCallback: RenderCallback<InputsGeneric, StateInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>;
|
|
35
37
|
events: EventDescriptorMap<EventsInitGeneric>;
|
|
36
|
-
stateInit: ElementPropertyDescriptorMap<
|
|
37
|
-
init: RequiredBy<DeclarativeElementInit<InputsGeneric,
|
|
38
|
+
stateInit: ElementPropertyDescriptorMap<StateInitGeneric>;
|
|
39
|
+
init: RequiredBy<DeclarativeElementInit<InputsGeneric, StateInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>, 'stateInit' | 'events'>;
|
|
38
40
|
inputsType: InputsGeneric;
|
|
39
|
-
|
|
41
|
+
stateType: StateInitGeneric;
|
|
42
|
+
isStrictInstance: (element: unknown) => element is DeclarativeElement<InputsGeneric, StateInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>;
|
|
40
43
|
hostClasses: HostClassNamesMap<string, HostClassKeys>;
|
|
41
44
|
cssVarNames: CssVarNameOrValueMap<CssVarKeys>;
|
|
42
45
|
cssVarValues: CssVarNameOrValueMap<CssVarKeys>;
|
|
@@ -51,6 +51,9 @@ export function defineElementNoInputs(initInput) {
|
|
|
51
51
|
static get inputsType() {
|
|
52
52
|
throw new Error(`"inputsType" was called on ${initInput.tagName} as a value but it is only for types.`);
|
|
53
53
|
}
|
|
54
|
+
static get stateType() {
|
|
55
|
+
throw new Error(`"stateType" was called on ${initInput.tagName} as a value but it is only for types.`);
|
|
56
|
+
}
|
|
54
57
|
markInputsAsHavingBeenSet() {
|
|
55
58
|
if (!this.haveInputsBeenSet) {
|
|
56
59
|
this.haveInputsBeenSet = true;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { RequiredAndNotNullBy } from 'augment-vir';
|
|
2
1
|
import { TemplateResult } from 'lit';
|
|
3
2
|
import { TypedEvent } from '../typed-event/typed-event';
|
|
4
|
-
import { DeclarativeElement } from './declarative-element';
|
|
3
|
+
import { DeclarativeElement, HostInstanceType } from './declarative-element';
|
|
5
4
|
import { EventDescriptorMap, EventInitMapEventDetailExtractor, EventsInitMap } from './element-events';
|
|
6
5
|
import { PropertyInitMapBase } from './element-properties';
|
|
7
6
|
export declare type RenderCallback<InputsGeneric extends PropertyInitMapBase = any, StateGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any, HostClassKeys extends string = any, CssVarKeys extends string = any> = (params: RenderParams<InputsGeneric, StateGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>) => TemplateResult;
|
|
8
7
|
export declare type InitCallback<InputsGeneric extends PropertyInitMapBase, StateGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap, HostClassKeys extends string, CssVarKeys extends string> = (params: RenderParams<InputsGeneric, StateGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>) => void;
|
|
9
8
|
export declare type UpdateStateCallback<StateGeneric extends PropertyInitMapBase> = (newState: Partial<StateGeneric>) => void;
|
|
10
|
-
export declare type RenderParams<InputsGeneric extends PropertyInitMapBase,
|
|
11
|
-
state: Readonly<
|
|
12
|
-
updateState: UpdateStateCallback<
|
|
9
|
+
export declare type RenderParams<InputsGeneric extends PropertyInitMapBase, StateInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap, HostClassKeys extends string, CssVarKeys extends string> = {
|
|
10
|
+
state: Readonly<StateInitGeneric>;
|
|
11
|
+
updateState: UpdateStateCallback<StateInitGeneric>;
|
|
13
12
|
events: EventDescriptorMap<EventsInitGeneric>;
|
|
14
|
-
host:
|
|
13
|
+
host: HostInstanceType<InputsGeneric, StateInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>;
|
|
15
14
|
dispatch: <EventTypeNameGeneric extends keyof EventsInitGeneric>(event: TypedEvent<EventTypeNameGeneric extends string ? EventTypeNameGeneric : never, EventInitMapEventDetailExtractor<EventTypeNameGeneric, EventsInitGeneric>>) => boolean;
|
|
16
15
|
inputs: InputsGeneric;
|
|
17
16
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "element-vir",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.6",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"custom",
|
|
6
6
|
"web",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"augment-vir": "2.5.0",
|
|
40
|
-
"lit": "2.
|
|
40
|
+
"lit": "2.4.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@open-wc/testing": "3.1.6",
|