element-vir 26.10.0 → 26.11.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.
Files changed (40) hide show
  1. package/dist/declarative-element/declarative-element-init.d.ts +7 -6
  2. package/dist/declarative-element/declarative-element.d.ts +26 -25
  3. package/dist/declarative-element/declarative-element.js +1 -0
  4. package/dist/declarative-element/define-element.d.ts +2 -2
  5. package/dist/declarative-element/define-element.js +13 -6
  6. package/dist/declarative-element/is-declarative-element-definition.js +1 -0
  7. package/dist/declarative-element/properties/css-vars.d.ts +3 -3
  8. package/dist/declarative-element/properties/host-classes.d.ts +3 -3
  9. package/dist/declarative-element/properties/string-names.d.ts +28 -0
  10. package/dist/declarative-element/properties/string-names.js +40 -0
  11. package/dist/declarative-element/properties/styles.d.ts +5 -5
  12. package/dist/declarative-element/render-callback.d.ts +12 -11
  13. package/dist/declarative-element/render-callback.js +2 -1
  14. package/dist/declarative-element/wrap-define-element.d.ts +4 -4
  15. package/dist/index.d.ts +1 -2
  16. package/dist/index.js +1 -2
  17. package/dist/readme-examples/my-app.element.d.ts +1 -1
  18. package/dist/readme-examples/my-custom-define.d.ts +3 -3
  19. package/dist/readme-examples/my-simple.element.d.ts +1 -1
  20. package/dist/readme-examples/my-with-assignment.element.d.ts +1 -1
  21. package/dist/readme-examples/my-with-async-prop.element.d.ts +1 -1
  22. package/dist/readme-examples/my-with-cleanup-callback.element.d.ts +1 -1
  23. package/dist/readme-examples/my-with-css-vars.element.d.ts +1 -1
  24. package/dist/readme-examples/my-with-custom-events.element.d.ts +1 -1
  25. package/dist/readme-examples/my-with-event-listening.element.d.ts +1 -1
  26. package/dist/readme-examples/my-with-events.element.d.ts +1 -1
  27. package/dist/readme-examples/my-with-host-class-definition.element.d.ts +1 -1
  28. package/dist/readme-examples/my-with-host-class-usage.element.d.ts +1 -1
  29. package/dist/readme-examples/my-with-inputs.element.d.ts +1 -1
  30. package/dist/readme-examples/my-with-on-dom-created.element.d.ts +1 -1
  31. package/dist/readme-examples/my-with-on-resize.element.d.ts +1 -1
  32. package/dist/readme-examples/my-with-render-if.element.d.ts +1 -1
  33. package/dist/readme-examples/my-with-styles-and-interpolated-selector.element.d.ts +1 -1
  34. package/dist/readme-examples/my-with-styles.element.d.ts +1 -1
  35. package/dist/readme-examples/my-with-update-state.element.d.ts +1 -1
  36. package/package.json +12 -12
  37. package/dist/declarative-element/properties/css-properties.d.ts +0 -13
  38. package/dist/declarative-element/properties/css-properties.js +0 -16
  39. package/dist/declarative-element/slot-names.d.ts +0 -15
  40. package/dist/declarative-element/slot-names.js +0 -15
@@ -1,11 +1,11 @@
1
1
  import { type CSSResult } from '../lit-exports/base-lit-exports.js';
2
2
  import { type CustomElementTagName } from './custom-tag-name.js';
3
3
  import { type DeclarativeElementDefinitionOptions } from './definition-options.js';
4
- import { type BaseCssPropertyName } from './properties/css-properties.js';
5
4
  import { type CssVarsInitMap } from './properties/css-vars.js';
6
5
  import { type EventsInitMap } from './properties/element-events.js';
7
6
  import { type PropertyInitMapBase } from './properties/element-properties.js';
8
7
  import { type HostClassesInitMap } from './properties/host-classes.js';
8
+ import { type BaseStringName } from './properties/string-names.js';
9
9
  import { type StylesCallback } from './properties/styles.js';
10
10
  import { type InitCallback, type RenderCallback, type RenderParams } from './render-callback.js';
11
11
  /**
@@ -14,7 +14,7 @@ import { type InitCallback, type RenderCallback, type RenderParams } from './ren
14
14
  *
15
15
  * @category Internal
16
16
  */
