element-vir 6.3.1 → 6.3.2
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.
- package/dist/augments/type.d.ts +1 -1
- package/dist/declarative-element/css-vars.d.ts +3 -3
- package/dist/declarative-element/css-vars.js +1 -1
- package/dist/declarative-element/declarative-element-init.d.ts +2 -2
- package/dist/declarative-element/declarative-element.d.ts +3 -3
- package/dist/declarative-element/define-element-no-inputs.js +16 -16
- package/dist/declarative-element/definition-options.d.ts +1 -1
- package/dist/declarative-element/directives/assign-with-clean-up.directive.d.ts +1 -1
- package/dist/declarative-element/directives/awaiting.directive.d.ts +2 -2
- package/dist/declarative-element/directives/awaiting.directive.js +1 -1
- package/dist/declarative-element/directives/directive-helpers.d.ts +1 -1
- package/dist/declarative-element/directives/on-dom-created.directive.d.ts +1 -1
- package/dist/declarative-element/directives/on-resize.directive.d.ts +1 -1
- package/dist/declarative-element/element-events.d.ts +5 -5
- package/dist/declarative-element/element-properties.d.ts +4 -4
- package/dist/declarative-element/host-classes.d.ts +5 -5
- package/dist/declarative-element/host-classes.js +1 -1
- package/dist/declarative-element/render-callback.d.ts +4 -4
- package/dist/declarative-element/render-callback.js +1 -1
- package/dist/declarative-element/styles.d.ts +2 -2
- package/dist/declarative-element/styles.js +1 -1
- package/dist/declarative-element/tag-name.d.ts +1 -1
- package/dist/declarative-element/tag-name.js +1 -1
- package/dist/template-transforms/has-static-tag-name.d.ts +1 -1
- package/dist/template-transforms/nested-mapped-templates.js +1 -1
- package/dist/template-transforms/transform-template.d.ts +3 -3
- package/dist/template-transforms/transform-template.js +1 -1
- package/dist/template-transforms/vir-css/css-transform.d.ts +1 -1
- package/dist/template-transforms/vir-html/html-transform.js +1 -1
- package/dist/typed-event/typed-event.d.ts +2 -2
- package/dist/typed-event/typed-event.js +3 -3
- package/package.json +18 -15
package/dist/augments/type.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSResult } from 'lit';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type CssVarsInitMap<CssVarKeys extends string> = Record<CssVarKeys, string>;
|
|
3
|
+
export type CssVarName<TagName extends string> = `--${TagName}-string`;
|
|
4
|
+
export type CssVarNameOrValueMap<CssVarKeys extends string> = Record<CssVarKeys, CSSResult>;
|
|
5
5
|
export declare function createCssVarNamesMap<TagName extends string, CssVarKeys extends string>(tagName: TagName, cssVarsInit: CssVarsInitMap<CssVarKeys> | undefined): CssVarNameOrValueMap<CssVarKeys>;
|
|
6
6
|
export declare function createCssVarValuesMap<CssVarKeys extends string>(cssVarInitMap: CssVarsInitMap<CssVarKeys> | undefined, cssVarNamesMap: CssVarNameOrValueMap<CssVarKeys>): CssVarNameOrValueMap<CssVarKeys>;
|
|
@@ -6,8 +6,8 @@ import { PropertyInitMapBase } from './element-properties';
|
|
|
6
6
|
import { HostClassesInitMap } from './host-classes';
|
|
7
7
|
import { InitCallback, RenderCallback } from './render-callback';
|
|
8
8
|
import { StylesCallback } from './styles';
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type CustomElementTagName = `${string}-${string}`;
|
|
10
|
+
export type DeclarativeElementInit<InputsGeneric extends PropertyInitMapBase, StateInit extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap, HostClassKeys extends string, CssVarKeys extends string> = {
|
|
11
11
|
/**
|
|
12
12
|
* HTML tag name. This should not be used directly, as interpolating it with the html tagged
|
|
13
13
|
* template from this package is preferred.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequiredAndNotNullBy, RequiredBy } from 'augment-vir';
|
|
1
|
+
import { RequiredAndNotNullBy, RequiredBy } from '@augment-vir/common';
|
|
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,8 @@ 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
|
|
10
|
-
export
|
|
9
|
+
export 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 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
11
|
instanceType: HostInstanceType<InputsGeneric, StateInitGeneric, EventsInitGeneric, HostClassKeys, CssVarKeys>;
|
|
12
12
|
};
|
|
13
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 {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getObjectTypedKeys, kebabCaseToCamelCase } from 'augment-vir';
|
|
1
|
+
import { getObjectTypedKeys, kebabCaseToCamelCase } from '@augment-vir/common';
|
|
2
2
|
import { css } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
import { DeclarativeElementMarkerSymbol } from '../declarative-element-marker-symbol';
|
|
@@ -27,21 +27,6 @@ export function defineElementNoInputs(initInput) {
|
|
|
27
27
|
: initInput.styles || css ``;
|
|
28
28
|
const typedRenderCallback = initInput.renderCallback;
|
|
29
29
|
const anonymousClass = (_a = class extends DeclarativeElement {
|
|
30
|
-
constructor() {
|
|
31
|
-
super();
|
|
32
|
-
this.initCalled = false;
|
|
33
|
-
this.haveInputsBeenSet = false;
|
|
34
|
-
// this is set below in Object.defineProperties
|
|
35
|
-
this.definition = {};
|
|
36
|
-
this.instanceInputs = createElementUpdaterProxy(this, false);
|
|
37
|
-
this.instanceState = createElementUpdaterProxy(this, true);
|
|
38
|
-
const stateInit = initInput.stateInit || {};
|
|
39
|
-
Object.keys(stateInit).forEach((propName) => {
|
|
40
|
-
property()(this, propName);
|
|
41
|
-
this[propName] = stateInit[propName];
|
|
42
|
-
});
|
|
43
|
-
this.definition = anonymousClass;
|
|
44
|
-
}
|
|
45
30
|
createRenderParams() {
|
|
46
31
|
return createRenderParams(this, eventsMap);
|
|
47
32
|
}
|
|
@@ -98,6 +83,21 @@ export function defineElementNoInputs(initInput) {
|
|
|
98
83
|
});
|
|
99
84
|
this.markInputsAsHavingBeenSet();
|
|
100
85
|
}
|
|
86
|
+
constructor() {
|
|
87
|
+
super();
|
|
88
|
+
this.initCalled = false;
|
|
89
|
+
this.haveInputsBeenSet = false;
|
|
90
|
+
// this is set below in Object.defineProperties
|
|
91
|
+
this.definition = {};
|
|
92
|
+
this.instanceInputs = createElementUpdaterProxy(this, false);
|
|
93
|
+
this.instanceState = createElementUpdaterProxy(this, true);
|
|
94
|
+
const stateInit = initInput.stateInit || {};
|
|
95
|
+
Object.keys(stateInit).forEach((propName) => {
|
|
96
|
+
property()(this, propName);
|
|
97
|
+
this[propName] = stateInit[propName];
|
|
98
|
+
});
|
|
99
|
+
this.definition = anonymousClass;
|
|
100
|
+
}
|
|
101
101
|
},
|
|
102
102
|
_a.tagName = initInput.tagName,
|
|
103
103
|
_a.styles = calculatedStyles,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const IgnoreInputsNotBeenSetBeforeRenderWarningSymbol: unique symbol;
|
|
2
|
-
export
|
|
2
|
+
export type DeclarativeElementDefinitionOptions = {
|
|
3
3
|
[IgnoreInputsNotBeenSetBeforeRenderWarningSymbol]: boolean;
|
|
4
4
|
};
|
|
5
5
|
export declare const defaultDeclarativeElementDefinitionOptions: DeclarativeElementDefinitionOptions;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncDirective } from 'lit/async-directive.js';
|
|
2
2
|
import { PartInfo } from 'lit/directive.js';
|
|
3
3
|
import { DeclarativeElementDefinition } from '../declarative-element';
|
|
4
|
-
export
|
|
4
|
+
export type CleanupCallback<T> = (oldValue: T) => void;
|
|
5
5
|
/**
|
|
6
6
|
* Assign values but include a cleanup callback which gets called when a new value gets assigned so
|
|
7
7
|
* the previous value can get cleaned up. An optional equality check callback can be provided. If it
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type MaybePromise<T> = (T extends Promise<infer ValueType> ? T | ValueType : Promise<T> | T) | undefined | {
|
|
2
2
|
error: Error;
|
|
3
3
|
};
|
|
4
|
-
export
|
|
4
|
+
export type CreateStateUpdatingPromiseInputs<InnerValueGeneric, KeyGeneric extends PropertyKey, StateGeneric extends Readonly<Record<KeyGeneric, MaybePromise<InnerValueGeneric>>>> = {
|
|
5
5
|
updateState: (newState: Partial<StateGeneric>) => void;
|
|
6
6
|
stateKey: KeyGeneric;
|
|
7
7
|
} & ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractErrorMessage, isPromiseLike, typedHasProperty } from 'augment-vir';
|
|
1
|
+
import { extractErrorMessage, isPromiseLike, typedHasProperty } from '@augment-vir/common';
|
|
2
2
|
export function createStateUpdatingPromiseIfUndefined(inputs) {
|
|
3
3
|
const { state, stateKey } = inputs;
|
|
4
4
|
const currentValue = state[stateKey];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementPartInfo, PartInfo } from 'lit/directive.js';
|
|
2
2
|
import { DeclarativeElement } from '../declarative-element';
|
|
3
3
|
/** For some reason these aren't defined in lit's types already. */
|
|
4
|
-
export
|
|
4
|
+
export type ExtraPartInfoProperties = {
|
|
5
5
|
element: Element;
|
|
6
6
|
options: {
|
|
7
7
|
host: Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PartInfo } from 'lit/directive.js';
|
|
2
|
-
export
|
|
2
|
+
export type OnDomCreatedCallback = (element: Element) => void;
|
|
3
3
|
/** Only fires once, when the element has been created. */
|
|
4
4
|
export declare const onDomCreated: (callback: OnDomCreatedCallback) => import("lit-html/directive").DirectiveResult<{
|
|
5
5
|
new (partInfo: PartInfo): {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PartInfo } from 'lit/directive.js';
|
|
2
|
-
export
|
|
2
|
+
export type OnResizeCallback = (
|
|
3
3
|
/** Only these two properties are supported in all major modern browsers */
|
|
4
4
|
entry: Readonly<Pick<ResizeObserverEntry, 'target' | 'contentRect'>>) => void;
|
|
5
5
|
export declare const onResize: (callback: OnResizeCallback) => import("lit-html/directive").DirectiveResult<{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DefinedTypedEvent, DefinedTypedEventNameDefinition, TypedEvent } from '../typed-event/typed-event';
|
|
2
|
-
export
|
|
2
|
+
export type EventsInitMap = Record<string, DefinedTypedEventNameDefinition<any>>;
|
|
3
3
|
export declare function defineElementEvent<EventDetailGeneric>(): DefinedTypedEventNameDefinition<EventDetailGeneric>;
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export type EventInitMapEventDetailExtractor<EventTypeNameGeneric extends keyof EventsInitGeneric, EventsInitGeneric extends EventsInitMap> = EventsInitGeneric[EventTypeNameGeneric] extends DefinedTypedEventNameDefinition<infer R> ? R : never;
|
|
5
|
+
export type EventDescriptorMap<EventsInitGeneric extends EventsInitMap> = {
|
|
6
6
|
[CurrentEventTypeName in keyof EventsInitGeneric]: DefinedTypedEvent<CurrentEventTypeName extends string ? CurrentEventTypeName : never, EventInitMapEventDetailExtractor<CurrentEventTypeName, EventsInitGeneric>>;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type EventObjectEventDetailExtractor<EventObjectGeneric extends DefinedTypedEvent<any, any>> = EventObjectGeneric extends DefinedTypedEvent<string, infer R> ? R : never;
|
|
9
|
+
export type ElementEventDetailExtractor<ElementEventGeneric extends TypedEvent<any, any>> = ElementEventGeneric extends TypedEvent<string, infer R> ? R : never;
|
|
10
10
|
export declare function createEventDescriptorMap<EventsInitGeneric extends EventsInitMap>(eventsInit: EventsInitGeneric | undefined): EventDescriptorMap<EventsInitGeneric>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { DeclarativeElement } from './declarative-element';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type PropertyInitMapBase = Record<PropertyKey, unknown>;
|
|
3
|
+
export type ElementProperty<KeyGeneric extends string | number | symbol, ValueGeneric> = {
|
|
4
4
|
name: KeyGeneric;
|
|
5
5
|
setProp(value: ValueGeneric): void;
|
|
6
6
|
getProp(): ValueGeneric;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type StaticElementPropertyDescriptor<PropName extends string, PropValue> = {
|
|
9
9
|
propName: PropName;
|
|
10
10
|
initValue: PropValue;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
12
|
+
export type ElementPropertyDescriptorMap<PropertyInitGeneric extends PropertyInitMapBase> = {
|
|
13
13
|
[Property in keyof PropertyInitGeneric]: StaticElementPropertyDescriptor<string, PropertyInitGeneric[Property]>;
|
|
14
14
|
};
|
|
15
15
|
export declare function createElementUpdaterProxy<PropertyInitGeneric extends PropertyInitMapBase>(element: DeclarativeElement, verifyExists: boolean): PropertyInitGeneric;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { PropertyInitMapBase } from './element-properties';
|
|
2
2
|
import { WithTagName } from './tag-name';
|
|
3
|
-
export
|
|
3
|
+
export type HostClassToggleCallbackInput<InputsGeneric extends PropertyInitMapBase, StateGeneric extends PropertyInitMapBase> = {
|
|
4
4
|
state: Readonly<StateGeneric>;
|
|
5
5
|
inputs: Readonly<InputsGeneric>;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type HostClassToggleCallback<InputsGeneric extends PropertyInitMapBase, StateGeneric extends PropertyInitMapBase> = (inputs: HostClassToggleCallbackInput<InputsGeneric, StateGeneric>) => boolean;
|
|
8
|
+
export type HostClassesInitMap<HostClassKeys extends string, InputsGeneric extends PropertyInitMapBase, StateGeneric extends PropertyInitMapBase> = Record<HostClassKeys,
|
|
9
9
|
/**
|
|
10
10
|
* Callback to determine when host class should be enabled (based on current inputs and state),
|
|
11
11
|
* or just undefined to mark that this host class name will only be manually applied.
|
|
12
12
|
*/
|
|
13
13
|
HostClassToggleCallback<InputsGeneric, StateGeneric> | false>;
|
|
14
|
-
export
|
|
15
|
-
export
|
|
14
|
+
export type HostClassName<TagName extends string, HostClassPropName extends string> = `${TagName}-${HostClassPropName}`;
|
|
15
|
+
export type HostClassNamesMap<TagName extends string, HostClassKeys extends string> = Record<HostClassKeys, WithTagName<TagName, string>>;
|
|
16
16
|
export declare function createHostClassNamesMap<TagName extends string, HostClassKeys extends string, HostClassesInitGeneric extends HostClassesInitMap<HostClassKeys,
|
|
17
17
|
/**
|
|
18
18
|
* We can use any here because we don't care what the state or input names are, we just care
|
|
@@ -3,10 +3,10 @@ import { TypedEvent } from '../typed-event/typed-event';
|
|
|
3
3
|
import { DeclarativeElement, HostInstanceType } from './declarative-element';
|
|
4
4
|
import { EventDescriptorMap, EventInitMapEventDetailExtractor, EventsInitMap } from './element-events';
|
|
5
5
|
import { PropertyInitMapBase } from './element-properties';
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
6
|
+
export 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;
|
|
7
|
+
export 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;
|
|
8
|
+
export type UpdateStateCallback<StateGeneric extends PropertyInitMapBase> = (newState: Partial<StateGeneric>) => void;
|
|
9
|
+
export type RenderParams<InputsGeneric extends PropertyInitMapBase, StateInitGeneric extends PropertyInitMapBase, EventsInitGeneric extends EventsInitMap, HostClassKeys extends string, CssVarKeys extends string> = {
|
|
10
10
|
state: Readonly<StateInitGeneric>;
|
|
11
11
|
updateState: UpdateStateCallback<StateInitGeneric>;
|
|
12
12
|
events: EventDescriptorMap<EventsInitGeneric>;
|
|
@@ -2,13 +2,13 @@ import { CSSResult } from 'lit';
|
|
|
2
2
|
import { CssVarNameOrValueMap } from './css-vars';
|
|
3
3
|
import { PropertyInitMapBase } from './element-properties';
|
|
4
4
|
import { HostClassesInitMap, HostClassNamesMap } from './host-classes';
|
|
5
|
-
export
|
|
5
|
+
export type StylesCallbackInput<HostClassKeys extends string, CssVarKeys extends string> = {
|
|
6
6
|
hostClassSelectors: Record<HostClassKeys, CSSResult>;
|
|
7
7
|
hostClassNames: Record<HostClassKeys, CSSResult>;
|
|
8
8
|
cssVarNames: Record<CssVarKeys, CSSResult>;
|
|
9
9
|
cssVarValues: Record<CssVarKeys, CSSResult>;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type StylesCallback<HostClassKeys extends string, CssVarKeys extends string> = (input: StylesCallbackInput<HostClassKeys, CssVarKeys>) => CSSResult;
|
|
12
12
|
export declare function hostClassNamesToStylesInput<HostClassKeys extends string, CssVarKeys extends string>({ hostClassNames, cssVarNames, cssVarValues, }: {
|
|
13
13
|
hostClassNames: HostClassNamesMap<string, HostClassKeys>;
|
|
14
14
|
cssVarNames: CssVarNameOrValueMap<CssVarKeys>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getObjectTypedKeys, mapObjectValues } from 'augment-vir';
|
|
1
|
+
import { getObjectTypedKeys, mapObjectValues } from '@augment-vir/common';
|
|
2
2
|
import { unsafeCSS } from 'lit';
|
|
3
3
|
export function hostClassNamesToStylesInput({ hostClassNames, cssVarNames, cssVarValues, }) {
|
|
4
4
|
return {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type WithTagName<TagName extends string, Suffix extends string> = `${TagName}-${Suffix}`;
|
|
2
2
|
export declare function toHtmlSafeWithTagName<TagName extends string>(tagName: TagName, forHtmlSafe: string): WithTagName<TagName, string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { typedHasProperties } from 'augment-vir';
|
|
1
|
+
import { typedHasProperties } from '@augment-vir/common';
|
|
2
2
|
import { DeclarativeElementMarkerSymbol } from '../declarative-element-marker-symbol';
|
|
3
3
|
function extractElementKeys(values) {
|
|
4
4
|
return values.filter((value) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type TemplateTransform = {
|
|
2
2
|
templateStrings: TemplateStringsArray;
|
|
3
3
|
valueIndexDeletions: number[];
|
|
4
4
|
};
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type ValueTransform = (value: unknown) => unknown;
|
|
6
|
+
export type CheckAndTransform<T> = {
|
|
7
7
|
check: (lastNewString: string, currentLitString: string, currentValue: unknown) => currentValue is T;
|
|
8
8
|
transform: (value: T) => unknown;
|
|
9
9
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { typedHasProperties } from 'augment-vir';
|
|
1
|
+
import { typedHasProperties } from '@augment-vir/common';
|
|
2
2
|
import { filterOutArrayIndexes } from '../augments/array';
|
|
3
3
|
import { DeclarativeElementMarkerSymbol } from '../declarative-element-marker-symbol';
|
|
4
4
|
import { getAlreadyMappedTemplate, setMappedTemplate } from './nested-mapped-templates';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSResultGroup } from 'lit';
|
|
2
2
|
import { DeclarativeElementDefinition } from '../../declarative-element/declarative-element';
|
|
3
|
-
export
|
|
3
|
+
export type CssTemplateTransform = {
|
|
4
4
|
templateStrings: TemplateStringsArray;
|
|
5
5
|
valueIndexDeletions: number[];
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { collapseWhiteSpace, safeMatch } from 'augment-vir';
|
|
1
|
+
import { collapseWhiteSpace, safeMatch } from '@augment-vir/common';
|
|
2
2
|
import { declarativeElementRequired } from '../../require-declarative-element';
|
|
3
3
|
import { hasStaticTagName } from '../has-static-tag-name';
|
|
4
4
|
import { makeCheckTransform, transformTemplate, } from '../transform-template';
|
|
@@ -6,8 +6,8 @@ export declare class TypedEvent<EventTypeNameGeneric extends string = '', EventD
|
|
|
6
6
|
type: EventTypeNameGeneric;
|
|
7
7
|
}, value: EventDetailGeneric);
|
|
8
8
|
}
|
|
9
|
-
export
|
|
10
|
-
export
|
|
9
|
+
export type DefinedTypedEventNameDefinition<EventDetailGeneric> = <EventTypeNameGeneric extends string>(eventType: NonEmptyString<EventTypeNameGeneric>) => DefinedTypedEvent<EventTypeNameGeneric, EventDetailGeneric>;
|
|
10
|
+
export type DefinedTypedEvent<EventTypeNameGeneric extends string, EventDetailGeneric> = (new (eventValue: EventDetailGeneric) => TypedEvent<EventTypeNameGeneric, EventDetailGeneric>) & {
|
|
11
11
|
type: EventTypeNameGeneric;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export class TypedEvent extends CustomEvent {
|
|
2
|
+
get type() {
|
|
3
|
+
return this._type;
|
|
4
|
+
}
|
|
2
5
|
constructor(type, value) {
|
|
3
6
|
super(typeof type === 'string' ? type : type.type, {
|
|
4
7
|
detail: value,
|
|
@@ -7,9 +10,6 @@ export class TypedEvent extends CustomEvent {
|
|
|
7
10
|
});
|
|
8
11
|
this._type = '';
|
|
9
12
|
}
|
|
10
|
-
get type() {
|
|
11
|
-
return this._type;
|
|
12
|
-
}
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Defined a typed event. Make sure to use currying and call this function twice! Typescript's
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "element-vir",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"custom",
|
|
6
6
|
"web",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"format": "virmator format",
|
|
32
32
|
"prepublishOnly": "npm run compile && npm run test:all",
|
|
33
33
|
"preview": "virmator frontend preview",
|
|
34
|
+
"publish": "npm run compile && npm run test:all && virmator publish",
|
|
34
35
|
"spellcheck": "virmator spellcheck",
|
|
35
36
|
"start": "npm install && virmator frontend",
|
|
36
37
|
"test": "npm run test:types && virmator test-web",
|
|
@@ -41,35 +42,37 @@
|
|
|
41
42
|
"test:web": "virmator test-web"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"augment-vir": "^
|
|
45
|
+
"@augment-vir/browser": "^6.1.5",
|
|
46
|
+
"@augment-vir/common": "^6.1.5",
|
|
45
47
|
"lit": "2.4.1"
|
|
46
48
|
},
|
|
47
49
|
"devDependencies": {
|
|
50
|
+
"@augment-vir/browser-testing": "^6.1.5",
|
|
48
51
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
49
|
-
"@open-wc/testing": "^3.1.
|
|
50
|
-
"@types/chai": "^4.3.
|
|
51
|
-
"@types/mocha": "^10.0.
|
|
52
|
+
"@open-wc/testing": "^3.1.7",
|
|
53
|
+
"@types/chai": "^4.3.4",
|
|
54
|
+
"@types/mocha": "^10.0.1",
|
|
52
55
|
"@web/dev-server-esbuild": "^0.3.3",
|
|
53
56
|
"@web/test-runner": "^0.15.0",
|
|
54
57
|
"@web/test-runner-commands": "^0.6.5",
|
|
55
58
|
"@web/test-runner-playwright": "^0.9.0",
|
|
56
59
|
"ansi-colors": "^4.1.3",
|
|
57
|
-
"chai": "^4.3.
|
|
58
|
-
"cspell": "^6.
|
|
59
|
-
"istanbul-smart-text-reporter": "^
|
|
60
|
-
"markdown-code-example-inserter": "^0.1.
|
|
60
|
+
"chai": "^4.3.7",
|
|
61
|
+
"cspell": "^6.17.0",
|
|
62
|
+
"istanbul-smart-text-reporter": "^1.0.1",
|
|
63
|
+
"markdown-code-example-inserter": "^0.1.12",
|
|
61
64
|
"mocha": "^10.1.0",
|
|
62
|
-
"mocha-spec-reporter-with-file-names": "^0.0.
|
|
65
|
+
"mocha-spec-reporter-with-file-names": "^0.0.2",
|
|
63
66
|
"nyc": "^15.1.0",
|
|
64
|
-
"prettier": "^2.
|
|
67
|
+
"prettier": "^2.8.1",
|
|
65
68
|
"prettier-plugin-jsdoc": "^0.4.2",
|
|
66
|
-
"prettier-plugin-multiline-arrays": "^1.1.
|
|
67
|
-
"prettier-plugin-organize-imports": "^3.
|
|
69
|
+
"prettier-plugin-multiline-arrays": "^1.1.2",
|
|
70
|
+
"prettier-plugin-organize-imports": "^3.2.1",
|
|
68
71
|
"prettier-plugin-packagejson": "^2.3.0",
|
|
69
72
|
"prettier-plugin-sort-json": "^0.0.3",
|
|
70
73
|
"prettier-plugin-toml": "^0.3.1",
|
|
71
74
|
"ts-node": "^10.9.1",
|
|
72
|
-
"virmator": "^
|
|
73
|
-
"vite": "^3.2.
|
|
75
|
+
"virmator": "^5.0.3",
|
|
76
|
+
"vite": "^3.2.5"
|
|
74
77
|
}
|
|
75
78
|
}
|