element-vir 22.2.1 → 23.0.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 (137) hide show
  1. package/README.md +42 -36
  2. package/dist/declarative-element/custom-tag-name.d.ts +6 -0
  3. package/dist/declarative-element/declarative-element-init.d.ts +20 -14
  4. package/dist/declarative-element/declarative-element.d.ts +70 -24
  5. package/dist/declarative-element/declarative-element.js +34 -1
  6. package/dist/declarative-element/define-element-no-inputs.d.ts +31 -6
  7. package/dist/declarative-element/define-element-no-inputs.js +154 -257
  8. package/dist/declarative-element/define-element.d.ts +35 -7
  9. package/dist/declarative-element/define-element.js +26 -4
  10. package/dist/declarative-element/definition-options.d.ts +10 -0
  11. package/dist/declarative-element/definition-options.js +5 -0
  12. package/dist/declarative-element/directives/assign.directive.d.ts +8 -11
  13. package/dist/declarative-element/directives/assign.directive.js +6 -13
  14. package/dist/declarative-element/directives/async-prop.d.ts +19 -4
  15. package/dist/declarative-element/directives/async-prop.js +15 -4
  16. package/dist/declarative-element/directives/create-attribute-directive.d.ts +19 -4
  17. package/dist/declarative-element/directives/create-attribute-directive.js +18 -8
  18. package/dist/declarative-element/directives/directive-helpers.d.ts +19 -4
  19. package/dist/declarative-element/directives/directive-helpers.js +14 -2
  20. package/dist/declarative-element/directives/is-resolved.directive.d.ts +107 -1
  21. package/dist/declarative-element/directives/is-resolved.directive.js +107 -1
  22. package/dist/declarative-element/directives/listen.directive.d.ts +84 -10
  23. package/dist/declarative-element/directives/listen.directive.js +5 -15
  24. package/dist/declarative-element/directives/on-dom-created.directive.d.ts +37 -4
  25. package/dist/declarative-element/directives/on-dom-created.directive.js +32 -12
  26. package/dist/declarative-element/directives/on-dom-rendered.directive.d.ts +33 -3
  27. package/dist/declarative-element/directives/on-dom-rendered.directive.js +29 -6
  28. package/dist/declarative-element/directives/on-resize.directive.d.ts +37 -4
  29. package/dist/declarative-element/directives/on-resize.directive.js +37 -24
  30. package/dist/declarative-element/directives/render-async.directive.d.ts +44 -4
  31. package/dist/declarative-element/directives/render-async.directive.js +13 -3
  32. package/dist/declarative-element/directives/render-if.directive.d.ts +31 -0
  33. package/dist/declarative-element/directives/render-if.directive.js +32 -1
  34. package/dist/declarative-element/directives/test-id.directive.d.ts +48 -4
  35. package/dist/declarative-element/directives/test-id.directive.js +47 -2
  36. package/dist/declarative-element/has-declarative-element-parent.js +1 -1
  37. package/dist/declarative-element/is-declarative-element-definition.d.ts +15 -1
  38. package/dist/declarative-element/is-declarative-element-definition.js +21 -18
  39. package/dist/declarative-element/is-declarative-element.d.ts +5 -1
  40. package/dist/declarative-element/is-declarative-element.js +7 -3
  41. package/dist/declarative-element/properties/assign-inputs.js +1 -1
  42. package/dist/declarative-element/properties/css-properties.d.ts +11 -1
  43. package/dist/declarative-element/properties/css-properties.js +5 -0
  44. package/dist/declarative-element/properties/css-vars.d.ts +14 -4
  45. package/dist/declarative-element/properties/element-events.d.ts +61 -7
  46. package/dist/declarative-element/properties/element-events.js +40 -5
  47. package/dist/declarative-element/properties/element-properties.d.ts +15 -6
  48. package/dist/declarative-element/properties/element-properties.js +1 -21
  49. package/dist/declarative-element/properties/element-vir-state-setup.d.ts +43 -3
  50. package/dist/declarative-element/properties/element-vir-state-setup.js +17 -3
  51. package/dist/declarative-element/properties/host-classes.d.ts +25 -12
  52. package/dist/declarative-element/properties/host-classes.js +5 -0
  53. package/dist/declarative-element/properties/per-instance.d.ts +23 -2
  54. package/dist/declarative-element/properties/per-instance.js +24 -3
  55. package/dist/declarative-element/properties/property-proxy.d.ts +19 -4
  56. package/dist/declarative-element/properties/property-proxy.js +15 -4
  57. package/dist/declarative-element/properties/styles.d.ts +33 -8
  58. package/dist/declarative-element/properties/styles.js +12 -2
  59. package/dist/declarative-element/properties/tag-name.d.ts +5 -0
  60. package/dist/declarative-element/render-callback.d.ts +38 -11
  61. package/dist/declarative-element/render-callback.js +6 -0
  62. package/dist/declarative-element/slot-names.d.ts +10 -2
  63. package/dist/declarative-element/slot-names.js +5 -1
  64. package/dist/declarative-element/wrap-define-element.d.ts +38 -11
  65. package/dist/declarative-element/wrap-define-element.js +17 -2
  66. package/dist/index.d.ts +40 -40
  67. package/dist/index.js +40 -39
  68. package/dist/lit-exports/all-lit-exports.d.ts +2 -2
  69. package/dist/lit-exports/all-lit-exports.js +2 -2
  70. package/dist/lit-exports/lit-repeat-fix.d.ts +60 -4
  71. package/dist/lit-exports/lit-repeat-fix.js +35 -1
  72. package/dist/readme-examples/my-app.element.d.ts +1 -0
  73. package/dist/readme-examples/my-app.element.js +11 -0
  74. package/dist/readme-examples/my-custom-action.event.d.ts +1 -0
  75. package/dist/readme-examples/my-custom-action.event.js +2 -0
  76. package/dist/readme-examples/my-custom-define.d.ts +4 -0
  77. package/dist/readme-examples/my-custom-define.js +19 -0
  78. package/dist/readme-examples/my-simple.element.d.ts +1 -0
  79. package/dist/readme-examples/my-simple.element.js +9 -0
  80. package/dist/readme-examples/my-with-assignment.element.d.ts +1 -0
  81. package/dist/readme-examples/my-with-assignment.element.js +14 -0
  82. package/dist/readme-examples/my-with-async-prop.element.d.ts +9 -0
  83. package/dist/readme-examples/my-with-async-prop.element.js +46 -0
  84. package/dist/readme-examples/my-with-cleanup-callback.element.d.ts +3 -0
  85. package/dist/readme-examples/my-with-cleanup-callback.element.js +23 -0
  86. package/dist/readme-examples/my-with-css-vars.element.d.ts +1 -0
  87. package/dist/readme-examples/my-with-css-vars.element.js +24 -0
  88. package/dist/readme-examples/my-with-custom-events.element.d.ts +1 -0
  89. package/dist/readme-examples/my-with-custom-events.element.js +21 -0
  90. package/dist/readme-examples/my-with-event-listening.element.d.ts +3 -0
  91. package/dist/readme-examples/my-with-event-listening.element.js +22 -0
  92. package/dist/readme-examples/my-with-events.element.d.ts +4 -0
  93. package/dist/readme-examples/my-with-events.element.js +19 -0
  94. package/dist/readme-examples/my-with-host-class-definition.element.d.ts +3 -0
  95. package/dist/readme-examples/my-with-host-class-definition.element.js +39 -0
  96. package/dist/readme-examples/my-with-host-class-usage.element.d.ts +1 -0
  97. package/dist/readme-examples/my-with-host-class-usage.element.js +12 -0
  98. package/dist/readme-examples/my-with-inputs.element.d.ts +4 -0
  99. package/dist/readme-examples/my-with-inputs.element.js +9 -0
  100. package/dist/readme-examples/my-with-on-dom-created.element.d.ts +1 -0
  101. package/dist/readme-examples/my-with-on-dom-created.element.js +16 -0
  102. package/dist/readme-examples/my-with-on-resize.element.d.ts +1 -0
  103. package/dist/readme-examples/my-with-on-resize.element.js +17 -0
  104. package/dist/readme-examples/my-with-render-if.element.d.ts +3 -0
  105. package/dist/readme-examples/my-with-render-if.element.js +11 -0
  106. package/dist/readme-examples/my-with-styles-and-interpolated-selector.element.d.ts +1 -0
  107. package/dist/readme-examples/my-with-styles-and-interpolated-selector.element.js +15 -0
  108. package/dist/readme-examples/my-with-styles.element.d.ts +1 -0
  109. package/dist/readme-examples/my-with-styles.element.js +21 -0
  110. package/dist/readme-examples/my-with-update-state.element.d.ts +8 -0
  111. package/dist/readme-examples/my-with-update-state.element.js +23 -0
  112. package/dist/readme-examples/require-declarative-element.d.ts +1 -0
  113. package/dist/readme-examples/require-declarative-element.js +2 -0
  114. package/dist/require-declarative-element.d.ts +12 -0
  115. package/dist/require-declarative-element.js +12 -0
  116. package/dist/template-transforms/minimal-element-definition.d.ts +30 -2
  117. package/dist/template-transforms/minimal-element-definition.js +14 -3
  118. package/dist/template-transforms/nested-mapped-templates.d.ts +1 -1
  119. package/dist/template-transforms/nested-mapped-templates.js +4 -3
  120. package/dist/template-transforms/template-transform-type.d.ts +1 -1
  121. package/dist/template-transforms/transform-template.d.ts +1 -1
  122. package/dist/template-transforms/transform-template.js +17 -21
  123. package/dist/template-transforms/vir-css/css-transform.d.ts +3 -3
  124. package/dist/template-transforms/vir-css/css-transform.js +3 -2
  125. package/dist/template-transforms/vir-css/vir-css.d.ts +11 -2
  126. package/dist/template-transforms/vir-css/vir-css.js +11 -2
  127. package/dist/template-transforms/vir-html/html-interpolation.d.ts +9 -5
  128. package/dist/template-transforms/vir-html/html-transform.d.ts +3 -3
  129. package/dist/template-transforms/vir-html/html-transform.js +14 -12
  130. package/dist/template-transforms/vir-html/vir-html.d.ts +4 -2
  131. package/dist/template-transforms/vir-html/vir-html.js +4 -2
  132. package/dist/typed-event/typed-event.d.ts +42 -6
  133. package/dist/typed-event/typed-event.js +31 -28
  134. package/dist/util/lit-template.d.ts +6 -1
  135. package/dist/util/lit-template.js +10 -7
  136. package/dist/util/type.d.ts +5 -0
  137. package/package.json +35 -34