17
- export type DeclarativeElementInit<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = {
17
+ export type DeclarativeElementInit<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseStringName<TagName>, CssVarKeys extends BaseStringName<TagName>, SlotNames extends ReadonlyArray<string>, TestIds extends ReadonlyArray<string>> = {
18
18
  /**
19
19
  * HTML tag name. This should not be used directly, as interpolating it with the html tagged
20
20
  * template from this package is preferred.
@@ -25,6 +25,7 @@ export type DeclarativeElementInit<TagName extends CustomElementTagName, Inputs
25
25
  /** Events that the element can dispatch. (These can be thought of as "outputs".) */
26
26
  events?: EventsInit | undefined;
27
27
  slotNames?: SlotNames | undefined;
28
+ testIds?: TestIds | undefined;
28
29
  /**
29
30
  * HTML host classes. Values can be callbacks to determine when a host class should be defined,
30
31
  * based on current instance state or inputs, or just false to indicate that the host class will
@@ -46,10 +47,10 @@ export type DeclarativeElementInit<TagName extends CustomElementTagName, Inputs
46
47
  * Setup the element's initial state. This is only called once per element instance, before the
47
48
  * first render. The return type of this method becomes the element's state type.
48
49
  */
49
- state?: (params: Omit<RenderParams<TagName, Inputs, any, EventsInit, HostClassKeys, CssVarKeys, SlotNames>, 'state' | 'updateState'>) => Extract<keyof State, keyof HTMLElement> extends never ? Extract<keyof State, keyof Inputs> extends never ? State : `ERROR: Cannot define an element state property that clashes with input properties: ${Extract<keyof State, keyof Inputs> extends string | number | bigint | boolean | null | undefined ? Extract<keyof State, keyof Inputs> : ''}` : `ERROR: Cannot define an element state property that clashes with native HTMLElement properties: ${Extract<keyof State, keyof HTMLElement>}`;
50
+ state?: (params: Omit<RenderParams<TagName, Inputs, any, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>, 'state' | 'updateState'>) => Extract<keyof State, keyof HTMLElement> extends never ? Extract<keyof State, keyof Inputs> extends never ? State : `ERROR: Cannot define an element state property that clashes with input properties: ${Extract<keyof State, keyof Inputs> extends string | number | bigint | boolean | null | undefined ? Extract<keyof State, keyof Inputs> : ''}` : `ERROR: Cannot define an element state property that clashes with native HTMLElement properties: ${Extract<keyof State, keyof HTMLElement>}`;
50
51
  /** Called as part of the first render call, before the first render call. */
51
- init?: InitCallback<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames> | undefined;
52
- render: RenderCallback<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
53
- cleanup?: InitCallback<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames> | undefined;
52
+ init?: InitCallback<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds> | undefined;
53
+ render: RenderCallback<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
54
+ cleanup?: InitCallback<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds> | undefined;
54
55
  options?: Partial<DeclarativeElementDefinitionOptions> | undefined;
55
56
  };
@@ -5,35 +5,34 @@ import { type MinimalDefinitionWithInputs } from '../template-transforms/minimal
5
5
  import { type CustomElementTagName } from './custom-tag-name.js';
6
6
  import { type DeclarativeElementInit } from './declarative-element-init.js';
7
7
  import { type DeclarativeElementDefinitionOptions } from './definition-options.js';
8
- import { type BaseCssPropertyName } from './properties/css-properties.js';
9
8
  import { type CssVars } from './properties/css-vars.js';
10
9
  import { type EventDescriptorMap, type EventsInitMap } from './properties/element-events.js';
11
10
  import { type PropertyInitMapBase } from './properties/element-properties.js';
12
11
  import { type HostClassNamesMap } from './properties/host-classes.js';
13
12
  import { type ObservableListenerMap } from './properties/property-proxy.js';
13
+ import { type BaseStringName, type StringNameMap } from './properties/string-names.js';
14
14
  import { type RenderCallback, type RenderParams, type UpdateStateCallback } from './render-callback.js';
15
- import { type SlotNameMap } from './slot-names.js';
16
15
  /**
17
16
  * The `host` type for a declarative element. This references a declarative element instance's
18
17
  * top-level HTML element and always contains a shadow root (wherein the element is rendered).
19
18
  *
20
19
  * @category Internal
21
20
  */
22
- export type DeclarativeElementHost<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, State extends PropertyInitMapBase = any, EventsInit extends EventsInitMap = any, HostClassKeys extends BaseCssPropertyName<TagName> = any, CssVarKeys extends BaseCssPropertyName<TagName> = any, SlotNames extends ReadonlyArray<string> = any> = SetRequiredAndNotNull<Omit<DeclarativeElement<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>, Exclude<keyof StaticDeclarativeElementProperties<any, any, any, any, any, any, any>, keyof HTMLElement>>, 'shadowRoot'>;
21
+ export type DeclarativeElementHost<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, State extends PropertyInitMapBase = any, EventsInit extends EventsInitMap = any, HostClassKeys extends BaseStringName<TagName> = any, CssVarKeys extends BaseStringName<TagName> = any, SlotNames extends ReadonlyArray<string> = any, TestIds extends ReadonlyArray<string> = any> = SetRequiredAndNotNull<Omit<DeclarativeElement<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>, Exclude<keyof StaticDeclarativeElementProperties<any, any, any, any, any, any, any, any>, keyof HTMLElement>>, 'shadowRoot'>;
23
22
  /**
24
23
  * The full definition for a declarative element.
25
24
  *
26
25
  * @category Internal
27
26
  */
28
- export type DeclarativeElementDefinition<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, State extends PropertyInitMapBase = any, EventsInit extends EventsInitMap = any, HostClassKeys extends BaseCssPropertyName<TagName> = any, CssVarKeys extends BaseCssPropertyName<TagName> = any, SlotNames extends ReadonlyArray<string> = any> = (new () => DeclarativeElementHost<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) & StaticDeclarativeElementProperties<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames> & {
29
- InstanceType: DeclarativeElementHost<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
27
+ export type DeclarativeElementDefinition<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, State extends PropertyInitMapBase = any, EventsInit extends EventsInitMap = any, HostClassKeys extends BaseStringName<TagName> = any, CssVarKeys extends BaseStringName<TagName> = any, SlotNames extends ReadonlyArray<string> = any, TestIds extends ReadonlyArray<string> = any> = (new () => DeclarativeElementHost<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) & StaticDeclarativeElementProperties<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds> & {
28
+ InstanceType: DeclarativeElementHost<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
30
29
  };
31
30
  /**
32
31
  * Abstract class base for all declarative elements.
33
32
  *
34
33
  * @category Internal
35
34
  */
36
- export declare abstract class DeclarativeElement<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, State extends PropertyInitMapBase = any, EventsInit extends EventsInitMap = any, HostClassKeys extends BaseCssPropertyName<TagName> = any, CssVarKeys extends BaseCssPropertyName<TagName> = any, SlotNames extends ReadonlyArray<string> = any> extends LitElement {
35
+ export declare abstract class DeclarativeElement<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, State extends PropertyInitMapBase = any, EventsInit extends EventsInitMap = any, HostClassKeys extends BaseStringName<TagName> = any, CssVarKeys extends BaseStringName<TagName> = any, SlotNames extends ReadonlyArray<string> = any, TestIds extends ReadonlyArray<string> = any> extends LitElement {
37
36
  /**
38
37
  * Assign inputs to an element instantiation. Use only on the opening tag.
39
38
  *
@@ -47,23 +46,24 @@ export declare abstract class DeclarativeElement<TagName extends CustomElementTa
47
46
  * `;
48
47
  * ```
49
48
  */
50
- static readonly assign: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['assign'];
49
+ static readonly assign: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['assign'];
51
50
  static readonly assignedInputs: PropertyInitMapBase | undefined;
52
- static readonly tagName: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['tagName'];
53
- static readonly styles: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['styles'];
54
- static readonly render: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['render'];
55
- static readonly InputsType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['InputsType'];
56
- static readonly StateType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['StateType'];
57
- static readonly UpdateStateType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['UpdateStateType'];
58
- static readonly events: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['events'];
59
- static readonly init: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['init'];
60
- static readonly elementOptions: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['elementOptions'];
61
- static readonly hostClasses: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['hostClasses'];
62
- static readonly cssVars: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['cssVars'];
63
- static readonly slotNames: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['slotNames'];
51
+ static readonly tagName: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['tagName'];
52
+ static readonly styles: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['styles'];
53
+ static readonly render: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['render'];
54
+ static readonly InputsType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['InputsType'];
55
+ static readonly StateType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['StateType'];
56
+ static readonly UpdateStateType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['UpdateStateType'];
57
+ static readonly events: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['events'];
58
+ static readonly init: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['init'];
59
+ static readonly elementOptions: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['elementOptions'];
60
+ static readonly hostClasses: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['hostClasses'];
61
+ static readonly cssVars: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['cssVars'];
62
+ static readonly slotNames: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['slotNames'];
63
+ static readonly testIds: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseStringName<CustomElementTagName>, BaseStringName<CustomElementTagName>, ReadonlyArray<string>, ReadonlyArray<string>>['testIds'];
64
64
  abstract _lastRenderError: Error | undefined;
65
65
  abstract _internalRenderCount: number;
66
- abstract _lastRenderedProps: Readonly<Pick<RenderParams<any, Inputs, State, any, any, any, any>, 'inputs' | 'state'>>;
66
+ abstract _lastRenderedProps: Readonly<Pick<RenderParams<any, Inputs, State, any, any, any, any, any>, 'inputs' | 'state'>>;
67
67
  /**
68
68
  * Calls all destroy methods on all state properties, if they exist. This is automatically
69
69
  * called whenever the element is detached.
@@ -80,7 +80,7 @@ export declare abstract class DeclarativeElement<TagName extends CustomElementTa
80
80
  */
81
81
  abstract assignInputs(inputs: EmptyObject extends Required<Inputs> ? never : Partial<Inputs>): void;
82
82
  /** The element definition for this element instance. */
83
- abstract readonly definition: DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
83
+ abstract readonly definition: DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
84
84
  }
85
85
  /**
86
86
  * The assign inputs method of a declarative element.
@@ -93,15 +93,16 @@ export type AssignMethod<TagName extends CustomElementTagName, Inputs extends Pr
93
93
  *
94
94
  * @category Internal
95
95
  */
96
- export type StaticDeclarativeElementProperties<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = {
96
+ export type StaticDeclarativeElementProperties<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseStringName<TagName>, CssVarKeys extends BaseStringName<TagName>, SlotNames extends ReadonlyArray<string>, TestIds extends ReadonlyArray<string>> = {
97
97
  /** Assign inputs to an element directly on its interpolated tag. */
98
98
  readonly assign: AssignMethod<TagName, Inputs>;
99
99
  assignedInputs: Inputs | undefined;
100
100
  /** Pass through the render callback for direct unit testability */
101
- readonly render: RenderCallback<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
101
+ readonly render: RenderCallback<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
102
102
  readonly events: EventDescriptorMap<TagName, EventsInit>;
103
- readonly slotNames: SlotNameMap<SlotNames>;
104
- readonly init: DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
103
+ readonly slotNames: Readonly<StringNameMap<TagName, 'slot', SlotNames>>;
104
+ readonly testIds: Readonly<StringNameMap<TagName, 'test-id', TestIds>>;
105
+ readonly init: DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
105
106
  readonly elementOptions: DeclarativeElementDefinitionOptions;
106
107
  readonly InputsType: Inputs;
107
108
  readonly StateType: Readonly<State>;
@@ -32,4 +32,5 @@ export class DeclarativeElement extends LitElement {
32
32
  static hostClasses;
33
33
  static cssVars;
34
34
  static slotNames;
35
+ static testIds;
35
36
  }
@@ -1,9 +1,9 @@
1
1
  import { type CustomElementTagName } from './custom-tag-name.js';
2
2
  import { type DeclarativeElementInit } from './declarative-element-init.js';
3
3
  import { type DeclarativeElementDefinition } from './declarative-element.js';
4
- import { type BaseCssPropertyName } from './properties/css-properties.js';
5
4
  import { type EventsInitMap } from './properties/element-events.js';
6
5
  import { type PropertyInitMapBase } from './properties/element-properties.js';
6
+ import { type BaseStringName } from './properties/string-names.js';
7
7
  /**
8
8
  * Verifies that the given `Inputs` type does not clash with built-in HTMLElement properties. This
9
9
  * is used within {@link defineElement}.
@@ -38,4 +38,4 @@ export declare function defineElement<Inputs extends PropertyInitMapBase = {}>(
38
38
  * These `errorParams` is present when there are problems with the `Inputs` type. If it is
39
39
  * present, the error should be fixed. This should always be empty.
40
40
  */
41
- ...errorParams: DeclarativeElementInputErrorParams<Inputs>): <const TagName extends CustomElementTagName, State extends PropertyInitMapBase = {}, EventsInit extends EventsInitMap = {}, const HostClassKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>>(initInput: DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
41
+ ...errorParams: DeclarativeElementInputErrorParams<Inputs>): <const TagName extends CustomElementTagName, State extends PropertyInitMapBase = {}, EventsInit extends EventsInitMap = {}, const HostClassKeys extends BaseStringName<TagName> = `${TagName}-`, const CssVarKeys extends BaseStringName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>, const TestIds extends ReadonlyArray<string> = Readonly<[]>>(initInput: DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) => DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
@@ -6,13 +6,12 @@ import { css } from '../template-transforms/vir-css/vir-css.js';
6
6
  import { DeclarativeElement, } from './declarative-element.js';
7
7
  import { defaultDeclarativeElementDefinitionOptions, } from './definition-options.js';
8
8
  import { assignInputs } from './properties/assign-inputs.js';
9
- import { assertValidCssProperties } from './properties/css-properties.js';
10
9
  import { createEventDescriptorMap, } from './properties/element-events.js';
11
10
  import { createHostClassNamesMap } from './properties/host-classes.js';
12
11
  import { bindReactiveProperty, createElementPropertyProxy } from './properties/property-proxy.js';
12
+ import { assertValidStringNames, createStringNameMap, } from './properties/string-names.js';
13
13
  import { applyHostClasses, createStylesCallbackInput } from './properties/styles.js';
14
14
  import { createRenderParams } from './render-callback.js';
15
- import { createSlotNamesMap } from './slot-names.js';
16
15
  /**
17
16
  * Defines an element with inputs. Note that this function must be called twice, due to TypeScript
18
17
  * type inference limitations.
@@ -71,10 +70,10 @@ function internalDefineElement(init) {
71
70
  const eventsMap = createEventDescriptorMap(init.tagName, init.events);
72
71
  const hostClassNames = createHostClassNamesMap(init.hostClasses);
73
72
  if (init.hostClasses) {
74
- assertValidCssProperties(init.tagName, init.hostClasses);
73
+ assertValidStringNames(init.tagName, init.hostClasses);
75
74
  }
76
75
  if (init.cssVars) {
77
- assertValidCssProperties(init.tagName, init.cssVars);
76
+ assertValidStringNames(init.tagName, init.cssVars);
78
77
  }
79
78
  /**
80
79
  * As casts here are to prevent defineCssVars from complaining that our CSS var names are too
@@ -83,7 +82,8 @@ function internalDefineElement(init) {
83
82
  * specific types externally.)
84
83
  */
85
84
  const cssVars = (init.cssVars ? defineCssVars(init.cssVars) : {});
86
- const slotNamesMap = createSlotNamesMap(init.slotNames);
85
+ const slotNamesMap = createStringNameMap(init.tagName, 'slot', init.slotNames);
86
+ const testIdsMap = createStringNameMap(init.tagName, 'test-id', init.testIds);
87
87
  const calculatedStyles = typeof init.styles === 'function'
88
88
  ? init.styles(createStylesCallbackInput({ hostClassNames, cssVars }))
89
89
  : init.styles || css ``;
@@ -103,7 +103,13 @@ function internalDefineElement(init) {
103
103
  _lastRenderError = undefined;
104
104
  _internalRenderCount = 0;
105
105
  createRenderParams() {
106
- return createRenderParams({ element: this, eventsMap, cssVars, slotNamesMap });
106
+ return createRenderParams({
107
+ element: this,
108
+ eventsMap,
109
+ cssVars,
110
+ slotNamesMap,
111
+ testIdsMap,
112
+ });
107
113
  }
108
114
  static assign = typedAssignCallback;
109
115
  static events = eventsMap;
@@ -112,6 +118,7 @@ function internalDefineElement(init) {
112
118
  static cssVars = cssVars;
113
119
  static init = init;
114
120
  static slotNames = slotNamesMap;
121
+ static testIds = testIdsMap;
115
122
  get InstanceType() {
116
123
  throw new Error(`'InstanceType' was called on ${init.tagName} as a value but it is only a type.`);
117
124
  }
@@ -11,6 +11,7 @@ const expectedStaticProperties = getObjectTypedKeys({
11
11
  InputsType: '',
12
12
  render: '',
13
13
  slotNames: '',
14
+ testIds: '',
14
15
  StateType: '',
15
16
  styles: '',
16
17
  tagName: '',
@@ -1,16 +1,16 @@
1
1
  import { type Values } from '@augment-vir/common';
2
2
  import { type CssVarDefinitions, type CssVarsSetup } from 'lit-css-vars';
3
3
  import { type CustomElementTagName } from '../custom-tag-name.js';
4
- import { type BaseCssPropertyName } from './css-properties.js';
4
+ import { type BaseStringName } from './string-names.js';
5
5
  /**
6
6
  * Base type for a declarative element definition's CSS vars.
7
7
  *
8
8
  * @category Internal
9
9
  */
10
- export type CssVarsInitMap<ElementTagName extends CustomElementTagName, CssVarKeys extends BaseCssPropertyName<ElementTagName>> = Readonly<Record<CssVarKeys, Values<CssVarsSetup>>>;
10
+ export type CssVarsInitMap<ElementTagName extends CustomElementTagName, CssVarKeys extends BaseStringName<ElementTagName>> = Readonly<Record<CssVarKeys, Values<CssVarsSetup>>>;
11
11
  /**
12
12
  * CSS vars ready for use within a declarative element's `render` or `styles` method.
13
13
  *
14
14
  * @category Internal
15
15
  */
16
- export type CssVars<ElementTagName extends CustomElementTagName, CssVarKeys extends BaseCssPropertyName<ElementTagName>> = CssVarDefinitions<CssVarsInitMap<ElementTagName, CssVarKeys>>;
16
+ export type CssVars<ElementTagName extends CustomElementTagName, CssVarKeys extends BaseStringName<ElementTagName>> = CssVarDefinitions<CssVarsInitMap<ElementTagName, CssVarKeys>>;
@@ -1,13 +1,13 @@
1
1
  import { type CustomElementTagName } from '../custom-tag-name.js';
2
- import { type BaseCssPropertyName } from './css-properties.js';
3
2
  import { type PropertyInitMapBase } from './element-properties.js';
3
+ import { type BaseStringName } from './string-names.js';
4
4
  import { type WithTagName } from './tag-name.js';
5
5
  /**
6
6
  * Base init map for defining host classes in an element definition.
7
7
  *
8
8
  * @category Internal
9
9
  */
10
- export type HostClassesInitMap<TagName extends CustomElementTagName, HostClassKeys extends BaseCssPropertyName<TagName>, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase> = Record<HostClassKeys,
10
+ export type HostClassesInitMap<TagName extends CustomElementTagName, HostClassKeys extends BaseStringName<TagName>, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase> = Record<HostClassKeys,
11
11
  /**
12
12
  * Callback to determine when host class should be enabled (based on current inputs and state),
13
13
  * or just undefined to mark that this host class name will only be manually applied.
@@ -28,7 +28,7 @@ export type HostClassNamesMap<TagName extends string, HostClassKeys extends stri
28
28
  *
29
29
  * @category Internal
30
30
  */
31
- export declare function createHostClassNamesMap<TagName extends CustomElementTagName, HostClassKeys extends BaseCssPropertyName<TagName>, HostClassesInit extends HostClassesInitMap<TagName, HostClassKeys,
31
+ export declare function createHostClassNamesMap<TagName extends CustomElementTagName, HostClassKeys extends BaseStringName<TagName>, HostClassesInit extends HostClassesInitMap<TagName, HostClassKeys,
32
32
  /**
33
33
  * We can use any here because we don't care what the state or input names are, we just care
34
34
  * what the host class names are
@@ -0,0 +1,28 @@
1
+ import { type ArrayElement } from '@augment-vir/common';
2
+ import { type CustomElementTagName } from '../custom-tag-name.js';
3
+ /**
4
+ * Base requirement for all string names with the element tag name prepended.
5
+ *
6
+ * @category Internal
7
+ */
8
+ export type BaseStringName<ElementTagName extends CustomElementTagName> = `${ElementTagName}-${string}`;
9
+ /**
10
+ * Asserts that all the given string names for the given element are valid.
11
+ *
12
+ * @category Internal
13
+ */
14
+ export declare function assertValidStringNames(elementTagName: CustomElementTagName, stringNames: Record<BaseStringName<CustomElementTagName>, any>): void;
15
+ /**
16
+ * Type safe mapping of string names to themself with the element tag name inserted.
17
+ *
18
+ * @category Internal
19
+ */
20
+ export type StringNameMap<ElementTagName extends CustomElementTagName, NameType extends string, StringNames extends ReadonlyArray<string>> = Readonly<{
21
+ [StringName in ArrayElement<StringNames>]: `${ElementTagName}-${NameType}-${StringName}`;
22
+ }>;
23
+ /**
24
+ * Converts an array of string names into a `StringNameMap`.
25
+ *
26
+ * @category Internal
27
+ */
28
+ export declare function createStringNameMap<ElementTagName extends CustomElementTagName, NameType extends string, StringNames extends ReadonlyArray<string>>(elementTagName: ElementTagName, nameType: NameType, stringNames: StringNames | undefined): StringNameMap<ElementTagName, NameType, StringNames>;
@@ -0,0 +1,40 @@
1
+ import { arrayToObject } from '@augment-vir/common';
2
+ /**
3
+ * Asserts that all the given string names for the given element are valid.
4
+ *
5
+ * @category Internal
6
+ */
7
+ export function assertValidStringNames(elementTagName, stringNames) {
8
+ const requiredNameStart = [
9
+ elementTagName,
10
+ '-',
11
+ ].join('');
12
+ Object.keys(stringNames).forEach((stringName) => {
13
+ if (!stringName.startsWith(requiredNameStart)) {
14
+ throw new Error(`Invalid element string name '${stringName}' in '${elementTagName}': element string names must begin with the element's tag name.`);
15
+ }
16
+ });
17
+ }
18
+ /**
19
+ * Converts an array of string names into a `StringNameMap`.
20
+ *
21
+ * @category Internal
22
+ */
23
+ export function createStringNameMap(elementTagName, nameType, stringNames) {
24
+ if (!stringNames) {
25
+ return {};
26
+ }
27
+ const stringNameMap = arrayToObject(stringNames, (stringName) => {
28
+ return {
29
+ key: stringName,
30
+ value: [
31
+ elementTagName,
32
+ nameType,
33
+ stringName,
34
+ ].join('-'),
35
+ };
36
+ }, {
37
+ useRequired: true,
38
+ });
39
+ return stringNameMap;
40
+ }
@@ -1,9 +1,9 @@
1
1
  import { type CSSResult } from '../../lit-exports/base-lit-exports.js';
2
2
  import { type CustomElementTagName } from '../custom-tag-name.js';
3
- import { type BaseCssPropertyName } from './css-properties.js';
4
3
  import { type CssVars } from './css-vars.js';
5
4
  import { type PropertyInitMapBase } from './element-properties.js';
6
5
  import { type HostClassNamesMap, type HostClassesInitMap } from './host-classes.js';
6
+ import { type BaseStringName } from './string-names.js';
7
7
  /**
8
8
  * A host class instance to be referenced inside of an element definition's `styles` callback.
9
9
  *
@@ -18,7 +18,7 @@ export type HostClass = {
18
18
  *
19
19
  * @category Internal
20
20
  */
21
- export type StylesCallbackInput<TagName extends CustomElementTagName, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>> = {
21
+ export type StylesCallbackInput<TagName extends CustomElementTagName, HostClassKeys extends BaseStringName<TagName>, CssVarKeys extends BaseStringName<TagName>> = {
22
22
  hostClasses: Record<HostClassKeys, HostClass>;
23
23
  cssVars: Readonly<CssVars<TagName, CssVarKeys>>;
24
24
  };
@@ -27,13 +27,13 @@ export type StylesCallbackInput<TagName extends CustomElementTagName, HostClassK
27
27
  *
28
28
  * @category Internal
29
29
  */
30
- export type StylesCallback<TagName extends CustomElementTagName, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>> = (input: StylesCallbackInput<TagName, HostClassKeys, CssVarKeys>) => CSSResult;
30
+ export type StylesCallback<TagName extends CustomElementTagName, HostClassKeys extends BaseStringName<TagName>, CssVarKeys extends BaseStringName<TagName>> = (input: StylesCallbackInput<TagName, HostClassKeys, CssVarKeys>) => CSSResult;
31
31
  /**
32
32
  * Creates the input for an element definition's `styles` callback.
33
33
  *
34
34
  * @category Internal
35
35
  */
36
- export declare function createStylesCallbackInput<TagName extends CustomElementTagName, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>>({ hostClassNames, cssVars, }: {
36
+ export declare function createStylesCallbackInput<TagName extends CustomElementTagName, HostClassKeys extends BaseStringName<TagName>, CssVarKeys extends BaseStringName<TagName>>({ hostClassNames, cssVars, }: {
37
37
  hostClassNames: HostClassNamesMap<TagName, HostClassKeys>;
38
38
  cssVars: Readonly<CssVars<TagName, CssVarKeys>>;
39
39
  }): StylesCallbackInput<TagName, HostClassKeys, CssVarKeys>;
@@ -42,7 +42,7 @@ export declare function createStylesCallbackInput<TagName extends CustomElementT
42
42
  *
43
43
  * @category Internal
44
44
  */
45
- export declare function applyHostClasses<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, HostClassKeys extends BaseCssPropertyName<TagName>>({ host, hostClassesInit, hostClassNames, state, inputs, }: {
45
+ export declare function applyHostClasses<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, HostClassKeys extends BaseStringName<TagName>>({ host, hostClassesInit, hostClassNames, state, inputs, }: {
46
46
  host: HTMLElement;
47
47
  hostClassesInit: Readonly<HostClassesInitMap<TagName, HostClassKeys, Inputs, State>> | undefined;
48
48
  hostClassNames: HostClassNamesMap<string, HostClassKeys>;
@@ -2,23 +2,22 @@ import { type HtmlInterpolation } from '../template-transforms/vir-html/html-int
2
2
  import { type TypedEvent } from '../typed-event/typed-event.js';
3
3
  import { type CustomElementTagName } from './custom-tag-name.js';
4
4
  import { type DeclarativeElement, type DeclarativeElementHost } from './declarative-element.js';
5
- import { type BaseCssPropertyName } from './properties/css-properties.js';
6
5
  import { type CssVars } from './properties/css-vars.js';
7
6
  import { type EventDescriptorMap, type EventInitMapEventDetailExtractor, type EventsInitMap } from './properties/element-events.js';
8
7
  import { type PropertyInitMapBase } from './properties/element-properties.js';
9
- import { type SlotNameMap } from './slot-names.js';
8
+ import { type BaseStringName, type StringNameMap } from './properties/string-names.js';
10
9
  /**
11
10
  * Type for the `render` element definition method.
12
11
  *
13
12
  * @category Internal
14
13
  */
15
- export type RenderCallback<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, State extends PropertyInitMapBase = any, EventsInit extends EventsInitMap = any, HostClassKeys extends BaseCssPropertyName<TagName> = any, CssVarKeys extends BaseCssPropertyName<TagName> = any, SlotNames extends ReadonlyArray<string> = any> = (params: RenderParams<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => HtmlInterpolation;
14
+ export type RenderCallback<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, State extends PropertyInitMapBase = any, EventsInit extends EventsInitMap = any, HostClassKeys extends BaseStringName<TagName> = any, CssVarKeys extends BaseStringName<TagName> = any, SlotNames extends ReadonlyArray<string> = any, TestIds extends ReadonlyArray<string> = any> = (params: RenderParams<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) => HtmlInterpolation;
16
15
  /**
17
16
  * Type for the `init` and `cleanup` element definition methods.
18
17
  *
19
18
  * @category Internal
20
19
  */
21
- export type InitCallback<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = (params: RenderParams<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => undefined | void;
20
+ export type InitCallback<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseStringName<TagName>, CssVarKeys extends BaseStringName<TagName>, SlotNames extends ReadonlyArray<string>, TestIds extends ReadonlyArray<string>> = (params: RenderParams<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) => undefined | void;
22
21
  /**
23
22
  * Type for the `updateState` render parameter.
24
23
  *
@@ -30,13 +29,14 @@ export type UpdateStateCallback<State extends PropertyInitMapBase> = (newState:
30
29
  *
31
30
  * @category Internal
32
31
  */
33
- export type RenderParams<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = {
32
+ export type RenderParams<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseStringName<TagName>, CssVarKeys extends BaseStringName<TagName>, SlotNames extends ReadonlyArray<string>, TestIds extends ReadonlyArray<string>> = {
34
33
  state: Readonly<State>;
35
34
  cssVars: Readonly<CssVars<TagName, CssVarKeys>>;
36
35
  updateState: UpdateStateCallback<State>;
37
36
  events: EventDescriptorMap<TagName, EventsInit>;
38
- host: DeclarativeElementHost<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
39
- slotNames: SlotNameMap<SlotNames>;
37
+ host: DeclarativeElementHost<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
38
+ slotNames: Readonly<StringNameMap<TagName, 'slot', SlotNames>>;
39
+ testIds: Readonly<StringNameMap<TagName, 'test-id', TestIds>>;
40
40
  /** Dispatch an event from the current element. */
41
41
  dispatch: <EventTypeName extends keyof EventsInit>(event: TypedEvent<EventTypeName extends string ? EventTypeName : never, EventInitMapEventDetailExtractor<EventTypeName, EventsInit>> | Event) => boolean;
42
42
  inputs: Readonly<Inputs>;
@@ -47,9 +47,10 @@ export type RenderParams<TagName extends CustomElementTagName, Inputs extends Pr
47
47
  *
48
48
  * @category Internal
49
49
  */
50
- export declare function createRenderParams<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>>({ element, eventsMap, cssVars, slotNamesMap, }: {
51
- element: DeclarativeElement<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
50
+ export declare function createRenderParams<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, State extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseStringName<TagName>, CssVarKeys extends BaseStringName<TagName>, SlotNames extends ReadonlyArray<string>, TestIds extends ReadonlyArray<string>>({ element, eventsMap, cssVars, slotNamesMap, testIdsMap, }: {
51
+ element: DeclarativeElement<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
52
52
  eventsMap: EventDescriptorMap<TagName, EventsInit>;
53
53
  cssVars: Readonly<CssVars<TagName, CssVarKeys>>;
54
- slotNamesMap: SlotNameMap<SlotNames>;
55
- }): RenderParams<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
54
+ slotNamesMap: Readonly<StringNameMap<TagName, 'slot', SlotNames>>;
55
+ testIdsMap: Readonly<StringNameMap<TagName, 'test-id', TestIds>>;
56
+ }): RenderParams<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
@@ -5,7 +5,7 @@ import { getObjectTypedKeys } from '@augment-vir/common';
5
5
  *
6
6
  * @category Internal
7
7
  */
8
- export function createRenderParams({ element, eventsMap, cssVars, slotNamesMap, }) {
8
+ export function createRenderParams({ element, eventsMap, cssVars, slotNamesMap, testIdsMap, }) {
9
9
  function updateState(newStatePartial) {
10
10
  getObjectTypedKeys(newStatePartial).forEach((stateKey) => {
11
11
  const newValue = newStatePartial[stateKey];
@@ -15,6 +15,7 @@ export function createRenderParams({ element, eventsMap, cssVars, slotNamesMap,
15
15
  const renderParams = {
16
16
  cssVars,
17
17
  slotNames: slotNamesMap,
18
+ testIds: testIdsMap,
18
19
  dispatch: (event) => element.dispatchEvent(event),
19
20
  events: eventsMap,
20
21
  host: element,
@@ -2,9 +2,9 @@ import { type PartialWithNullable } from '@augment-vir/common';
2
2
  import { type CustomElementTagName } from './custom-tag-name.js';
3
3
  import { type DeclarativeElementInit } from './declarative-element-init.js';
4
4
  import { type DeclarativeElementInputErrorParams } from './define-element.js';
5
- import { type BaseCssPropertyName } from './properties/css-properties.js';
6
5
  import { type EventsInitMap } from './properties/element-events.js';
7
6
  import { type PropertyInitMapBase } from './properties/element-properties.js';
7
+ import { type BaseStringName } from './properties/string-names.js';
8
8
  /**
9
9
  * Options for {@link wrapDefineElement}.
10
10
  *
@@ -15,12 +15,12 @@ export type WrapDefineElementOptions<TagNameRequirement extends CustomElementTag
15
15
  * An optional callback which asserts that an element definition init object given to the
16
16
  * wrapped element definition functions is valid.
17
17
  */
18
- assertInputs: (inputInit: DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateRequirement, EventsInitRequirement, BaseCssPropertyName<TagNameRequirement>, BaseCssPropertyName<TagNameRequirement>, ReadonlyArray<string>>) => void;
18
+ assertInputs: (inputInit: DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateRequirement, EventsInitRequirement, BaseStringName<TagNameRequirement>, BaseStringName<TagNameRequirement>, ReadonlyArray<string>, ReadonlyArray<string>>) => void;
19
19
  /**
20
20
  * An optional callback which transforms a element definition init object given to the wrapped
21
21
  * element definition.
22
22
  */
23
- transformInputs: (inputInit: DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateRequirement, EventsInitRequirement, BaseCssPropertyName<TagNameRequirement>, BaseCssPropertyName<TagNameRequirement>, ReadonlyArray<string>>) => DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateRequirement, EventsInitRequirement, BaseCssPropertyName<TagNameRequirement>, BaseCssPropertyName<TagNameRequirement>, ReadonlyArray<string>>;
23
+ transformInputs: (inputInit: DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateRequirement, EventsInitRequirement, BaseStringName<TagNameRequirement>, BaseStringName<TagNameRequirement>, ReadonlyArray<string>, ReadonlyArray<string>>) => DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateRequirement, EventsInitRequirement, BaseStringName<TagNameRequirement>, BaseStringName<TagNameRequirement>, ReadonlyArray<string>, ReadonlyArray<string>>;
24
24
  }>;
25
25
  /**
26
26
  * Wraps {@link defineElement} in a superset of requirements. For example:
@@ -33,4 +33,4 @@ export type WrapDefineElementOptions<TagNameRequirement extends CustomElementTag
33
33
  *
34
34
  * @category Element Definition
35
35
  */
36
- export declare function wrapDefineElement<TagNameRequirement extends CustomElementTagName = CustomElementTagName, InputsRequirement extends PropertyInitMapBase = {}, StateRequirement extends PropertyInitMapBase = {}, EventsInitRequirement extends EventsInitMap = {}>(options?: WrapDefineElementOptions | undefined): <Inputs extends InputsRequirement>(...errorParams: DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends TagNameRequirement, State extends StateRequirement, EventsInit extends EventsInitRequirement, const HostClassKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>>(inputs: DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("./declarative-element.js").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
36
+ export declare function wrapDefineElement<TagNameRequirement extends CustomElementTagName = CustomElementTagName, InputsRequirement extends PropertyInitMapBase = {}, StateRequirement extends PropertyInitMapBase = {}, EventsInitRequirement extends EventsInitMap = {}>(options?: WrapDefineElementOptions | undefined): <Inputs extends InputsRequirement>(...errorParams: DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends TagNameRequirement, State extends StateRequirement, EventsInit extends EventsInitRequirement, const HostClassKeys extends BaseStringName<TagName> = `${TagName}-`, const CssVarKeys extends BaseStringName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>, const TestIds extends ReadonlyArray<string> = Readonly<[]>>(inputs: DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) => import("./declarative-element.js").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
package/dist/index.d.ts CHANGED
@@ -20,16 +20,15 @@ export * from './declarative-element/directives/render-if.directive.js';
20
20
  export * from './declarative-element/directives/test-id.directive.js';
21
21
  export * from './declarative-element/is-declarative-element-definition.js';
22
22
  export * from './declarative-element/is-declarative-element.js';
23
- export * from './declarative-element/properties/css-properties.js';
24
23
  export * from './declarative-element/properties/css-vars.js';
25
24
  export * from './declarative-element/properties/element-events.js';
26
25
  export * from './declarative-element/properties/element-properties.js';
27
26
  export * from './declarative-element/properties/host-classes.js';
28
27
  export * from './declarative-element/properties/property-proxy.js';
28
+ export * from './declarative-element/properties/string-names.js';
29
29
  export * from './declarative-element/properties/styles.js';
30
30
  export * from './declarative-element/properties/tag-name.js';
31
31
  export * from './declarative-element/render-callback.js';
32
- export * from './declarative-element/slot-names.js';
33
32
  export * from './declarative-element/wrap-define-element.js';
34
33
  export * from './lit-exports/all-lit-exports.js';
35
34
  export * from './require-declarative-element.js';
package/dist/index.js CHANGED
@@ -20,16 +20,15 @@ export * from './declarative-element/directives/render-if.directive.js';
20
20
  export * from './declarative-element/directives/test-id.directive.js';
21
21
  export * from './declarative-element/is-declarative-element-definition.js';
22
22
  export * from './declarative-element/is-declarative-element.js';
23
- export * from './declarative-element/properties/css-properties.js';
24
23
  export * from './declarative-element/properties/css-vars.js';
25
24
  export * from './declarative-element/properties/element-events.js';
26
25
  export * from './declarative-element/properties/element-properties.js';
27
26
  export * from './declarative-element/properties/host-classes.js';
28
27
  export * from './declarative-element/properties/property-proxy.js';
28
+ export * from './declarative-element/properties/string-names.js';
29
29
  export * from './declarative-element/properties/styles.js';
30
30
  export * from './declarative-element/properties/tag-name.js';
31
31
  export * from './declarative-element/render-callback.js';
32
- export * from './declarative-element/slot-names.js';
33
32
  export * from './declarative-element/wrap-define-element.js';
34
33
  export * from './lit-exports/all-lit-exports.js';
35
34
  export * from './require-declarative-element.js';
@@ -1 +1 @@
1
- export declare const MyApp: import("element-vir").DeclarativeElementDefinition<"my-app", {}, {}, {}, "my-app-", "my-app-", readonly []>;
1
+ export declare const MyApp: import("element-vir").DeclarativeElementDefinition<"my-app", {}, {}, {}, "my-app-", "my-app-", readonly [], readonly []>;
@@ -1,4 +1,4 @@
1
1
  export type VirTagName = `vir-${string}`;
2
- export declare const defineVirElement: <Inputs extends {}>(...errorParams: import("../index.js").DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends `vir-${string}`, State extends {}, EventsInit extends {}, const HostClassKeys extends import("../index.js").BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends import("../index.js").BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>>(inputs: import("../index.js").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
3
- export declare const defineVerifiedVirElement: <Inputs extends {}>(...errorParams: import("../index.js").DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends `vir-${string}`, State extends {}, EventsInit extends {}, const HostClassKeys extends import("../index.js").BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends import("../index.js").BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>>(inputs: import("../index.js").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
4
- export declare const defineTransformedVirElement: <Inputs extends {}>(...errorParams: import("../index.js").DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends `vir-${string}`, State extends {}, EventsInit extends {}, const HostClassKeys extends import("../index.js").BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends import("../index.js").BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>>(inputs: import("../index.js").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
2
+ export declare const defineVirElement: <Inputs extends {}>(...errorParams: import("../index.js").DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends `vir-${string}`, State extends {}, EventsInit extends {}, const HostClassKeys extends import("../index.js").BaseStringName<TagName> = `${TagName}-`, const CssVarKeys extends import("../index.js").BaseStringName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>, const TestIds extends ReadonlyArray<string> = Readonly<[]>>(inputs: import("../index.js").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
3
+ export declare const defineVerifiedVirElement: <Inputs extends {}>(...errorParams: import("../index.js").DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends `vir-${string}`, State extends {}, EventsInit extends {}, const HostClassKeys extends import("../index.js").BaseStringName<TagName> = `${TagName}-`, const CssVarKeys extends import("../index.js").BaseStringName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>, const TestIds extends ReadonlyArray<string> = Readonly<[]>>(inputs: import("../index.js").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
4
+ export declare const defineTransformedVirElement: <Inputs extends {}>(...errorParams: import("../index.js").DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends `vir-${string}`, State extends {}, EventsInit extends {}, const HostClassKeys extends import("../index.js").BaseStringName<TagName> = `${TagName}-`, const CssVarKeys extends import("../index.js").BaseStringName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>, const TestIds extends ReadonlyArray<string> = Readonly<[]>>(inputs: import("../index.js").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames, TestIds>;
@@ -1 +1 @@
1
- export declare const MySimple: import("element-vir").DeclarativeElementDefinition<"my-simple", {}, {}, {}, "my-simple-", "my-simple-", readonly []>;
1
+ export declare const MySimple: import("element-vir").DeclarativeElementDefinition<"my-simple", {}, {}, {}, "my-simple-", "my-simple-", readonly [], readonly []>;
@@ -1 +1 @@
1
- export declare const MyWithAssignment: import("element-vir").DeclarativeElementDefinition<"my-with-assignment", {}, {}, {}, "my-with-assignment-", "my-with-assignment-", readonly []>;
1
+ export declare const MyWithAssignment: import("element-vir").DeclarativeElementDefinition<"my-with-assignment", {}, {}, {}, "my-with-assignment-", "my-with-assignment-", readonly [], readonly []>;
@@ -6,5 +6,5 @@ export declare const MyWithAsyncProp: import("../index.js").DeclarativeElementDe
6
6
  endpoint: string;
7
7
  }>;
8
8
  hi: string;
9
- }, {}, "my-with-async-prop-", "my-with-async-prop-", readonly []>;
9
+ }, {}, "my-with-async-prop-", "my-with-async-prop-", readonly [], readonly []>;
10
10
  export {};
@@ -1,3 +1,3 @@
1
1
  export declare const MyWithAssignmentCleanupCallback: import("element-vir").DeclarativeElementDefinition<"my-with-cleanup-callback", {}, {
2
2
  intervalId: number;
3
- }, {}, "my-with-cleanup-callback-", "my-with-cleanup-callback-", readonly []>;
3
+ }, {}, "my-with-cleanup-callback-", "my-with-cleanup-callback-", readonly [], readonly []>;
@@ -1 +1 @@
1
- export declare const MyWithCssVars: import("element-vir").DeclarativeElementDefinition<"my-with-css-vars", {}, {}, {}, "my-with-css-vars-", "my-with-css-vars-my-var", readonly []>;
1
+ export declare const MyWithCssVars: import("element-vir").DeclarativeElementDefinition<"my-with-css-vars", {}, {}, {}, "my-with-css-vars-", "my-with-css-vars-my-var", readonly [], readonly []>;
@@ -1 +1 @@
1
- export declare const MyWithCustomEvents: import("element-vir").DeclarativeElementDefinition<"my-with-custom-events", {}, {}, {}, "my-with-custom-events-", "my-with-custom-events-", readonly []>;
1
+ export declare const MyWithCustomEvents: import("element-vir").DeclarativeElementDefinition<"my-with-custom-events", {}, {}, {}, "my-with-custom-events-", "my-with-custom-events-", readonly [], readonly []>;
@@ -1,3 +1,3 @@
1
1
  export declare const MyWithEventListening: import("element-vir").DeclarativeElementDefinition<"my-with-event-listening", {}, {
2
2
  myNumber: number;
3
- }, {}, "my-with-event-listening-", "my-with-event-listening-", readonly []>;
3
+ }, {}, "my-with-event-listening-", "my-with-event-listening-", readonly [], readonly []>;
@@ -1,4 +1,4 @@
1
1
  export declare const MyWithEvents: import("element-vir").DeclarativeElementDefinition<"my-with-events", {}, {}, {
2
2
  logoutClick: import("element-vir").DefineEvent<void>;
3
3
  randomNumber: import("element-vir").DefineEvent<number>;
4
- }, "my-with-events-", "my-with-events-", readonly []>;
4
+ }, "my-with-events-", "my-with-events-", readonly [], readonly []>;
@@ -1,3 +1,3 @@
1
1
  export declare const MyWithHostClassDefinition: import("element-vir").DeclarativeElementDefinition<"my-with-host-class-definition", {}, {
2
2
  myProp: string;
3
- }, {}, "my-with-host-class-definition-a" | "my-with-host-class-definition-automatic", "my-with-host-class-definition-", readonly []>;
3
+ }, {}, "my-with-host-class-definition-a" | "my-with-host-class-definition-automatic", "my-with-host-class-definition-", readonly [], readonly []>;
@@ -1 +1 @@
1
- export declare const MyWithHostClassUsage: import("element-vir").DeclarativeElementDefinition<"my-with-host-class-usage", {}, {}, {}, "my-with-host-class-usage-", "my-with-host-class-usage-", readonly []>;
1
+ export declare const MyWithHostClassUsage: import("element-vir").DeclarativeElementDefinition<"my-with-host-class-usage", {}, {}, {}, "my-with-host-class-usage-", "my-with-host-class-usage-", readonly [], readonly []>;
@@ -1,4 +1,4 @@
1
1
  export declare const MyWithInputs: import("../index.js").DeclarativeElementDefinition<"my-with-inputs", {
2
2
  username: string;
3
3
  email: string;
4
- }, {}, {}, "my-with-inputs-", "my-with-inputs-", readonly []>;
4
+ }, {}, {}, "my-with-inputs-", "my-with-inputs-", readonly [], readonly []>;
@@ -1 +1 @@
1
- export declare const MyWithOnDomCreated: import("element-vir").DeclarativeElementDefinition<"my-with-on-dom-created", {}, {}, {}, "my-with-on-dom-created-", "my-with-on-dom-created-", readonly []>;
1
+ export declare const MyWithOnDomCreated: import("element-vir").DeclarativeElementDefinition<"my-with-on-dom-created", {}, {}, {}, "my-with-on-dom-created-", "my-with-on-dom-created-", readonly [], readonly []>;
@@ -1 +1 @@
1
- export declare const MyWithOnResize: import("element-vir").DeclarativeElementDefinition<"my-with-on-resize", {}, {}, {}, "my-with-on-resize-", "my-with-on-resize-", readonly []>;
1
+ export declare const MyWithOnResize: import("element-vir").DeclarativeElementDefinition<"my-with-on-resize", {}, {}, {}, "my-with-on-resize-", "my-with-on-resize-", readonly [], readonly []>;
@@ -1,3 +1,3 @@
1
1
  export declare const MyWithRenderIf: import("../index.js").DeclarativeElementDefinition<"my-with-render-if", {
2
2
  shouldRender: boolean;
3
- }, {}, {}, "my-with-render-if-", "my-with-render-if-", readonly []>;
3
+ }, {}, {}, "my-with-render-if-", "my-with-render-if-", readonly [], readonly []>;
@@ -1 +1 @@
1
- export declare const MyWithStylesAndInterpolatedSelector: import("element-vir").DeclarativeElementDefinition<"my-with-styles-and-interpolated-selector", {}, {}, {}, "my-with-styles-and-interpolated-selector-", "my-with-styles-and-interpolated-selector-", readonly []>;
1
+ export declare const MyWithStylesAndInterpolatedSelector: import("element-vir").DeclarativeElementDefinition<"my-with-styles-and-interpolated-selector", {}, {}, {}, "my-with-styles-and-interpolated-selector-", "my-with-styles-and-interpolated-selector-", readonly [], readonly []>;
@@ -1 +1 @@
1
- export declare const MyWithStyles: import("element-vir").DeclarativeElementDefinition<"my-with-styles", {}, {}, {}, "my-with-styles-", "my-with-styles-", readonly []>;
1
+ export declare const MyWithStyles: import("element-vir").DeclarativeElementDefinition<"my-with-styles", {}, {}, {}, "my-with-styles-", "my-with-styles-", readonly [], readonly []>;
@@ -5,4 +5,4 @@ export declare const MyWithUpdateState: import("element-vir").DeclarativeElement
5
5
  * type. This is particularly useful when, as below, the initial value is undefined.
6
6
  */
7
7
  email: string | undefined;
8
- }, {}, "my-with-update-state-", "my-with-update-state-", readonly []>;
8
+ }, {}, "my-with-update-state-", "my-with-update-state-", readonly [], readonly []>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "element-vir",
3
- "version": "26.10.0",
3
+ "version": "26.11.0",
4
4
  "keywords": [
5
5
  "custom",
6
6
  "web",
@@ -39,19 +39,19 @@
39
39
  "test:docs": "virmator docs check"
40
40
  },
41
41
  "dependencies": {
42
- "@augment-vir/assert": "^31.38.0",
43
- "@augment-vir/common": "^31.38.0",
44
- "date-vir": "^7.4.2",
42
+ "@augment-vir/assert": "^31.40.0",
43
+ "@augment-vir/common": "^31.40.0",
44
+ "date-vir": "^8.0.0",
45
45
  "lit": "^3.3.1",
46
46
  "lit-css-vars": "^3.0.11",
47
47
  "lit-html": "^3.3.1",
48
- "object-shape-tester": "^6.5.0",
49
- "observavir": "^2.1.1",
48
+ "object-shape-tester": "^6.9.2",
49
+ "observavir": "^2.1.2",
50
50
  "typed-event-target": "^4.1.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@augment-vir/test": "^31.38.0",
54
- "@augment-vir/web": "^31.38.0",
53
+ "@augment-vir/test": "^31.40.0",
54
+ "@augment-vir/web": "^31.40.0",
55
55
  "@web/dev-server-esbuild": "^1.0.4",
56
56
  "@web/test-runner": "^0.20.2",
57
57
  "@web/test-runner-commands": "^0.9.0",
@@ -60,10 +60,10 @@
60
60
  "html-spec-tags": "^2.2.3",
61
61
  "istanbul-smart-text-reporter": "^1.1.5",
62
62
  "markdown-code-example-inserter": "^3.0.3",
63
- "type-fest": "^5.0.1",
64
- "typedoc": "^0.28.13",
65
- "typescript": "5.9.2",
66
- "vite": "^7.1.7",
63
+ "type-fest": "^5.1.0",
64
+ "typedoc": "^0.28.14",
65
+ "typescript": "5.9.3",
66
+ "vite": "^7.1.9",
67
67
  "vite-tsconfig-paths": "^5.1.4"
68
68
  },
69
69
  "engines": {
@@ -1,13 +0,0 @@
1
- import { type CustomElementTagName } from '../custom-tag-name.js';
2
- /**
3
- * Base requirement for all CSS property names (like CSS var names).
4
- *
5
- * @category Internal
6
- */
7
- export type BaseCssPropertyName<ElementTagName extends CustomElementTagName> = `${ElementTagName}-${string}`;
8
- /**
9
- * Asserts that all the given CSS properties for the given element are valid.
10
- *
11
- * @category Internal
12
- */
13
- export declare function assertValidCssProperties(elementTagName: CustomElementTagName, cssProperties: Record<BaseCssPropertyName<CustomElementTagName>, any>): void;
@@ -1,16 +0,0 @@
1
- /**
2
- * Asserts that all the given CSS properties for the given element are valid.
3
- *
4
- * @category Internal
5
- */
6
- export function assertValidCssProperties(elementTagName, cssProperties) {
7
- const requiredCssPropKeyStart = [
8
- elementTagName,
9
- '-',
10
- ].join('');
11
- Object.keys(cssProperties).forEach((cssPropName) => {
12
- if (!cssPropName.startsWith(requiredCssPropKeyStart)) {
13
- throw new Error(`Invalid CSS property name '${cssPropName}' in '${elementTagName}': CSS property names must begin with the element's tag name.`);
14
- }
15
- });
16
- }
@@ -1,15 +0,0 @@
1
- import { type ArrayElement } from '@augment-vir/common';
2
- /**
3
- * Type safe mapping of slot names to themselves.
4
- *
5
- * @category Internal
6
- */
7
- export type SlotNameMap<SlotNames extends ReadonlyArray<string>> = Readonly<{
8
- [SlotName in ArrayElement<SlotNames>]: SlotName;
9
- }>;
10
- /**
11
- * Converts an array of slot names into a `SlotNameMap`.
12
- *
13
- * @category Internal
14
- */
15
- export declare function createSlotNamesMap<SlotNames extends ReadonlyArray<string>>(slotNames: SlotNames | undefined): SlotNameMap<SlotNames>;
@@ -1,15 +0,0 @@
1
- /**
2
- * Converts an array of slot names into a `SlotNameMap`.
3
- *
4
- * @category Internal
5
- */
6
- export function createSlotNamesMap(slotNames) {
7
- if (!slotNames) {
8
- return {};
9
- }
10
- const slotNameMap = slotNames.reduce((accum, slotName) => {
11
- accum[slotName] = slotName;
12
- return accum;
13
- }, {});
14
- return slotNameMap;
15
- }