element-vir 5.4.2 → 5.5.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.
@@ -36,7 +36,7 @@ function defineFunctionalElement(functionalElementInit) {
36
36
  },
37
37
  _a.tagName = functionalElementInit.tagName,
38
38
  _a.styles = functionalElementInit.styles || (0, lit_1.css) ``,
39
- _a.initInput = functionalElementInit,
39
+ _a.init = functionalElementInit,
40
40
  _a.events = eventsMap,
41
41
  _a.renderCallback = functionalElementInit.renderCallback,
42
42
  _a.props = (0, element_properties_1.createPropertyDescriptorMap)(functionalElementInit.props),
@@ -1,13 +1,13 @@
1
1
  import { PartInfo } from 'lit/directive.js';
2
2
  import { PropertyInitMapBase, StaticElementPropertyDescriptor } from '../element-properties';
3
- import { FunctionalElementInstance } from '../functional-element';
3
+ import { FunctionalElementInstanceFromInit } from '../functional-element';
4
4
  /**
5
5
  * The directive generics (in listenDirective) are not strong enough to maintain their values. Thus,
6
6
  * the directive call is wrapped in this function.
7
7
  */
8
8
  export declare function assign<PropName extends string, PropValue>(propertyDescriptor: StaticElementPropertyDescriptor<PropName, PropValue>, value: typeof propertyDescriptor['initValue']): import("lit-html/directive").DirectiveResult<{
9
9
  new (partInfo: PartInfo): {
10
- readonly element: FunctionalElementInstance<PropertyInitMapBase>;
10
+ readonly element: FunctionalElementInstanceFromInit<PropertyInitMapBase>;
11
11
  render(propName: string, value: unknown): symbol;
12
12
  readonly _$isConnected: boolean;
13
13
  update(_part: import("lit-html").Part, props: unknown[]): unknown;
@@ -1,6 +1,6 @@
1
1
  import { ElementPartInfo, PartInfo } from 'lit/directive.js';
2
2
  import { PropertyInitMapBase } from '../element-properties';
3
- import { FunctionalElementInstance } from '../functional-element';
3
+ import { FunctionalElementInstanceFromInit } from '../functional-element';
4
4
  /** For some reason these aren't defined in lit's types already. */
5
5
  export declare type ExtraPartInfoProperties = {
6
6
  element: Element;
@@ -10,6 +10,6 @@ export declare type ExtraPartInfoProperties = {
10
10
  isConnected: boolean;
11
11
  };
12
12
  };
13
- export declare function extractFunctionalElement<PropertyInitGeneric extends PropertyInitMapBase>(partInfo: PartInfo, directiveName: string): FunctionalElementInstance<PropertyInitGeneric>;
13
+ export declare function extractFunctionalElement<PropertyInitGeneric extends PropertyInitMapBase>(partInfo: PartInfo, directiveName: string): FunctionalElementInstanceFromInit<PropertyInitGeneric>;
14
14
  export declare function extractElement<ElementType = HTMLElement>(partInfo: PartInfo, directiveName: string, constructorClass: (new () => ElementType) | (abstract new () => ElementType)): ElementType;
15
15
  export declare function assertsIsElementPartInfo(partInfo: PartInfo, directiveName: string): asserts partInfo is ElementPartInfo & ExtraPartInfoProperties;
@@ -1,4 +1,4 @@
1
- import { FunctionalElementInstance } from './functional-element';
1
+ import { FunctionalElementInstanceFromInit } from './functional-element';
2
2
  export declare type PropertyInitMapBase = Record<string, unknown>;
3
3
  export declare type ElementProperty<KeyGeneric extends string | number | symbol, ValueGeneric> = {
4
4
  name: KeyGeneric;
@@ -12,5 +12,5 @@ export declare type StaticElementPropertyDescriptor<PropName extends string, Pro
12
12
  export declare type ElementPropertyDescriptorMap<PropertyInitGeneric extends PropertyInitMapBase> = {
13
13
  [Property in keyof PropertyInitGeneric]: StaticElementPropertyDescriptor<string, PropertyInitGeneric[Property]>;
14
14
  };
15
- export declare function createPropertyProxy<PropertyInitGeneric extends PropertyInitMapBase>(propsInitMap: PropertyInitGeneric | undefined, element: FunctionalElementInstance<PropertyInitGeneric>): PropertyInitGeneric;
15
+ export declare function createPropertyProxy<PropertyInitGeneric extends PropertyInitMapBase>(propsInitMap: PropertyInitGeneric | undefined, element: FunctionalElementInstanceFromInit<PropertyInitGeneric>): PropertyInitGeneric;
16
16
  export declare function createPropertyDescriptorMap<PropertyInitGeneric extends PropertyInitMapBase>(propertyInit: PropertyInitGeneric | undefined): ElementPropertyDescriptorMap<PropertyInitGeneric>;
@@ -10,11 +10,11 @@ export declare type FunctionalElementInit<PropertyInitGeneric extends PropertyIn
10
10
  */
11
11
  tagName: CustomElementTagName;
12
12
  /** Static styles. These should not and cannot change. */
13
- styles?: CSSResult | undefined;
14
- /** Initializer for element properties. (These can be thought of as "inputs".) */
15
- props?: PropertyInitGeneric | undefined;
16
- /** Initializer for events that the element can dispatch. (These can be thought of as "outputs".) */
17
- events?: EventsInitGeneric | undefined;
13
+ styles?: CSSResult;
14
+ /** Element properties. (These can be thought of as "inputs".) */
15
+ props?: PropertyInitGeneric;
16
+ /** Events that the element can dispatch. (These can be thought of as "outputs".) */
17
+ events?: EventsInitGeneric;
18
18
  /** Called as part of the first renderCallback call, before the first renderCallback call. */
19
19
  initCallback?: InitCallback<PropertyInitGeneric, EventsInitGeneric>;
20
20
  renderCallback: RenderCallback<PropertyInitGeneric, EventsInitGeneric>;
@@ -25,14 +25,15 @@ export declare abstract class FunctionalElementBaseClass<PropertyInitGeneric ext
25
25
  abstract render(): TemplateResult | Promise<TemplateResult>;
26
26
  abstract readonly instanceProps: PropertyInitGeneric;
27
27
  }
28
- export declare type FunctionalElementInstance<PropertyInitGeneric extends PropertyInitMapBase = {}> = FunctionalElementBaseClass<PropertyInitGeneric> & PropertyInitGeneric;
29
- export declare type FunctionalElement<PropertyInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any> = (new () => FunctionalElementInstance<PropertyInitGeneric>) & ExtraStaticFunctionalElementProperties<PropertyInitGeneric, EventsInitGeneric>;
28
+ export declare type FunctionalElementInstanceFromInit<PropertyInitGeneric extends PropertyInitMapBase = {}> = FunctionalElementBaseClass<PropertyInitGeneric> & Required<PropertyInitGeneric>;
29
+ export declare type FunctionalElementInstance<FunctionalElementGeneric extends FunctionalElement> = FunctionalElementInstanceFromInit<FunctionalElementGeneric['init']>;
30
+ export declare type FunctionalElement<PropertyInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any> = (new () => FunctionalElementInstanceFromInit<PropertyInitGeneric>) & ExtraStaticFunctionalElementProperties<PropertyInitGeneric, EventsInitGeneric>;
30
31
  export declare type ExtraStaticFunctionalElementProperties<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = Readonly<{
31
32
  /** Pass through the render callback for direct unit testability */
32
33
  renderCallback: RenderCallback<PropertyInitGeneric, EventsInitGeneric>;
33
34
  events: EventDescriptorMap<EventsInitGeneric>;
34
35
  props: ElementPropertyDescriptorMap<PropertyInitGeneric>;
35
- initInput: FunctionalElementInit<PropertyInitGeneric, EventsInitGeneric>;
36
+ init: FunctionalElementInit<PropertyInitGeneric, EventsInitGeneric>;
36
37
  /**
37
38
  * Static properties have to be copied here cause they get nuked in the "new () =>
38
39
  * FunctionalElementInstance<PropertyInitGeneric>" type.
@@ -2,7 +2,7 @@ import { TemplateResult } from 'lit';
2
2
  import { TypedEvent } from '../typed-event/typed-event';
3
3
  import { EventDescriptorMap, EventInitMapEventDetailExtractor, EventsInitMap } from './element-events';
4
4
  import { PropertyInitMapBase } from './element-properties';
5
- import { FunctionalElementInstance } from './functional-element';
5
+ import { FunctionalElementInstanceFromInit } from './functional-element';
6
6
  export declare type RenderCallback<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = (params: RenderParams<PropertyInitGeneric, EventsInitGeneric>) => TemplateResult;
7
7
  export declare type InitCallback<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = (params: RenderParams<PropertyInitGeneric, EventsInitGeneric>) => void;
8
8
  export declare type SetPropCallback<PropertyInitGeneric extends PropertyInitMapBase> = (props: Partial<PropertyInitGeneric>) => void;
@@ -10,7 +10,7 @@ export declare type RenderParams<PropertyInitGeneric extends PropertyInitMapBase
10
10
  props: Readonly<PropertyInitGeneric>;
11
11
  setProps: SetPropCallback<PropertyInitGeneric>;
12
12
  events: EventDescriptorMap<EventsInitGeneric>;
13
- host: FunctionalElementInstance<PropertyInitGeneric>;
13
+ host: FunctionalElementInstanceFromInit<PropertyInitGeneric>;
14
14
  dispatch: <EventTypeNameGeneric extends keyof EventsInitGeneric>(event: TypedEvent<EventTypeNameGeneric extends string ? EventTypeNameGeneric : never, EventInitMapEventDetailExtractor<EventTypeNameGeneric, EventsInitGeneric>>) => boolean;
15
15
  /**
16
16
  * Same as dispatchElementEvent but without the extra types. This allows you to emit any events,
@@ -18,4 +18,4 @@ export declare type RenderParams<PropertyInitGeneric extends PropertyInitMapBase
18
18
  */
19
19
  genericDispatch: (event: Event) => boolean;
20
20
  };
21
- export declare function createRenderParams<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap>(element: FunctionalElementInstance<PropertyInitGeneric>, eventsMap: EventDescriptorMap<EventsInitGeneric>): RenderParams<PropertyInitGeneric, EventsInitGeneric>;
21
+ export declare function createRenderParams<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap>(element: FunctionalElementInstanceFromInit<PropertyInitGeneric>, eventsMap: EventDescriptorMap<EventsInitGeneric>): RenderParams<PropertyInitGeneric, EventsInitGeneric>;
@@ -33,7 +33,7 @@ export function defineFunctionalElement(functionalElementInit) {
33
33
  },
34
34
  _a.tagName = functionalElementInit.tagName,
35
35
  _a.styles = functionalElementInit.styles || css ``,
36
- _a.initInput = functionalElementInit,
36
+ _a.init = functionalElementInit,
37
37
  _a.events = eventsMap,
38
38
  _a.renderCallback = functionalElementInit.renderCallback,
39
39
  _a.props = createPropertyDescriptorMap(functionalElementInit.props),
@@ -1,13 +1,13 @@
1
1
  import { PartInfo } from 'lit/directive.js';
2
2
  import { PropertyInitMapBase, StaticElementPropertyDescriptor } from '../element-properties';
3
- import { FunctionalElementInstance } from '../functional-element';
3
+ import { FunctionalElementInstanceFromInit } from '../functional-element';
4
4
  /**
5
5
  * The directive generics (in listenDirective) are not strong enough to maintain their values. Thus,
6
6
  * the directive call is wrapped in this function.
7
7
  */
8
8
  export declare function assign<PropName extends string, PropValue>(propertyDescriptor: StaticElementPropertyDescriptor<PropName, PropValue>, value: typeof propertyDescriptor['initValue']): import("lit-html/directive").DirectiveResult<{
9
9
  new (partInfo: PartInfo): {
10
- readonly element: FunctionalElementInstance<PropertyInitMapBase>;
10
+ readonly element: FunctionalElementInstanceFromInit<PropertyInitMapBase>;
11
11
  render(propName: string, value: unknown): symbol;
12
12
  readonly _$isConnected: boolean;
13
13
  update(_part: import("lit-html").Part, props: unknown[]): unknown;
@@ -1,6 +1,6 @@
1
1
  import { ElementPartInfo, PartInfo } from 'lit/directive.js';
2
2
  import { PropertyInitMapBase } from '../element-properties';
3
- import { FunctionalElementInstance } from '../functional-element';
3
+ import { FunctionalElementInstanceFromInit } from '../functional-element';
4
4
  /** For some reason these aren't defined in lit's types already. */
5
5
  export declare type ExtraPartInfoProperties = {
6
6
  element: Element;
@@ -10,6 +10,6 @@ export declare type ExtraPartInfoProperties = {
10
10
  isConnected: boolean;
11
11
  };
12
12
  };
13
- export declare function extractFunctionalElement<PropertyInitGeneric extends PropertyInitMapBase>(partInfo: PartInfo, directiveName: string): FunctionalElementInstance<PropertyInitGeneric>;
13
+ export declare function extractFunctionalElement<PropertyInitGeneric extends PropertyInitMapBase>(partInfo: PartInfo, directiveName: string): FunctionalElementInstanceFromInit<PropertyInitGeneric>;
14
14
  export declare function extractElement<ElementType = HTMLElement>(partInfo: PartInfo, directiveName: string, constructorClass: (new () => ElementType) | (abstract new () => ElementType)): ElementType;
15
15
  export declare function assertsIsElementPartInfo(partInfo: PartInfo, directiveName: string): asserts partInfo is ElementPartInfo & ExtraPartInfoProperties;
@@ -1,4 +1,4 @@
1
- import { FunctionalElementInstance } from './functional-element';
1
+ import { FunctionalElementInstanceFromInit } from './functional-element';
2
2
  export declare type PropertyInitMapBase = Record<string, unknown>;
3
3
  export declare type ElementProperty<KeyGeneric extends string | number | symbol, ValueGeneric> = {
4
4
  name: KeyGeneric;
@@ -12,5 +12,5 @@ export declare type StaticElementPropertyDescriptor<PropName extends string, Pro
12
12
  export declare type ElementPropertyDescriptorMap<PropertyInitGeneric extends PropertyInitMapBase> = {
13
13
  [Property in keyof PropertyInitGeneric]: StaticElementPropertyDescriptor<string, PropertyInitGeneric[Property]>;
14
14
  };
15
- export declare function createPropertyProxy<PropertyInitGeneric extends PropertyInitMapBase>(propsInitMap: PropertyInitGeneric | undefined, element: FunctionalElementInstance<PropertyInitGeneric>): PropertyInitGeneric;
15
+ export declare function createPropertyProxy<PropertyInitGeneric extends PropertyInitMapBase>(propsInitMap: PropertyInitGeneric | undefined, element: FunctionalElementInstanceFromInit<PropertyInitGeneric>): PropertyInitGeneric;
16
16
  export declare function createPropertyDescriptorMap<PropertyInitGeneric extends PropertyInitMapBase>(propertyInit: PropertyInitGeneric | undefined): ElementPropertyDescriptorMap<PropertyInitGeneric>;
@@ -10,11 +10,11 @@ export declare type FunctionalElementInit<PropertyInitGeneric extends PropertyIn
10
10
  */
11
11
  tagName: CustomElementTagName;
12
12
  /** Static styles. These should not and cannot change. */
13
- styles?: CSSResult | undefined;
14
- /** Initializer for element properties. (These can be thought of as "inputs".) */
15
- props?: PropertyInitGeneric | undefined;
16
- /** Initializer for events that the element can dispatch. (These can be thought of as "outputs".) */
17
- events?: EventsInitGeneric | undefined;
13
+ styles?: CSSResult;
14
+ /** Element properties. (These can be thought of as "inputs".) */
15
+ props?: PropertyInitGeneric;
16
+ /** Events that the element can dispatch. (These can be thought of as "outputs".) */
17
+ events?: EventsInitGeneric;
18
18
  /** Called as part of the first renderCallback call, before the first renderCallback call. */
19
19
  initCallback?: InitCallback<PropertyInitGeneric, EventsInitGeneric>;
20
20
  renderCallback: RenderCallback<PropertyInitGeneric, EventsInitGeneric>;
@@ -25,14 +25,15 @@ export declare abstract class FunctionalElementBaseClass<PropertyInitGeneric ext
25
25
  abstract render(): TemplateResult | Promise<TemplateResult>;
26
26
  abstract readonly instanceProps: PropertyInitGeneric;
27
27
  }
28
- export declare type FunctionalElementInstance<PropertyInitGeneric extends PropertyInitMapBase = {}> = FunctionalElementBaseClass<PropertyInitGeneric> & PropertyInitGeneric;
29
- export declare type FunctionalElement<PropertyInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any> = (new () => FunctionalElementInstance<PropertyInitGeneric>) & ExtraStaticFunctionalElementProperties<PropertyInitGeneric, EventsInitGeneric>;
28
+ export declare type FunctionalElementInstanceFromInit<PropertyInitGeneric extends PropertyInitMapBase = {}> = FunctionalElementBaseClass<PropertyInitGeneric> & Required<PropertyInitGeneric>;
29
+ export declare type FunctionalElementInstance<FunctionalElementGeneric extends FunctionalElement> = FunctionalElementInstanceFromInit<FunctionalElementGeneric['init']>;
30
+ export declare type FunctionalElement<PropertyInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any> = (new () => FunctionalElementInstanceFromInit<PropertyInitGeneric>) & ExtraStaticFunctionalElementProperties<PropertyInitGeneric, EventsInitGeneric>;
30
31
  export declare type ExtraStaticFunctionalElementProperties<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = Readonly<{
31
32
  /** Pass through the render callback for direct unit testability */
32
33
  renderCallback: RenderCallback<PropertyInitGeneric, EventsInitGeneric>;
33
34
  events: EventDescriptorMap<EventsInitGeneric>;
34
35
  props: ElementPropertyDescriptorMap<PropertyInitGeneric>;
35
- initInput: FunctionalElementInit<PropertyInitGeneric, EventsInitGeneric>;
36
+ init: FunctionalElementInit<PropertyInitGeneric, EventsInitGeneric>;
36
37
  /**
37
38
  * Static properties have to be copied here cause they get nuked in the "new () =>
38
39
  * FunctionalElementInstance<PropertyInitGeneric>" type.
@@ -2,7 +2,7 @@ import { TemplateResult } from 'lit';
2
2
  import { TypedEvent } from '../typed-event/typed-event';
3
3
  import { EventDescriptorMap, EventInitMapEventDetailExtractor, EventsInitMap } from './element-events';
4
4
  import { PropertyInitMapBase } from './element-properties';
5
- import { FunctionalElementInstance } from './functional-element';
5
+ import { FunctionalElementInstanceFromInit } from './functional-element';
6
6
  export declare type RenderCallback<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = (params: RenderParams<PropertyInitGeneric, EventsInitGeneric>) => TemplateResult;
7
7
  export declare type InitCallback<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = (params: RenderParams<PropertyInitGeneric, EventsInitGeneric>) => void;
8
8
  export declare type SetPropCallback<PropertyInitGeneric extends PropertyInitMapBase> = (props: Partial<PropertyInitGeneric>) => void;
@@ -10,7 +10,7 @@ export declare type RenderParams<PropertyInitGeneric extends PropertyInitMapBase
10
10
  props: Readonly<PropertyInitGeneric>;
11
11
  setProps: SetPropCallback<PropertyInitGeneric>;
12
12
  events: EventDescriptorMap<EventsInitGeneric>;
13
- host: FunctionalElementInstance<PropertyInitGeneric>;
13
+ host: FunctionalElementInstanceFromInit<PropertyInitGeneric>;
14
14
  dispatch: <EventTypeNameGeneric extends keyof EventsInitGeneric>(event: TypedEvent<EventTypeNameGeneric extends string ? EventTypeNameGeneric : never, EventInitMapEventDetailExtractor<EventTypeNameGeneric, EventsInitGeneric>>) => boolean;
15
15
  /**
16
16
  * Same as dispatchElementEvent but without the extra types. This allows you to emit any events,
@@ -18,4 +18,4 @@ export declare type RenderParams<PropertyInitGeneric extends PropertyInitMapBase
18
18
  */
19
19
  genericDispatch: (event: Event) => boolean;
20
20
  };
21
- export declare function createRenderParams<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap>(element: FunctionalElementInstance<PropertyInitGeneric>, eventsMap: EventDescriptorMap<EventsInitGeneric>): RenderParams<PropertyInitGeneric, EventsInitGeneric>;
21
+ export declare function createRenderParams<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap>(element: FunctionalElementInstanceFromInit<PropertyInitGeneric>, eventsMap: EventDescriptorMap<EventsInitGeneric>): RenderParams<PropertyInitGeneric, EventsInitGeneric>;
@@ -1,13 +1,13 @@
1
1
  import { PartInfo } from 'lit/directive.js';
2
2
  import { PropertyInitMapBase, StaticElementPropertyDescriptor } from '../element-properties';
3
- import { FunctionalElementInstance } from '../functional-element';
3
+ import { FunctionalElementInstanceFromInit } from '../functional-element';
4
4
  /**
5
5
  * The directive generics (in listenDirective) are not strong enough to maintain their values. Thus,
6
6
  * the directive call is wrapped in this function.
7
7
  */
8
8
  export declare function assign<PropName extends string, PropValue>(propertyDescriptor: StaticElementPropertyDescriptor<PropName, PropValue>, value: typeof propertyDescriptor['initValue']): import("lit-html/directive").DirectiveResult<{
9
9
  new (partInfo: PartInfo): {
10
- readonly element: FunctionalElementInstance<PropertyInitMapBase>;
10
+ readonly element: FunctionalElementInstanceFromInit<PropertyInitMapBase>;
11
11
  render(propName: string, value: unknown): symbol;
12
12
  readonly _$isConnected: boolean;
13
13
  update(_part: import("lit-html").Part, props: unknown[]): unknown;
@@ -1,6 +1,6 @@
1
1
  import { ElementPartInfo, PartInfo } from 'lit/directive.js';
2
2
  import { PropertyInitMapBase } from '../element-properties';
3
- import { FunctionalElementInstance } from '../functional-element';
3
+ import { FunctionalElementInstanceFromInit } from '../functional-element';
4
4
  /** For some reason these aren't defined in lit's types already. */
5
5
  export declare type ExtraPartInfoProperties = {
6
6
  element: Element;
@@ -10,6 +10,6 @@ export declare type ExtraPartInfoProperties = {
10
10
  isConnected: boolean;
11
11
  };
12
12
  };
13
- export declare function extractFunctionalElement<PropertyInitGeneric extends PropertyInitMapBase>(partInfo: PartInfo, directiveName: string): FunctionalElementInstance<PropertyInitGeneric>;
13
+ export declare function extractFunctionalElement<PropertyInitGeneric extends PropertyInitMapBase>(partInfo: PartInfo, directiveName: string): FunctionalElementInstanceFromInit<PropertyInitGeneric>;
14
14
  export declare function extractElement<ElementType = HTMLElement>(partInfo: PartInfo, directiveName: string, constructorClass: (new () => ElementType) | (abstract new () => ElementType)): ElementType;
15
15
  export declare function assertsIsElementPartInfo(partInfo: PartInfo, directiveName: string): asserts partInfo is ElementPartInfo & ExtraPartInfoProperties;
@@ -1,4 +1,4 @@
1
- import { FunctionalElementInstance } from './functional-element';
1
+ import { FunctionalElementInstanceFromInit } from './functional-element';
2
2
  export declare type PropertyInitMapBase = Record<string, unknown>;
3
3
  export declare type ElementProperty<KeyGeneric extends string | number | symbol, ValueGeneric> = {
4
4
  name: KeyGeneric;
@@ -12,5 +12,5 @@ export declare type StaticElementPropertyDescriptor<PropName extends string, Pro
12
12
  export declare type ElementPropertyDescriptorMap<PropertyInitGeneric extends PropertyInitMapBase> = {
13
13
  [Property in keyof PropertyInitGeneric]: StaticElementPropertyDescriptor<string, PropertyInitGeneric[Property]>;
14
14
  };
15
- export declare function createPropertyProxy<PropertyInitGeneric extends PropertyInitMapBase>(propsInitMap: PropertyInitGeneric | undefined, element: FunctionalElementInstance<PropertyInitGeneric>): PropertyInitGeneric;
15
+ export declare function createPropertyProxy<PropertyInitGeneric extends PropertyInitMapBase>(propsInitMap: PropertyInitGeneric | undefined, element: FunctionalElementInstanceFromInit<PropertyInitGeneric>): PropertyInitGeneric;
16
16
  export declare function createPropertyDescriptorMap<PropertyInitGeneric extends PropertyInitMapBase>(propertyInit: PropertyInitGeneric | undefined): ElementPropertyDescriptorMap<PropertyInitGeneric>;
@@ -10,11 +10,11 @@ export declare type FunctionalElementInit<PropertyInitGeneric extends PropertyIn
10
10
  */
11
11
  tagName: CustomElementTagName;
12
12
  /** Static styles. These should not and cannot change. */
13
- styles?: CSSResult | undefined;
14
- /** Initializer for element properties. (These can be thought of as "inputs".) */
15
- props?: PropertyInitGeneric | undefined;
16
- /** Initializer for events that the element can dispatch. (These can be thought of as "outputs".) */
17
- events?: EventsInitGeneric | undefined;
13
+ styles?: CSSResult;
14
+ /** Element properties. (These can be thought of as "inputs".) */
15
+ props?: PropertyInitGeneric;
16
+ /** Events that the element can dispatch. (These can be thought of as "outputs".) */
17
+ events?: EventsInitGeneric;
18
18
  /** Called as part of the first renderCallback call, before the first renderCallback call. */
19
19
  initCallback?: InitCallback<PropertyInitGeneric, EventsInitGeneric>;
20
20
  renderCallback: RenderCallback<PropertyInitGeneric, EventsInitGeneric>;
@@ -25,14 +25,15 @@ export declare abstract class FunctionalElementBaseClass<PropertyInitGeneric ext
25
25
  abstract render(): TemplateResult | Promise<TemplateResult>;
26
26
  abstract readonly instanceProps: PropertyInitGeneric;
27
27
  }
28
- export declare type FunctionalElementInstance<PropertyInitGeneric extends PropertyInitMapBase = {}> = FunctionalElementBaseClass<PropertyInitGeneric> & PropertyInitGeneric;
29
- export declare type FunctionalElement<PropertyInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any> = (new () => FunctionalElementInstance<PropertyInitGeneric>) & ExtraStaticFunctionalElementProperties<PropertyInitGeneric, EventsInitGeneric>;
28
+ export declare type FunctionalElementInstanceFromInit<PropertyInitGeneric extends PropertyInitMapBase = {}> = FunctionalElementBaseClass<PropertyInitGeneric> & Required<PropertyInitGeneric>;
29
+ export declare type FunctionalElementInstance<FunctionalElementGeneric extends FunctionalElement> = FunctionalElementInstanceFromInit<FunctionalElementGeneric['init']>;
30
+ export declare type FunctionalElement<PropertyInitGeneric extends PropertyInitMapBase = any, EventsInitGeneric extends EventsInitMap = any> = (new () => FunctionalElementInstanceFromInit<PropertyInitGeneric>) & ExtraStaticFunctionalElementProperties<PropertyInitGeneric, EventsInitGeneric>;
30
31
  export declare type ExtraStaticFunctionalElementProperties<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = Readonly<{
31
32
  /** Pass through the render callback for direct unit testability */
32
33
  renderCallback: RenderCallback<PropertyInitGeneric, EventsInitGeneric>;
33
34
  events: EventDescriptorMap<EventsInitGeneric>;
34
35
  props: ElementPropertyDescriptorMap<PropertyInitGeneric>;
35
- initInput: FunctionalElementInit<PropertyInitGeneric, EventsInitGeneric>;
36
+ init: FunctionalElementInit<PropertyInitGeneric, EventsInitGeneric>;
36
37
  /**
37
38
  * Static properties have to be copied here cause they get nuked in the "new () =>
38
39
  * FunctionalElementInstance<PropertyInitGeneric>" type.
@@ -2,7 +2,7 @@ import { TemplateResult } from 'lit';
2
2
  import { TypedEvent } from '../typed-event/typed-event';
3
3
  import { EventDescriptorMap, EventInitMapEventDetailExtractor, EventsInitMap } from './element-events';
4
4
  import { PropertyInitMapBase } from './element-properties';
5
- import { FunctionalElementInstance } from './functional-element';
5
+ import { FunctionalElementInstanceFromInit } from './functional-element';
6
6
  export declare type RenderCallback<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = (params: RenderParams<PropertyInitGeneric, EventsInitGeneric>) => TemplateResult;
7
7
  export declare type InitCallback<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap> = (params: RenderParams<PropertyInitGeneric, EventsInitGeneric>) => void;
8
8
  export declare type SetPropCallback<PropertyInitGeneric extends PropertyInitMapBase> = (props: Partial<PropertyInitGeneric>) => void;
@@ -10,7 +10,7 @@ export declare type RenderParams<PropertyInitGeneric extends PropertyInitMapBase
10
10
  props: Readonly<PropertyInitGeneric>;
11
11
  setProps: SetPropCallback<PropertyInitGeneric>;
12
12
  events: EventDescriptorMap<EventsInitGeneric>;
13
- host: FunctionalElementInstance<PropertyInitGeneric>;
13
+ host: FunctionalElementInstanceFromInit<PropertyInitGeneric>;
14
14
  dispatch: <EventTypeNameGeneric extends keyof EventsInitGeneric>(event: TypedEvent<EventTypeNameGeneric extends string ? EventTypeNameGeneric : never, EventInitMapEventDetailExtractor<EventTypeNameGeneric, EventsInitGeneric>>) => boolean;
15
15
  /**
16
16
  * Same as dispatchElementEvent but without the extra types. This allows you to emit any events,
@@ -18,4 +18,4 @@ export declare type RenderParams<PropertyInitGeneric extends PropertyInitMapBase
18
18
  */
19
19
  genericDispatch: (event: Event) => boolean;
20
20
  };
21
- export declare function createRenderParams<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap>(element: FunctionalElementInstance<PropertyInitGeneric>, eventsMap: EventDescriptorMap<EventsInitGeneric>): RenderParams<PropertyInitGeneric, EventsInitGeneric>;
21
+ export declare function createRenderParams<PropertyInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap>(element: FunctionalElementInstanceFromInit<PropertyInitGeneric>, eventsMap: EventDescriptorMap<EventsInitGeneric>): RenderParams<PropertyInitGeneric, EventsInitGeneric>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "element-vir",
3
- "version": "5.4.2",
3
+ "version": "5.5.0",
4
4
  "keywords": [
5
5
  "custom",
6
6
  "web",
@@ -38,12 +38,12 @@
38
38
  "update-docs": "virmator code-in-markdown README.md --index src/index.ts"
39
39
  },
40
40
  "dependencies": {
41
- "augment-vir": "2.2.0",
41
+ "augment-vir": "2.2.1",
42
42
  "lit": "2.2.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "jest-environment-jsdom": "28.1.0",
46
46
  "virmator": "2.0.7",
47
- "vite": "2.9.8"
47
+ "vite": "2.9.9"
48
48
  }
49
49
  }