@@ -1,16 +1,36 @@
1
- import { HtmlInterpolation } from '../template-transforms/vir-html/html-interpolation';
2
- import { TypedEvent } from '../typed-event/typed-event';
3
- import { CustomElementTagName } from './custom-tag-name';
4
- import type { DeclarativeElement, DeclarativeElementHost } from './declarative-element';
5
- import { BaseCssPropertyName } from './properties/css-properties';
6
- import { CssVars } from './properties/css-vars';
7
- import { EventDescriptorMap, EventInitMapEventDetailExtractor, EventsInitMap } from './properties/element-events';
8
- import { PropertyInitMapBase } from './properties/element-properties';
9
- import { AllowElementVirStateSetup, FlattenElementVirStateSetup } from './properties/element-vir-state-setup';
10
- import { SlotNameMap } from './slot-names';
1
+ import { type HtmlInterpolation } from '../template-transforms/vir-html/html-interpolation.js';
2
+ import { type TypedEvent } from '../typed-event/typed-event.js';
3
+ import { type CustomElementTagName } from './custom-tag-name.js';
4
+ import { type DeclarativeElement, type DeclarativeElementHost } from './declarative-element.js';
5
+ import { type BaseCssPropertyName } from './properties/css-properties.js';
6
+ import { type CssVars } from './properties/css-vars.js';
7
+ import { type EventDescriptorMap, type EventInitMapEventDetailExtractor, type EventsInitMap } from './properties/element-events.js';
8
+ import { type PropertyInitMapBase } from './properties/element-properties.js';
9
+ import { type AllowElementVirStateSetup, type FlattenElementVirStateSetup } from './properties/element-vir-state-setup.js';
10
+ import { type SlotNameMap } from './slot-names.js';
11
+ /**
12
+ * Type for the `render` element definition method.
13
+ *
14
+ * @category Internal
15
+ */
11
16
  export type RenderCallback<TagName extends CustomElementTagName = any, Inputs extends PropertyInitMapBase = any, StateInit 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, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => HtmlInterpolation;
12
- export type InitCallback<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, StateInit extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = (params: RenderParams<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => void;
17
+ /**
18
+ * Type for the `init` and `cleanup` element definition methods.
19
+ *
20
+ * @category Internal
21
+ */
22
+ export type InitCallback<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, StateInit extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = (params: RenderParams<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => undefined | void;
23
+ /**
24
+ * Type for the `updateState` render parameter.
25
+ *
26
+ * @category Internal
27
+ */
13
28
  export type UpdateStateCallback<StateInit extends PropertyInitMapBase> = (newState: Partial<AllowElementVirStateSetup<StateInit>>) => void;
29
+ /**
30
+ * The full parameters object passed to `render`, `init`, and `cleanup` element definition methods.
31
+ *
32
+ * @category Internal
33
+ */
14
34
  export type RenderParams<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, StateInit extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = {
15
35
  state: Readonly<FlattenElementVirStateSetup<StateInit>>;
16
36
  cssVars: Readonly<CssVars<TagName, CssVarKeys>>;
@@ -18,9 +38,16 @@ export type RenderParams<TagName extends CustomElementTagName, Inputs extends Pr
18
38
  events: EventDescriptorMap<TagName, EventsInit>;
19
39
  host: DeclarativeElementHost<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
20
40
  slotNames: SlotNameMap<SlotNames>;
41
+ /** Dispatch an event from the current element. */
21
42
  dispatch: <EventTypeName extends keyof EventsInit>(event: TypedEvent<EventTypeName extends string ? EventTypeName : never, EventInitMapEventDetailExtractor<EventTypeName, EventsInit>> | Event) => boolean;
22
43
  inputs: Readonly<Inputs>;
23
44
  };
45
+ /**
46
+ * This is used to create the parameters passed to the `render`, `init`, and `cleanup` element
47
+ * definition methods whenever they are called.
48
+ *
49
+ * @category Internal
50
+ */
24
51
  export declare function createRenderParams<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, StateInit extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>>({ element, eventsMap, cssVars, slotNamesMap, }: {
25
52
  element: DeclarativeElement<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
26
53
  eventsMap: EventDescriptorMap<TagName, EventsInit>;
@@ -1,4 +1,10 @@
1
1
  import { getObjectTypedKeys } from '@augment-vir/common';
2
+ /**
3
+ * This is used to create the parameters passed to the `render`, `init`, and `cleanup` element
4
+ * definition methods whenever they are called.
5
+ *
6
+ * @category Internal
7
+ */
2
8
  export function createRenderParams({ element, eventsMap, cssVars, slotNamesMap, }) {
3
9
  function updateState(newStatePartial) {
4
10
  getObjectTypedKeys(newStatePartial).forEach((stateKey) => {
@@ -1,7 +1,15 @@
1
1
  import { ArrayElement } from '@augment-vir/common';
2
- /** Type safe mapping of slot names to themselves. */
2
+ /**
3
+ * Type safe mapping of slot names to themselves.
4
+ *
5
+ * @category Internal
6
+ */
3
7
  export type SlotNameMap<SlotNames extends ReadonlyArray<string>> = Readonly<{
4
8
  [SlotName in ArrayElement<SlotNames>]: SlotName;
5
9
  }>;
6
- /** Converts an array of slot names into a `SlotNameMap`. */
10
+ /**
11
+ * Converts an array of slot names into a `SlotNameMap`.
12
+ *
13
+ * @category Internal
14
+ */
7
15
  export declare function createSlotNamesMap<SlotNames extends ReadonlyArray<string>>(slotNames: SlotNames | undefined): SlotNameMap<SlotNames>;
@@ -1,4 +1,8 @@
1
- /** Converts an array of slot names into a `SlotNameMap`. */
1
+ /**
2
+ * Converts an array of slot names into a `SlotNameMap`.
3
+ *
4
+ * @category Internal
5
+ */
2
6
  export function createSlotNamesMap(slotNames) {
3
7
  if (!slotNames) {
4
8
  return {};
@@ -1,16 +1,43 @@
1
- import { PartialAndNullable } from '@augment-vir/common';
2
- import { CustomElementTagName } from './custom-tag-name';
3
- import { DeclarativeElementInit } from './declarative-element-init';
4
- import { VerifiedElementInit } from './define-element';
5
- import { VerifiedElementNoInputsInit } from './define-element-no-inputs';
6
- import { BaseCssPropertyName } from './properties/css-properties';
7
- import { EventsInitMap } from './properties/element-events';
8
- import { PropertyInitMapBase } from './properties/element-properties';
9
- export type WrapDefineElementOptions<TagNameRequirement extends CustomElementTagName = CustomElementTagName, InputsRequirement extends PropertyInitMapBase = {}, StateInitRequirement extends PropertyInitMapBase = {}, EventsInitRequirement extends EventsInitMap = {}> = PartialAndNullable<{
1
+ import { PartialWithNullable } from '@augment-vir/common';
2
+ import { CustomElementTagName } from './custom-tag-name.js';
3
+ import { DeclarativeElementInit } from './declarative-element-init.js';
4
+ import { VerifiedElementNoInputsInit } from './define-element-no-inputs.js';
5
+ import { VerifiedElementInit } from './define-element.js';
6
+ import { BaseCssPropertyName } from './properties/css-properties.js';
7
+ import { EventsInitMap } from './properties/element-events.js';
8
+ import { PropertyInitMapBase } from './properties/element-properties.js';
9
+ /**
10
+ * Options for {@link wrapDefineElement}.
11
+ *
12
+ * @category Internal
13
+ */
14
+ export type WrapDefineElementOptions<TagNameRequirement extends CustomElementTagName = CustomElementTagName, InputsRequirement extends PropertyInitMapBase = {}, StateInitRequirement extends PropertyInitMapBase = {}, EventsInitRequirement extends EventsInitMap = {}> = PartialWithNullable<{
15
+ /**
16
+ * An optional callback which asserts that an element definition init object given to the
17
+ * wrapped element definition functions is valid.
18
+ */
10
19
  assertInputs: (inputInit: DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateInitRequirement, EventsInitRequirement, BaseCssPropertyName<TagNameRequirement>, BaseCssPropertyName<TagNameRequirement>, ReadonlyArray<string>>) => void;
20
+ /**
21
+ * An optional callback which transforms a element definition init object given to the wrapped
22
+ * element definition.
23
+ */
11
24
  transformInputs: (inputInit: DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateInitRequirement, EventsInitRequirement, BaseCssPropertyName<TagNameRequirement>, BaseCssPropertyName<TagNameRequirement>, ReadonlyArray<string>>) => DeclarativeElementInit<TagNameRequirement, InputsRequirement, StateInitRequirement, EventsInitRequirement, BaseCssPropertyName<TagNameRequirement>, BaseCssPropertyName<TagNameRequirement>, ReadonlyArray<string>>;
12
25
  }>;
26
+ /**
27
+ * Wraps {@link defineElement} and {@link defineElementNoInputs} in a superset of requirements. For
28
+ * example:
29
+ *
30
+ * - You could create element definition functions that require all elements to start with a common
31
+ * prefix, like `vir-`.
32
+ * - You could create element definition functions that require all elements to have _at least_ a
33
+ * specified set of input properties.
34
+ * - Etc.
35
+ *
36
+ * @category Element Definition
37
+ */
13
38
  export declare function wrapDefineElement<TagNameRequirement extends CustomElementTagName = CustomElementTagName, InputsRequirement extends PropertyInitMapBase = {}, StateInitRequirement extends PropertyInitMapBase = {}, EventsInitRequirement extends EventsInitMap = {}>(options?: WrapDefineElementOptions | undefined): {
14
- defineElement: <Inputs extends InputsRequirement>() => <const TagName extends TagNameRequirement, StateInit extends StateInitRequirement, EventsInit extends EventsInitRequirement, const HostClassKeys extends `${TagName}-${string}`, const CssVarKeys extends `${TagName}-${string}`, const SlotNames extends readonly string[]>(inputs: VerifiedElementInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("./declarative-element").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
15
- defineElementNoInputs: <const TagName_1 extends TagNameRequirement, Inputs_1 extends InputsRequirement, StateInit_1 extends StateInitRequirement, EventsInit_1 extends EventsInitRequirement, const HostClassKeys_1 extends `${TagName_1}-${string}`, const CssVarKeys_1 extends `${TagName_1}-${string}`, const SlotNames_1 extends readonly string[]>(inputs: VerifiedElementNoInputsInit<TagName_1, Inputs_1, StateInit_1, EventsInit_1, HostClassKeys_1, CssVarKeys_1, SlotNames_1>) => import("./declarative-element").DeclarativeElementDefinition<TagName_1, Inputs_1, StateInit_1, EventsInit_1, HostClassKeys_1, CssVarKeys_1, SlotNames_1>;
39
+ /** A wrapped function for defining an element with inputs. */
40
+ defineElement: <Inputs extends InputsRequirement>() => <const TagName extends TagNameRequirement, StateInit extends StateInitRequirement, EventsInit extends EventsInitRequirement, const HostClassKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: VerifiedElementInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("./declarative-element.js").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
41
+ /** A wrapped function for defining an element without inputs. */
42
+ defineElementNoInputs: <const TagName extends TagNameRequirement, Inputs extends InputsRequirement, StateInit extends StateInitRequirement, EventsInit extends EventsInitRequirement, const HostClassKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: VerifiedElementNoInputsInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("./declarative-element.js").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
16
43
  };
@@ -1,17 +1,32 @@
1
- import { defineElement } from './define-element';
2
- import { defineElementNoInputs } from './define-element-no-inputs';
1
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
2
+ import { defineElementNoInputs } from './define-element-no-inputs.js';
3
+ import { defineElement } from './define-element.js';
4
+ /**
5
+ * Wraps {@link defineElement} and {@link defineElementNoInputs} in a superset of requirements. For
6
+ * example:
7
+ *
8
+ * - You could create element definition functions that require all elements to start with a common
9
+ * prefix, like `vir-`.
10
+ * - You could create element definition functions that require all elements to have _at least_ a
11
+ * specified set of input properties.
12
+ * - Etc.
13
+ *
14
+ * @category Element Definition
15
+ */
3
16
  export function wrapDefineElement(options) {
4
17
  const { assertInputs, transformInputs } = {
5
18
  assertInputs: options?.assertInputs ?? (() => { }),
6
19
  transformInputs: options?.transformInputs ?? ((inputs) => inputs),
7
20
  };
8
21
  return {
22
+ /** A wrapped function for defining an element with inputs. */
9
23
  defineElement: () => {
10
24
  return (inputs) => {
11
25
  assertInputs(inputs);
12
26
  return defineElement()(transformInputs(inputs));
13
27
  };
14
28
  },
29
+ /** A wrapped function for defining an element without inputs. */
15
30
  defineElementNoInputs: (inputs) => {
16
31
  assertInputs(inputs);
17
32
  return defineElementNoInputs(transformInputs(inputs));
package/dist/index.d.ts CHANGED
@@ -1,41 +1,41 @@
1
1
  export * from 'observavir';
2
- export * from './declarative-element/custom-tag-name';
3
- export * from './declarative-element/declarative-element';
4
- export * from './declarative-element/declarative-element-init';
5
- export * from './declarative-element/define-element';
6
- export * from './declarative-element/define-element-no-inputs';
7
- export type { DeclarativeElementDefinitionOptions } from './declarative-element/definition-options';
8
- export * from './declarative-element/directives/async-prop';
9
- export * from './declarative-element/directives/create-attribute-directive';
10
- export * from './declarative-element/directives/directive-helpers';
11
- export * from './declarative-element/directives/is-resolved.directive';
12
- export * from './declarative-element/directives/listen.directive';
13
- export * from './declarative-element/directives/on-dom-created.directive';
14
- export * from './declarative-element/directives/on-dom-rendered.directive';
15
- export * from './declarative-element/directives/on-resize.directive';
16
- export * from './declarative-element/directives/render-async.directive';
17
- export * from './declarative-element/directives/render-if.directive';
18
- export * from './declarative-element/directives/test-id.directive';
19
- export * from './declarative-element/is-declarative-element';
20
- export * from './declarative-element/is-declarative-element-definition';
21
- export * from './declarative-element/properties/css-properties';
22
- export * from './declarative-element/properties/css-vars';
23
- export * from './declarative-element/properties/element-events';
24
- export * from './declarative-element/properties/element-properties';
25
- export * from './declarative-element/properties/element-vir-state-setup';
26
- export * from './declarative-element/properties/host-classes';
27
- export * from './declarative-element/properties/per-instance';
28
- export * from './declarative-element/properties/styles';
29
- export * from './declarative-element/properties/tag-name';
30
- export * from './declarative-element/render-callback';
31
- export * from './declarative-element/slot-names';
32
- export * from './declarative-element/wrap-define-element';
33
- export * from './lit-exports/all-lit-exports';
34
- export { requireAllCustomElementsToBeDeclarativeElements } from './require-declarative-element';
35
- export * from './template-transforms/minimal-element-definition';
36
- export * from './template-transforms/vir-css/vir-css';
37
- export * from './template-transforms/vir-html/html-interpolation';
38
- export * from './template-transforms/vir-html/vir-html';
39
- export * from './typed-event/typed-event';
40
- export * from './util/lit-template';
41
- export * from './util/type';
2
+ export * from './declarative-element/custom-tag-name.js';
3
+ export * from './declarative-element/declarative-element-init.js';
4
+ export * from './declarative-element/declarative-element.js';
5
+ export * from './declarative-element/define-element-no-inputs.js';
6
+ export * from './declarative-element/define-element.js';
7
+ export * from './declarative-element/definition-options.js';
8
+ export * from './declarative-element/directives/async-prop.js';
9
+ export * from './declarative-element/directives/create-attribute-directive.js';
10
+ export * from './declarative-element/directives/directive-helpers.js';
11
+ export * from './declarative-element/directives/is-resolved.directive.js';
12
+ export * from './declarative-element/directives/listen.directive.js';
13
+ export * from './declarative-element/directives/on-dom-created.directive.js';
14
+ export * from './declarative-element/directives/on-dom-rendered.directive.js';
15
+ export * from './declarative-element/directives/on-resize.directive.js';
16
+ export * from './declarative-element/directives/render-async.directive.js';
17
+ export * from './declarative-element/directives/render-if.directive.js';
18
+ export * from './declarative-element/directives/test-id.directive.js';
19
+ export * from './declarative-element/is-declarative-element-definition.js';
20
+ export * from './declarative-element/is-declarative-element.js';
21
+ export * from './declarative-element/properties/css-properties.js';
22
+ export * from './declarative-element/properties/css-vars.js';
23
+ export * from './declarative-element/properties/element-events.js';
24
+ export * from './declarative-element/properties/element-properties.js';
25
+ export * from './declarative-element/properties/element-vir-state-setup.js';
26
+ export * from './declarative-element/properties/host-classes.js';
27
+ export * from './declarative-element/properties/per-instance.js';
28
+ export * from './declarative-element/properties/styles.js';
29
+ export * from './declarative-element/properties/tag-name.js';
30
+ export * from './declarative-element/render-callback.js';
31
+ export * from './declarative-element/slot-names.js';
32
+ export * from './declarative-element/wrap-define-element.js';
33
+ export * from './lit-exports/all-lit-exports.js';
34
+ export * from './require-declarative-element.js';
35
+ export * from './template-transforms/minimal-element-definition.js';
36
+ export * from './template-transforms/vir-css/vir-css.js';
37
+ export * from './template-transforms/vir-html/html-interpolation.js';
38
+ export * from './template-transforms/vir-html/vir-html.js';
39
+ export * from './typed-event/typed-event.js';
40
+ export * from './util/lit-template.js';
41
+ export * from './util/type.js';
package/dist/index.js CHANGED
@@ -1,40 +1,41 @@
1
1
  export * from 'observavir';
2
- export * from './declarative-element/custom-tag-name';
3
- export * from './declarative-element/declarative-element';
4
- export * from './declarative-element/declarative-element-init';
5
- export * from './declarative-element/define-element';
6
- export * from './declarative-element/define-element-no-inputs';
7
- export * from './declarative-element/directives/async-prop';
8
- export * from './declarative-element/directives/create-attribute-directive';
9
- export * from './declarative-element/directives/directive-helpers';
10
- export * from './declarative-element/directives/is-resolved.directive';
11
- export * from './declarative-element/directives/listen.directive';
12
- export * from './declarative-element/directives/on-dom-created.directive';
13
- export * from './declarative-element/directives/on-dom-rendered.directive';
14
- export * from './declarative-element/directives/on-resize.directive';
15
- export * from './declarative-element/directives/render-async.directive';
16
- export * from './declarative-element/directives/render-if.directive';
17
- export * from './declarative-element/directives/test-id.directive';
18
- export * from './declarative-element/is-declarative-element';
19
- export * from './declarative-element/is-declarative-element-definition';
20
- export * from './declarative-element/properties/css-properties';
21
- export * from './declarative-element/properties/css-vars';
22
- export * from './declarative-element/properties/element-events';
23
- export * from './declarative-element/properties/element-properties';
24
- export * from './declarative-element/properties/element-vir-state-setup';
25
- export * from './declarative-element/properties/host-classes';
26
- export * from './declarative-element/properties/per-instance';
27
- export * from './declarative-element/properties/styles';
28
- export * from './declarative-element/properties/tag-name';
29
- export * from './declarative-element/render-callback';
30
- export * from './declarative-element/slot-names';
31
- export * from './declarative-element/wrap-define-element';
32
- export * from './lit-exports/all-lit-exports';
33
- export { requireAllCustomElementsToBeDeclarativeElements } from './require-declarative-element';
34
- export * from './template-transforms/minimal-element-definition';
35
- export * from './template-transforms/vir-css/vir-css';
36
- export * from './template-transforms/vir-html/html-interpolation';
37
- export * from './template-transforms/vir-html/vir-html';
38
- export * from './typed-event/typed-event';
39
- export * from './util/lit-template';
40
- export * from './util/type';
2
+ export * from './declarative-element/custom-tag-name.js';
3
+ export * from './declarative-element/declarative-element-init.js';
4
+ export * from './declarative-element/declarative-element.js';
5
+ export * from './declarative-element/define-element-no-inputs.js';
6
+ export * from './declarative-element/define-element.js';
7
+ export * from './declarative-element/definition-options.js';
8
+ export * from './declarative-element/directives/async-prop.js';
9
+ export * from './declarative-element/directives/create-attribute-directive.js';
10
+ export * from './declarative-element/directives/directive-helpers.js';
11
+ export * from './declarative-element/directives/is-resolved.directive.js';
12
+ export * from './declarative-element/directives/listen.directive.js';
13
+ export * from './declarative-element/directives/on-dom-created.directive.js';
14
+ export * from './declarative-element/directives/on-dom-rendered.directive.js';
15
+ export * from './declarative-element/directives/on-resize.directive.js';
16
+ export * from './declarative-element/directives/render-async.directive.js';
17
+ export * from './declarative-element/directives/render-if.directive.js';
18
+ export * from './declarative-element/directives/test-id.directive.js';
19
+ export * from './declarative-element/is-declarative-element-definition.js';
20
+ export * from './declarative-element/is-declarative-element.js';
21
+ export * from './declarative-element/properties/css-properties.js';
22
+ export * from './declarative-element/properties/css-vars.js';
23
+ export * from './declarative-element/properties/element-events.js';
24
+ export * from './declarative-element/properties/element-properties.js';
25
+ export * from './declarative-element/properties/element-vir-state-setup.js';
26
+ export * from './declarative-element/properties/host-classes.js';
27
+ export * from './declarative-element/properties/per-instance.js';
28
+ export * from './declarative-element/properties/styles.js';
29
+ export * from './declarative-element/properties/tag-name.js';
30
+ export * from './declarative-element/render-callback.js';
31
+ export * from './declarative-element/slot-names.js';
32
+ export * from './declarative-element/wrap-define-element.js';
33
+ export * from './lit-exports/all-lit-exports.js';
34
+ export * from './require-declarative-element.js';
35
+ export * from './template-transforms/minimal-element-definition.js';
36
+ export * from './template-transforms/vir-css/vir-css.js';
37
+ export * from './template-transforms/vir-html/html-interpolation.js';
38
+ export * from './template-transforms/vir-html/vir-html.js';
39
+ export * from './typed-event/typed-event.js';
40
+ export * from './util/lit-template.js';
41
+ export * from './util/type.js';
@@ -1,2 +1,2 @@
1
- export * from './base-lit-exports';
2
- export * from './lit-repeat-fix';
1
+ export * from './base-lit-exports.js';
2
+ export * from './lit-repeat-fix.js';
@@ -1,2 +1,2 @@
1
- export * from './base-lit-exports';
2
- export * from './lit-repeat-fix';
1
+ export * from './base-lit-exports.js';
2
+ export * from './lit-repeat-fix.js';
@@ -1,25 +1,81 @@
1
1
  export type { KeyFn } from 'lit/directives/repeat.js';
2
2
  export type { RepeatDirective };
3
- import { Directive, PartInfo } from 'lit-html/directive.js';
4
- import { KeyFn } from 'lit-html/directives/repeat.js';
5
- import { ChildPart, noChange } from 'lit-html/lit-html.js';
6
- import { HtmlInterpolation } from '../template-transforms/vir-html/html-interpolation';
3
+ import { type Directive, type PartInfo } from 'lit-html/directive.js';
4
+ import { type KeyFn } from 'lit-html/directives/repeat.js';
5
+ import { type ChildPart, type noChange } from 'lit-html/lit-html.js';
6
+ import { type HtmlInterpolation } from '../template-transforms/vir-html/html-interpolation.js';
7
+ /**
8
+ * A modified class type for the built-in lit `repeat` directive which works for element-vir
9
+ * declarative elements.
10
+ *
11
+ * @category Internal
12
+ */
7
13
  declare class RepeatDirective extends Directive {
8
14
  private _itemKeys?;
9
15
  constructor(partInfo: PartInfo);
10
16
  private _getValuesAndKeys;
17
+ /** Renders the repeated templates. */
11
18
  render<T>(items: Iterable<T>, template: ItemTemplate<T>): Array<HtmlInterpolation>;
19
+ /** Renders the repeated templates. */
12
20
  render<T>(items: Iterable<T>, keyFn: KeyFn<T> | ItemTemplate<T>, template: ItemTemplate<T>): Array<HtmlInterpolation>;
21
+ /** Updates the repeated templates. */
13
22
  update<T>(containerPart: ChildPart, [items, keyFnOrTemplate, template,]: [
14
23
  Iterable<T>,
15
24
  (KeyFn<T> | ItemTemplate<T>),
16
25
  ItemTemplate<T>
17
26
  ]): HtmlInterpolation[] | typeof noChange;
18
27
  }
28
+ /**
29
+ * A modified `ItemTemplate` type for the built-in lit `repeat` directive which works for
30
+ * element-vir declarative elements.
31
+ *
32
+ * @category Internal
33
+ */
19
34
  export type ItemTemplate<T> = (item: T, index: number) => HtmlInterpolation;
35
+ /**
36
+ * A modified `RepeatDirectiveFn` type for the built-in lit `repeat` directive which works for
37
+ * element-vir declarative elements.
38
+ *
39
+ * @category Internal
40
+ */
20
41
  export interface RepeatDirectiveFn {
21
42
  <T>(items: Iterable<T>, keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>, template?: ItemTemplate<T>): HtmlInterpolation[];
22
43
  <T>(items: Iterable<T>, template: ItemTemplate<T>): HtmlInterpolation[];
23
44
  <T>(items: Iterable<T>, keyFn: KeyFn<T> | ItemTemplate<T>, template: ItemTemplate<T>): HtmlInterpolation[];
24
45
  }
46
+ /**
47
+ * A directive that repeats a series of values (usually `TemplateResults`) generated from an
48
+ * iterable, and updates those items efficiently when the iterable changes based on user-provided
49
+ * `keys` associated with each item.
50
+ *
51
+ * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained, meaning previous DOM
52
+ * for a given key is moved into the new position if needed, and DOM will never be reused with
53
+ * values for different keys (new DOM will always be created for new keys). This is generally the
54
+ * most efficient way to use `repeat` since it performs minimum unnecessary work for insertions and
55
+ * removals.
56
+ *
57
+ * The `keyFn` takes two parameters, the item and its index, and returns a unique key value.
58
+ *
59
+ * ```js
60
+ * html`
61
+ * <ol>
62
+ * ${repeat(
63
+ * this.items,
64
+ * (item) => item.id,
65
+ * (item, index) => {
66
+ * return html`
67
+ * <li>${index}: ${item.name}</li>
68
+ * `;
69
+ * },
70
+ * )}
71
+ * </ol>
72
+ * `;
73
+ * ```
74
+ *
75
+ * **Important**: If providing a `keyFn`, keys _must_ be unique for all items in a given call to
76
+ * `repeat`. The behavior when two or more items have the same key is undefined.
77
+ *
78
+ * If no `keyFn` is provided, this directive will perform similar to mapping items to values, and
79
+ * DOM will be reused against potentially different items.
80
+ */
25
81
  export declare const repeat: RepeatDirectiveFn;
@@ -1,3 +1,37 @@
1
- import { Directive } from 'lit-html/directive.js';
2
1
  import { repeat as repeatImport } from 'lit/directives/repeat.js';
2
+ /**
3
+ * A directive that repeats a series of values (usually `TemplateResults`) generated from an
4
+ * iterable, and updates those items efficiently when the iterable changes based on user-provided
5
+ * `keys` associated with each item.
6
+ *
7
+ * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained, meaning previous DOM
8
+ * for a given key is moved into the new position if needed, and DOM will never be reused with
9
+ * values for different keys (new DOM will always be created for new keys). This is generally the
10
+ * most efficient way to use `repeat` since it performs minimum unnecessary work for insertions and
11
+ * removals.
12
+ *
13
+ * The `keyFn` takes two parameters, the item and its index, and returns a unique key value.
14
+ *
15
+ * ```js
16
+ * html`
17
+ * <ol>
18
+ * ${repeat(
19
+ * this.items,
20
+ * (item) => item.id,
21
+ * (item, index) => {
22
+ * return html`
23
+ * <li>${index}: ${item.name}</li>
24
+ * `;
25
+ * },
26
+ * )}
27
+ * </ol>
28
+ * `;
29
+ * ```
30
+ *
31
+ * **Important**: If providing a `keyFn`, keys _must_ be unique for all items in a given call to
32
+ * `repeat`. The behavior when two or more items have the same key is undefined.
33
+ *
34
+ * If no `keyFn` is provided, this directive will perform similar to mapping items to values, and
35
+ * DOM will be reused against potentially different items.
36
+ */
3
37
  export const repeat = repeatImport;
@@ -0,0 +1 @@
1
+ export declare const MyApp: import("../index.js").DeclarativeElementDefinition<"my-app", {}, {}, {}, "my-app-", "my-app-", readonly []>;
@@ -0,0 +1,11 @@
1
+ import { defineElementNoInputs, html } from '../index.js';
2
+ import { MySimple } from './my-simple.element.js';
3
+ export const MyApp = defineElementNoInputs({
4
+ tagName: 'my-app',
5
+ render() {
6
+ return html `
7
+ <h1>My App</h1>
8
+ <${MySimple}></${MySimple}>
9
+ `;
10
+ },
11
+ });
@@ -0,0 +1 @@
1
+ export declare const MyCustomActionEvent: import("../index.js").DefinedTypedEvent<"my-custom-action", number>;
@@ -0,0 +1,2 @@
1
+ import { defineTypedEvent } from '../index.js';
2
+ export const MyCustomActionEvent = defineTypedEvent()('my-custom-action');
@@ -0,0 +1,4 @@
1
+ export type VirTagName = `vir-${string}`;
2
+ export declare const defineVirElement: <Inputs extends {}>() => <const TagName extends `vir-${string}`, StateInit extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: import("../index.js").VerifiedElementInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>, defineVirElementNoInputs: <const TagName extends `vir-${string}`, Inputs extends {}, StateInit extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: import("../index.js").VerifiedElementNoInputsInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
3
+ export declare const defineVerifiedVirElement: <Inputs extends {}>() => <const TagName extends `vir-${string}`, StateInit extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: import("../index.js").VerifiedElementInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>, defineVerifiedVirElementNoInputs: <const TagName extends `vir-${string}`, Inputs extends {}, StateInit extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: import("../index.js").VerifiedElementNoInputsInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
4
+ export declare const defineTransformedVirElement: <Inputs extends {}>() => <const TagName extends `vir-${string}`, StateInit extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: import("../index.js").VerifiedElementInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>, defineTransformedVirElementNoInputs: <const TagName extends `vir-${string}`, Inputs extends {}, StateInit extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: import("../index.js").VerifiedElementNoInputsInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("../index.js").DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
@@ -0,0 +1,19 @@
1
+ import { wrapDefineElement } from '../index.js';
2
+ export const { defineElement: defineVirElement, defineElementNoInputs: defineVirElementNoInputs } = wrapDefineElement();
3
+ // add an optional assert callback
4
+ export const { defineElement: defineVerifiedVirElement, defineElementNoInputs: defineVerifiedVirElementNoInputs, } = wrapDefineElement({
5
+ assertInputs: (inputs) => {
6
+ if (!inputs.tagName.startsWith('vir-')) {
7
+ throw new Error(`all custom elements must start with "vir-"`);
8
+ }
9
+ },
10
+ });
11
+ // add an optional transform callback
12
+ export const { defineElement: defineTransformedVirElement, defineElementNoInputs: defineTransformedVirElementNoInputs, } = wrapDefineElement({
13
+ transformInputs: (inputs) => {
14
+ return {
15
+ ...inputs,
16
+ tagName: inputs.tagName.startsWith('vir-') ? `vir-${inputs.tagName}` : inputs.tagName,
17
+ };
18
+ },
19
+ });
@@ -0,0 +1 @@
1
+ export declare const MySimple: import("../index.js").DeclarativeElementDefinition<"my-simple", {}, {}, {}, "my-simple-", "my-simple-", readonly []>;
@@ -0,0 +1,9 @@
1
+ import { defineElementNoInputs, html } from '../index.js';
2
+ export const MySimple = defineElementNoInputs({
3
+ tagName: 'my-simple',
4
+ render() {
5
+ return html `
6
+ <span>Hello there!</span>
7
+ `;
8
+ },
9
+ });
@@ -0,0 +1 @@
1
+ export declare const MyWithAssignment: import("../index.js").DeclarativeElementDefinition<"my-with-assignment", {}, {}, {}, "my-with-assignment-", "my-with-assignment-", readonly []>;
@@ -0,0 +1,14 @@
1
+ import { defineElementNoInputs, html } from '../index.js';
2
+ import { MyWithInputs } from './my-with-inputs.element.js';
3
+ export const MyWithAssignment = defineElementNoInputs({
4
+ tagName: 'my-with-assignment',
5
+ render() {
6
+ return html `
7
+ <h1>My App</h1>
8
+ <${MyWithInputs.assign({
9
+ email: 'user@example.com',
10
+ username: 'user',
11
+ })}></${MyWithInputs}>
12
+ `;
13
+ },
14
+ });
@@ -0,0 +1,9 @@
1
+ type EndpointData = number[];
2
+ export declare const MyWithAsyncProp: import("../index.js").DeclarativeElementDefinition<"my-with-async-prop", {
3
+ endpoint: string;
4
+ }, {
5
+ data: import("../index.js").ElementVirStateSetup<import("../index.js").AsyncProp<EndpointData, {
6
+ endpoint: string;
7
+ }>>;
8
+ }, {}, "my-with-async-prop-", "my-with-async-prop-", readonly []>;
9
+ export {};