element-vir 25.10.0 → 25.12.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 (55) hide show
  1. package/README.md +52 -44
  2. package/dist/declarative-element/define-element-no-inputs.d.ts +2 -15
  3. package/dist/declarative-element/define-element-no-inputs.js +2 -15
  4. package/dist/declarative-element/define-element.d.ts +2 -3
  5. package/dist/declarative-element/define-element.js +4 -3
  6. package/dist/declarative-element/directives/listen.directive.d.ts +4 -4
  7. package/dist/declarative-element/directives/on-dom-created.directive.d.ts +2 -2
  8. package/dist/declarative-element/directives/on-dom-created.directive.js +2 -2
  9. package/dist/declarative-element/directives/on-dom-rendered.directive.d.ts +2 -2
  10. package/dist/declarative-element/directives/on-dom-rendered.directive.js +2 -2
  11. package/dist/declarative-element/directives/on-intersect.directive.d.ts +2 -2
  12. package/dist/declarative-element/directives/on-intersect.directive.js +2 -2
  13. package/dist/declarative-element/directives/on-resize.directive.d.ts +2 -2
  14. package/dist/declarative-element/directives/on-resize.directive.js +2 -2
  15. package/dist/declarative-element/directives/render-if.directive.d.ts +2 -2
  16. package/dist/declarative-element/directives/render-if.directive.js +2 -2
  17. package/dist/declarative-element/directives/test-id.directive.d.ts +2 -2
  18. package/dist/declarative-element/directives/test-id.directive.js +2 -2
  19. package/dist/declarative-element/properties/element-events.d.ts +2 -2
  20. package/dist/declarative-element/properties/element-events.js +2 -2
  21. package/dist/declarative-element/wrap-define-element.d.ts +6 -3
  22. package/dist/declarative-element/wrap-define-element.js +9 -4
  23. package/dist/readme-examples/my-app.element.d.ts +1 -1
  24. package/dist/readme-examples/my-app.element.js +3 -2
  25. package/dist/readme-examples/my-custom-define.d.ts +3 -3
  26. package/dist/readme-examples/my-custom-define.js +3 -3
  27. package/dist/readme-examples/my-simple.element.d.ts +1 -1
  28. package/dist/readme-examples/my-simple.element.js +3 -2
  29. package/dist/readme-examples/my-with-assignment.element.d.ts +1 -1
  30. package/dist/readme-examples/my-with-assignment.element.js +3 -2
  31. package/dist/readme-examples/my-with-cleanup-callback.element.d.ts +1 -1
  32. package/dist/readme-examples/my-with-cleanup-callback.element.js +3 -2
  33. package/dist/readme-examples/my-with-css-vars.element.d.ts +1 -1
  34. package/dist/readme-examples/my-with-css-vars.element.js +3 -2
  35. package/dist/readme-examples/my-with-custom-events.element.d.ts +1 -1
  36. package/dist/readme-examples/my-with-custom-events.element.js +3 -2
  37. package/dist/readme-examples/my-with-event-listening.element.d.ts +1 -1
  38. package/dist/readme-examples/my-with-event-listening.element.js +3 -2
  39. package/dist/readme-examples/my-with-events.element.d.ts +3 -3
  40. package/dist/readme-examples/my-with-events.element.js +3 -2
  41. package/dist/readme-examples/my-with-host-class-definition.element.d.ts +1 -1
  42. package/dist/readme-examples/my-with-host-class-definition.element.js +3 -2
  43. package/dist/readme-examples/my-with-host-class-usage.element.d.ts +1 -1
  44. package/dist/readme-examples/my-with-host-class-usage.element.js +3 -2
  45. package/dist/readme-examples/my-with-on-dom-created.element.d.ts +1 -1
  46. package/dist/readme-examples/my-with-on-dom-created.element.js +3 -2
  47. package/dist/readme-examples/my-with-on-resize.element.d.ts +1 -1
  48. package/dist/readme-examples/my-with-on-resize.element.js +3 -2
  49. package/dist/readme-examples/my-with-styles-and-interpolated-selector.element.d.ts +1 -1
  50. package/dist/readme-examples/my-with-styles-and-interpolated-selector.element.js +3 -2
  51. package/dist/readme-examples/my-with-styles.element.d.ts +1 -1
  52. package/dist/readme-examples/my-with-styles.element.js +3 -2
  53. package/dist/readme-examples/my-with-update-state.element.d.ts +1 -1
  54. package/dist/readme-examples/my-with-update-state.element.js +3 -2
  55. package/package.json +5 -5
package/README.md CHANGED
@@ -30,20 +30,21 @@ Make sure to install this as a normal dependency (not just a dev dependency) bec
30
30
 
31
31
  # Usage
32
32
 
33
- Most usage of this package is done through the `defineElement` or `defineElementNoInputs` functions. See the [`DeclarativeElementInit`](https://github.com/electrovir/element-vir/blob/dev/packages/src/declarative-element/declarative-element-init.ts) type for that function's full inputs. The inputs are also described below with examples.
33
+ Most usage of this package is done through the `defineElement` functions. See the [`DeclarativeElementInit`](https://github.com/electrovir/element-vir/blob/dev/packages/src/declarative-element/declarative-element-init.ts) type for that function's full inputs. The inputs are also described below with examples.
34
34
 
35
35
  All of [`lit`](https://lit.dev)'s syntax and functionality is available for use if you wish.
36
36
 
37
37
  ## Simple element definition
38
38
 
39
- Use `defineElementNoInputs` to define your element if it's not going to accept any inputs (or if you're just getting started). It's only input is an object with at least `tagName` and `render` properties (the types enforce this). Here is a bare-minimum example custom element:
39
+ Use `defineElement` to define your element. Here is a bare-minimum example custom element:
40
40
 
41
41
  <!-- example-link: src/readme-examples/my-simple.element.ts -->
42
42
 
43
43
  ```TypeScript
44
- import {defineElementNoInputs, html} from 'element-vir';
44
+ import {defineElement} from 'element-vir';
45
+ import {html} from 'element-vir';
45
46
 
46
- export const MySimple = defineElementNoInputs({
47
+ export const MySimple = defineElement()({
47
48
  tagName: 'my-simple',
48
49
  render() {
49
50
  return html`
@@ -62,10 +63,11 @@ To use already defined elements (like the example above), they must be interpola
62
63
  <!-- example-link: src/readme-examples/my-app.element.ts -->
63
64
 
64
65
  ```TypeScript
65
- import {defineElementNoInputs, html} from 'element-vir';
66
+ import {defineElement} from 'element-vir';
67
+ import {html} from 'element-vir';
66
68
  import {MySimple} from './my-simple.element.js';
67
69
 
68
- export const MyApp = defineElementNoInputs({
70
+ export const MyApp = defineElement()({
69
71
  tagName: 'my-app',
70
72
  render() {
71
73
  return html`
@@ -85,9 +87,10 @@ Styles are added through the `styles` property when defining a declarative eleme
85
87
  <!-- example-link: src/readme-examples/my-with-styles.element.ts -->
86
88
 
87
89
  ```TypeScript
88
- import {css, defineElementNoInputs, html} from 'element-vir';
90
+ import {defineElement} from 'element-vir';
91
+ import {css, html} from 'element-vir';
89
92
 
90
- export const MyWithStyles = defineElementNoInputs({
93
+ export const MyWithStyles = defineElement()({
91
94
  tagName: 'my-with-styles',
92
95
  styles: css`
93
96
  :host {
@@ -116,10 +119,11 @@ Declarative element definitions can be used in the `css` tagged template just li
116
119
  <!-- example-link: src/readme-examples/my-with-styles-and-interpolated-selector.element.ts -->
117
120
 
118
121
  ```TypeScript
119
- import {css, defineElementNoInputs, html} from 'element-vir';
122
+ import {defineElement} from 'element-vir';
123
+ import {css, html} from 'element-vir';
120
124
  import {MySimple} from './my-simple.element.js';
121
125
 
122
- export const MyWithStylesAndInterpolatedSelector = defineElementNoInputs({
126
+ export const MyWithStylesAndInterpolatedSelector = defineElement()({
123
127
  tagName: 'my-with-styles-and-interpolated-selector',
124
128
  styles: css`
125
129
  ${MySimple} {
@@ -136,7 +140,7 @@ export const MyWithStylesAndInterpolatedSelector = defineElementNoInputs({
136
140
 
137
141
  ## Defining and using Inputs
138
142
 
139
- Define element inputs by using `defineElement` to define a declarative element. Pass your input type as a generic to the `defineElement` call. Then call _that_ with the normal definition input (like when using `defineElementNoInputs`).
143
+ Define element inputs by using `defineElement` to define a declarative element. Pass your input type, if any, as a generic to the `defineElement` call. Then call _that_ with the normal definition input.
140
144
 
141
145
  To use an element's inputs for use in its template, grab `inputs` from `render`'s parameters and interpolate it into your HTML template:
142
146
 
@@ -165,9 +169,10 @@ Define initial internal state values and types with the `stateInit` property whe
165
169
  <!-- example-link: src/readme-examples/my-with-update-state.element.ts -->
166
170
 
167
171
  ```TypeScript
168
- import {defineElementNoInputs, html, listen} from 'element-vir';
172
+ import {defineElement} from 'element-vir';
173
+ import {html, listen} from 'element-vir';
169
174
 
170
- export const MyWithUpdateState = defineElementNoInputs({
175
+ export const MyWithUpdateState = defineElement()({
171
176
  tagName: 'my-with-update-state',
172
177
  state() {
173
178
  return {
@@ -200,10 +205,11 @@ Use the `assign` directive to assign values to child custom elements inputs:
200
205
  <!-- example-link: src/readme-examples/my-with-assignment.element.ts -->
201
206
 
202
207
  ```TypeScript
203
- import {defineElementNoInputs, html} from 'element-vir';
208
+ import {defineElement} from 'element-vir';
209
+ import {html} from 'element-vir';
204
210
  import {MyWithInputs} from './my-with-inputs.element.js';
205
211
 
206
- export const MyWithAssignment = defineElementNoInputs({
212
+ export const MyWithAssignment = defineElement()({
207
213
  tagName: 'my-with-assignment',
208
214
  render() {
209
215
  return html`
@@ -227,9 +233,10 @@ There are two other callbacks you can define that are sort of similar to lifecyc
227
233
  <!-- example-link: src/readme-examples/my-with-cleanup-callback.element.ts -->
228
234
 
229
235
  ```TypeScript
230
- import {defineElementNoInputs, html} from 'element-vir';
236
+ import {defineElement} from 'element-vir';
237
+ import {html} from 'element-vir';
231
238
 
232
- export const MyWithAssignmentCleanupCallback = defineElementNoInputs({
239
+ export const MyWithAssignmentCleanupCallback = defineElement()({
233
240
  tagName: 'my-with-cleanup-callback',
234
241
  state() {
235
242
  return {
@@ -257,9 +264,10 @@ To dispatch an event, grab `dispatch` and `events` from `render`'s parameters.
257
264
 
258
265
  ```TypeScript
259
266
  import {randomInteger} from '@augment-vir/common';
260
- import {defineElementEvent, defineElementNoInputs, html, listen} from 'element-vir';
267
+ import {defineElement} from 'element-vir';
268
+ import {defineElementEvent, html, listen} from 'element-vir';
261
269
 
262
- export const MyWithEvents = defineElementNoInputs({
270
+ export const MyWithEvents = defineElement()({
263
271
  tagName: 'my-with-events',
264
272
  events: {
265
273
  logoutClick: defineElementEvent<void>(),
@@ -287,10 +295,11 @@ Use the `listen` directive to listen to events emitted by your custom elements:
287
295
  <!-- example-link: src/readme-examples/my-with-event-listening.element.ts -->
288
296
 
289
297
  ```TypeScript
290
- import {defineElementNoInputs, html, listen} from 'element-vir';
298
+ import {defineElement} from 'element-vir';
299
+ import {html, listen} from 'element-vir';
291
300
  import {MyWithEvents} from './my-with-events.element.js';
292
301
 
293
- export const MyWithEventListening = defineElementNoInputs({
302
+ export const MyWithEventListening = defineElement()({
294
303
  tagName: 'my-with-event-listening',
295
304
  state() {
296
305
  return {
@@ -336,10 +345,11 @@ Dispatching a custom event and listening to a custom event is the same as doing
336
345
 
337
346
  ```TypeScript
338
347
  import {randomInteger} from '@augment-vir/common';
339
- import {defineElementNoInputs, html, listen} from 'element-vir';
348
+ import {defineElement} from 'element-vir';
349
+ import {html, listen} from 'element-vir';
340
350
  import {MyCustomActionEvent} from './my-custom-action.event.js';
341
351
 
342
- export const MyWithCustomEvents = defineElementNoInputs({
352
+ export const MyWithCustomEvents = defineElement()({
343
353
  tagName: 'my-with-custom-events',
344
354
  render({dispatch}) {
345
355
  return html`
@@ -375,9 +385,10 @@ Apply host classes in the element's stylesheet by using a callback for the style
375
385
  <!-- example-link: src/readme-examples/my-with-host-class-definition.element.ts -->
376
386
 
377
387
  ```TypeScript
378
- import {css, defineElementNoInputs, html} from 'element-vir';
388
+ import {defineElement} from 'element-vir';
389
+ import {css, html} from 'element-vir';
379
390
 
380
- export const MyWithHostClassDefinition = defineElementNoInputs({
391
+ export const MyWithHostClassDefinition = defineElement()({
381
392
  tagName: 'my-with-host-class-definition',
382
393
  state() {
383
394
  return {
@@ -426,10 +437,11 @@ To apply a host class in a consumer, access the child element's `.hostClasses` p
426
437
  <!-- example-link: src/readme-examples/my-with-host-class-usage.element.ts -->
427
438
 
428
439
  ```TypeScript
429
- import {defineElementNoInputs, html} from 'element-vir';
440
+ import {defineElement} from 'element-vir';
441
+ import {html} from 'element-vir';
430
442
  import {MyWithHostClassDefinition} from './my-with-host-class-definition.element.js';
431
443
 
432
- export const MyWithHostClassUsage = defineElementNoInputs({
444
+ export const MyWithHostClassUsage = defineElement()({
433
445
  tagName: 'my-with-host-class-usage',
434
446
  render() {
435
447
  return html`
@@ -448,9 +460,10 @@ Typed CSS variables are created in a similar manner to host classes:
448
460
  <!-- example-link: src/readme-examples/my-with-css-vars.element.ts -->
449
461
 
450
462
  ```TypeScript
451
- import {css, defineElementNoInputs, html} from 'element-vir';
463
+ import {defineElement} from 'element-vir';
464
+ import {css, html} from 'element-vir';
452
465
 
453
- export const MyWithCssVars = defineElementNoInputs({
466
+ export const MyWithCssVars = defineElement()({
454
467
  tagName: 'my-with-css-vars',
455
468
  cssVars: {
456
469
  /** The value assigned here ('blue') becomes the fallback value for this CSS var. */
@@ -477,7 +490,7 @@ export const MyWithCssVars = defineElementNoInputs({
477
490
 
478
491
  ## Custom Type Requirements
479
492
 
480
- Use `wrapDefineElement` to compose `defineElement` and `defineElementNoInputs`. This is particularly useful to adding restrictions on the element `tagName`, but it can be used for restricting any of the type parameters:
493
+ Use `wrapDefineElement` to compose `defineElement`. This is particularly useful to adding restrictions on the element `tagName`, but it can be used for restricting any of the type parameters:
481
494
 
482
495
  <!-- example-link: src/readme-examples/my-custom-define.ts -->
483
496
 
@@ -486,14 +499,10 @@ import {wrapDefineElement} from 'element-vir';
486
499
 
487
500
  export type VirTagName = `vir-${string}`;
488
501
 
489
- export const {defineElement: defineVirElement, defineElementNoInputs: defineVirElementNoInputs} =
490
- wrapDefineElement<VirTagName>();
502
+ export const {defineElement: defineVirElement} = wrapDefineElement<VirTagName>();
491
503
 
492
504
  // add an optional assert callback
493
- export const {
494
- defineElement: defineVerifiedVirElement,
495
- defineElementNoInputs: defineVerifiedVirElementNoInputs,
496
- } = wrapDefineElement<VirTagName>({
505
+ export const {defineElement: defineVerifiedVirElement} = wrapDefineElement<VirTagName>({
497
506
  assertInputs: (inputs) => {
498
507
  if (!inputs.tagName.startsWith('vir-')) {
499
508
  throw new Error(`all custom elements must start with "vir-"`);
@@ -502,10 +511,7 @@ export const {
502
511
  });
503
512
 
504
513
  // add an optional transform callback
505
- export const {
506
- defineElement: defineTransformedVirElement,
507
- defineElementNoInputs: defineTransformedVirElementNoInputs,
508
- } = wrapDefineElement<VirTagName>({
514
+ export const {defineElement: defineTransformedVirElement} = wrapDefineElement<VirTagName>({
509
515
  transformInputs: (inputs) => {
510
516
  return {
511
517
  ...inputs,
@@ -528,9 +534,10 @@ This triggers only once when the element it's attached to has actually been crea
528
534
  <!-- example-link: src/readme-examples/my-with-on-dom-created.element.ts -->
529
535
 
530
536
  ```TypeScript
531
- import {defineElementNoInputs, html, onDomCreated} from 'element-vir';
537
+ import {defineElement} from 'element-vir';
538
+ import {html, onDomCreated} from 'element-vir';
532
539
 
533
- export const MyWithOnDomCreated = defineElementNoInputs({
540
+ export const MyWithOnDomCreated = defineElement()({
534
541
  tagName: 'my-with-on-dom-created',
535
542
  render() {
536
543
  return html`
@@ -554,9 +561,10 @@ This directive fires its callback whenever the element it's attached to resizes.
554
561
  <!-- example-link: src/readme-examples/my-with-on-resize.element.ts -->
555
562
 
556
563
  ```TypeScript
557
- import {defineElementNoInputs, html, onResize} from 'element-vir';
564
+ import {defineElement} from 'element-vir';
565
+ import {html, onResize} from 'element-vir';
558
566
 
559
- export const MyWithOnResize = defineElementNoInputs({
567
+ export const MyWithOnResize = defineElement()({
560
568
  tagName: 'my-with-on-resize',
561
569
  render() {
562
570
  return html`
@@ -7,20 +7,7 @@ import { type PropertyInitMapBase } from './properties/element-properties.js';
7
7
  /**
8
8
  * Defines an element without any inputs.
9
9
  *
10
- * @category Element Definition
11
- * @example
12
- *
13
- * ```ts
14
- * import {defineElementNoInputs, html} from 'element-vir';
15
- *
16
- * const MyElement = defineElementNoInputs({
17
- * tagName: 'my-element',
18
- * render() {
19
- * return html`
20
- * <p>hi</p>
21
- * `;
22
- * },
23
- * });
24
- * ```
10
+ * @deprecated Use plain `defineElement` instead.
11
+ * @category Internal
25
12
  */
26
13
  export declare function defineElementNoInputs<const TagName extends CustomElementTagName = '-', Inputs extends PropertyInitMapBase = {}, State extends PropertyInitMapBase = {}, EventsInit extends EventsInitMap = {}, const HostClassKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>>(init: DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>): DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
@@ -16,21 +16,8 @@ import { createSlotNamesMap } from './slot-names.js';
16
16
  /**
17
17
  * Defines an element without any inputs.
18
18
  *
19
- * @category Element Definition
20
- * @example
21
- *
22
- * ```ts
23
- * import {defineElementNoInputs, html} from 'element-vir';
24
- *
25
- * const MyElement = defineElementNoInputs({
26
- * tagName: 'my-element',
27
- * render() {
28
- * return html`
29
- * <p>hi</p>
30
- * `;
31
- * },
32
- * });
33
- * ```
19
+ * @deprecated Use plain `defineElement` instead.
20
+ * @category Internal
34
21
  */
35
22
  export function defineElementNoInputs(init) {
36
23
  if (!check.isObject(init)) {
@@ -14,9 +14,8 @@ export type DeclarativeElementInputErrorParams<Inputs extends PropertyInitMapBas
14
14
  'ERROR: Cannot define an element input property that clashes with native HTMLElement properties.'
15
15
  ];
16
16
  /**
17
- * Defines an element with inputs. If the element actually has no inputs, use
18
- * {@link defineElementNoInputs} instead. Note that this function must be called twice, due to
19
- * TypeScript type inference limitations.
17
+ * Defines an element with inputs. Note that this function must be called twice, due to TypeScript
18
+ * type inference limitations.
20
19
  *
21
20
  * @category Element Definition
22
21
  * @example
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-object-type */
2
2
  import { assert, check } from '@augment-vir/assert';
3
+ // eslint-disable-next-line sonarjs/deprecation
3
4
  import { defineElementNoInputs } from './define-element-no-inputs.js';
4
5
  /**
5
- * Defines an element with inputs. If the element actually has no inputs, use
6
- * {@link defineElementNoInputs} instead. Note that this function must be called twice, due to
7
- * TypeScript type inference limitations.
6
+ * Defines an element with inputs. Note that this function must be called twice, due to TypeScript
7
+ * type inference limitations.
8
8
  *
9
9
  * @category Element Definition
10
10
  * @example
@@ -34,6 +34,7 @@ export function defineElement(
34
34
  if (!check.isObject(init)) {
35
35
  throw new TypeError('Cannot define element with non-object init: ${init}');
36
36
  }
37
+ // eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated
37
38
  return defineElementNoInputs({
38
39
  ...init,
39
40
  options: {
@@ -11,9 +11,9 @@ type ListenCallbackReturn = MaybePromise<any>;
11
11
  * @example
12
12
  *
13
13
  * ```ts
14
- * import {html, defineElementNoInputs, listen} from 'element-vir';
14
+ * import {html, defineElement, listen} from 'element-vir';
15
15
  *
16
- * const MyElement = defineElementNoInputs({
16
+ * const MyElement = defineElement()({
17
17
  * tagName: 'my-element',
18
18
  * render() {
19
19
  * return html`
@@ -54,9 +54,9 @@ listener: (event: TypedEvent<TypedEventTypeNameGeneric, TypedEventDetailGeneric>
54
54
  * @example
55
55
  *
56
56
  * ```ts
57
- * import {html, defineElementNoInputs, listen} from 'element-vir';
57
+ * import {html, defineElement, listen} from 'element-vir';
58
58
  *
59
- * const MyElement = defineElementNoInputs({
59
+ * const MyElement = defineElement()({
60
60
  * tagName: 'my-element',
61
61
  * render() {
62
62
  * return html`
@@ -16,9 +16,9 @@ export type OnDomCreatedCallback = (element: Element) => MaybePromise<void>;
16
16
  * @example
17
17
  *
18
18
  * ```ts
19
- * import {html, defineElementNoInputs, onDomCreated} from 'element-vir';
19
+ * import {html, defineElement, onDomCreated} from 'element-vir';
20
20
  *
21
- * const MyElement = defineElementNoInputs({
21
+ * const MyElement = defineElement()({
22
22
  * tagName: 'my-element',
23
23
  * render() {
24
24
  * return html`
@@ -10,9 +10,9 @@ const directiveName = 'onDomCreated';
10
10
  * @example
11
11
  *
12
12
  * ```ts
13
- * import {html, defineElementNoInputs, onDomCreated} from 'element-vir';
13
+ * import {html, defineElement, onDomCreated} from 'element-vir';
14
14
  *
15
- * const MyElement = defineElementNoInputs({
15
+ * const MyElement = defineElement()({
16
16
  * tagName: 'my-element',
17
17
  * render() {
18
18
  * return html`
@@ -14,9 +14,9 @@ export type OnDomRenderedCallback = (element: Element) => MaybePromise<void>;
14
14
  * @example
15
15
  *
16
16
  * ```ts
17
- * import {html, defineElementNoInputs, onDomRendered} from 'element-vir';
17
+ * import {html, defineElement, onDomRendered} from 'element-vir';
18
18
  *
19
- * const MyElement = defineElementNoInputs({
19
+ * const MyElement = defineElement()({
20
20
  * tagName: 'my-element',
21
21
  * render() {
22
22
  * return html`
@@ -8,9 +8,9 @@ const directiveName = 'onDomRendered';
8
8
  * @example
9
9
  *
10
10
  * ```ts
11
- * import {html, defineElementNoInputs, onDomRendered} from 'element-vir';
11
+ * import {html, defineElement, onDomRendered} from 'element-vir';
12
12
  *
13
- * const MyElement = defineElementNoInputs({
13
+ * const MyElement = defineElement()({
14
14
  * tagName: 'my-element',
15
15
  * render() {
16
16
  * return html`
@@ -28,9 +28,9 @@ export type OnIntersectOptions = IntersectionObserverInit;
28
28
  * @example
29
29
  *
30
30
  * ```ts
31
- * import {html, defineElementNoInputs, onIntersect} from 'element-vir';
31
+ * import {html, defineElement, onIntersect} from 'element-vir';
32
32
  *
33
- * const MyElement = defineElementNoInputs({
33
+ * const MyElement = defineElement()({
34
34
  * tagName: 'my-element',
35
35
  * render() {
36
36
  * return html`
@@ -13,9 +13,9 @@ const directiveName = 'onIntersect';
13
13
  * @example
14
14
  *
15
15
  * ```ts
16
- * import {html, defineElementNoInputs, onIntersect} from 'element-vir';
16
+ * import {html, defineElement, onIntersect} from 'element-vir';
17
17
  *
18
- * const MyElement = defineElementNoInputs({
18
+ * const MyElement = defineElement()({
19
19
  * tagName: 'my-element',
20
20
  * render() {
21
21
  * return html`
@@ -17,9 +17,9 @@ export type OnResizeCallback = (size: Readonly<Pick<ResizeObserverEntry,
17
17
  * @example
18
18
  *
19
19
  * ```ts
20
- * import {html, defineElementNoInputs, onResize} from 'element-vir';
20
+ * import {html, defineElement, onResize} from 'element-vir';
21
21
  *
22
- * const MyElement = defineElementNoInputs({
22
+ * const MyElement = defineElement()({
23
23
  * tagName: 'my-element',
24
24
  * render() {
25
25
  * return html`
@@ -10,9 +10,9 @@ const directiveName = 'onResize';
10
10
  * @example
11
11
  *
12
12
  * ```ts
13
- * import {html, defineElementNoInputs, onResize} from 'element-vir';
13
+ * import {html, defineElement, onResize} from 'element-vir';
14
14
  *
15
- * const MyElement = defineElementNoInputs({
15
+ * const MyElement = defineElement()({
16
16
  * tagName: 'my-element',
17
17
  * render() {
18
18
  * return html`
@@ -7,9 +7,9 @@
7
7
  * @example
8
8
  *
9
9
  * ```ts
10
- * import {html, defineElementNoInputs, renderIf} from 'element-vir';
10
+ * import {html, defineElement, renderIf} from 'element-vir';
11
11
  *
12
- * const MyElement = defineElementNoInputs({
12
+ * const MyElement = defineElement()({
13
13
  * tagName: 'my-element',
14
14
  * render() {
15
15
  * return html`
@@ -8,9 +8,9 @@ import { when } from '../../lit-exports/all-lit-exports.js';
8
8
  * @example
9
9
  *
10
10
  * ```ts
11
- * import {html, defineElementNoInputs, renderIf} from 'element-vir';
11
+ * import {html, defineElement, renderIf} from 'element-vir';
12
12
  *
13
- * const MyElement = defineElementNoInputs({
13
+ * const MyElement = defineElement()({
14
14
  * tagName: 'my-element',
15
15
  * render() {
16
16
  * return html`
@@ -5,9 +5,9 @@
5
5
  * @example
6
6
  *
7
7
  * ```ts
8
- * import {html, defineElementNoInputs, testId} from 'element-vir';
8
+ * import {html, defineElement, testId} from 'element-vir';
9
9
  *
10
- * const MyElement = defineElementNoInputs({
10
+ * const MyElement = defineElement()({
11
11
  * tagName: 'my-element',
12
12
  * render() {
13
13
  * return html`
@@ -7,9 +7,9 @@ const { attributeDirective, attributeSelector, attributeName } = createAttribute
7
7
  * @example
8
8
  *
9
9
  * ```ts
10
- * import {html, defineElementNoInputs, testId} from 'element-vir';
10
+ * import {html, defineElement, testId} from 'element-vir';
11
11
  *
12
- * const MyElement = defineElementNoInputs({
12
+ * const MyElement = defineElement()({
13
13
  * tagName: 'my-element',
14
14
  * render() {
15
15
  * return html`
@@ -13,9 +13,9 @@ export type EventsInitMap = Record<string, DefineEvent<any>>;
13
13
  * @example
14
14
  *
15
15
  * ```ts
16
- * import {html, defineElementNoInputs, defineElementEvent, listen} from 'element-vir';
16
+ * import {html, defineElement, defineElementEvent, listen} from 'element-vir';
17
17
  *
18
- * const MyElement = defineElementNoInputs({
18
+ * const MyElement = defineElement()({
19
19
  * tagName: 'my-element',
20
20
  * events: {
21
21
  * myOutput: defineElementEvent<number>(),
@@ -6,9 +6,9 @@ import { defineTypedEvent, } from '../../typed-event/typed-event.js';
6
6
  * @example
7
7
  *
8
8
  * ```ts
9
- * import {html, defineElementNoInputs, defineElementEvent, listen} from 'element-vir';
9
+ * import {html, defineElement, defineElementEvent, listen} from 'element-vir';
10
10
  *
11
- * const MyElement = defineElementNoInputs({
11
+ * const MyElement = defineElement()({
12
12
  * tagName: 'my-element',
13
13
  * events: {
14
14
  * myOutput: defineElementEvent<number>(),
@@ -23,8 +23,7 @@ export type WrapDefineElementOptions<TagNameRequirement extends CustomElementTag
23
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>>;
24
24
  }>;
25
25
  /**
26
- * Wraps {@link defineElement} and {@link defineElementNoInputs} in a superset of requirements. For
27
- * example:
26
+ * Wraps {@link defineElement} in a superset of requirements. For example:
28
27
  *
29
28
  * - You could create element definition functions that require all elements to start with a common
30
29
  * prefix, like `vir-`.
@@ -37,6 +36,10 @@ export type WrapDefineElementOptions<TagNameRequirement extends CustomElementTag
37
36
  export declare function wrapDefineElement<TagNameRequirement extends CustomElementTagName = CustomElementTagName, InputsRequirement extends PropertyInitMapBase = {}, StateRequirement extends PropertyInitMapBase = {}, EventsInitRequirement extends EventsInitMap = {}>(options?: WrapDefineElementOptions | undefined): {
38
37
  /** A wrapped function for defining an element with inputs. */
39
38
  defineElement: <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>;
40
- /** A wrapped function for defining an element without inputs. */
39
+ /**
40
+ * A wrapped function for defining an element without inputs.
41
+ *
42
+ * @deprecated Use `defineElement` instead.
43
+ */
41
44
  defineElementNoInputs: <const TagName extends TagNameRequirement, Inputs extends InputsRequirement, 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>;
42
45
  };
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-empty-object-type */
2
- import { defineElementNoInputs } from './define-element-no-inputs.js';
3
2
  import { defineElement } from './define-element.js';
3
+ // eslint-disable-next-line sonarjs/deprecation
4
+ import { defineElementNoInputs } from './define-element-no-inputs.js';
4
5
  /**
5
- * Wraps {@link defineElement} and {@link defineElementNoInputs} in a superset of requirements. For
6
- * example:
6
+ * Wraps {@link defineElement} in a superset of requirements. For example:
7
7
  *
8
8
  * - You could create element definition functions that require all elements to start with a common
9
9
  * prefix, like `vir-`.
@@ -26,9 +26,14 @@ export function wrapDefineElement(options) {
26
26
  return defineElement(...errorParams)(transformInputs(inputs));
27
27
  };
28
28
  },
29
- /** A wrapped function for defining an element without inputs. */
29
+ /**
30
+ * A wrapped function for defining an element without inputs.
31
+ *
32
+ * @deprecated Use `defineElement` instead.
33
+ */
30
34
  defineElementNoInputs: (inputs) => {
31
35
  assertInputs(inputs);
36
+ // eslint-disable-next-line sonarjs/deprecation, @typescript-eslint/no-deprecated
32
37
  return defineElementNoInputs(transformInputs(inputs));
33
38
  },
34
39
  };
@@ -1 +1 @@
1
- export declare const MyApp: import("../index.js").DeclarativeElementDefinition<"my-app", {}, {}, {}, "my-app-", "my-app-", readonly []>;
1
+ export declare const MyApp: import("element-vir").DeclarativeElementDefinition<"my-app", {}, {}, {}, "my-app-", "my-app-", readonly []>;
@@ -1,6 +1,7 @@
1
- import { defineElementNoInputs, html } from '../index.js';
1
+ import { defineElement } from 'element-vir';
2
+ import { html } from '../index.js';
2
3
  import { MySimple } from './my-simple.element.js';
3
- export const MyApp = defineElementNoInputs({
4
+ export const MyApp = defineElement()({
4
5
  tagName: 'my-app',
5
6
  render() {
6
7
  return html `
@@ -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>, defineVirElementNoInputs: <const TagName extends `vir-${string}`, Inputs extends {}, State 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").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>, defineVerifiedVirElementNoInputs: <const TagName extends `vir-${string}`, Inputs extends {}, State 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").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>, defineTransformedVirElementNoInputs: <const TagName extends `vir-${string}`, Inputs extends {}, State 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").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").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>;
@@ -1,7 +1,7 @@
1
1
  import { wrapDefineElement } from '../index.js';
2
- export const { defineElement: defineVirElement, defineElementNoInputs: defineVirElementNoInputs } = wrapDefineElement();
2
+ export const { defineElement: defineVirElement } = wrapDefineElement();
3
3
  // add an optional assert callback
4
- export const { defineElement: defineVerifiedVirElement, defineElementNoInputs: defineVerifiedVirElementNoInputs, } = wrapDefineElement({
4
+ export const { defineElement: defineVerifiedVirElement } = wrapDefineElement({
5
5
  assertInputs: (inputs) => {
6
6
  if (!inputs.tagName.startsWith('vir-')) {
7
7
  throw new Error(`all custom elements must start with "vir-"`);
@@ -9,7 +9,7 @@ export const { defineElement: defineVerifiedVirElement, defineElementNoInputs: d
9
9
  },
10
10
  });
11
11
  // add an optional transform callback
12
- export const { defineElement: defineTransformedVirElement, defineElementNoInputs: defineTransformedVirElementNoInputs, } = wrapDefineElement({
12
+ export const { defineElement: defineTransformedVirElement } = wrapDefineElement({
13
13
  transformInputs: (inputs) => {
14
14
  return {
15
15
  ...inputs,
@@ -1 +1 @@
1
- export declare const MySimple: import("../index.js").DeclarativeElementDefinition<"my-simple", {}, {}, {}, "my-simple-", "my-simple-", readonly []>;
1
+ export declare const MySimple: import("element-vir").DeclarativeElementDefinition<"my-simple", {}, {}, {}, "my-simple-", "my-simple-", readonly []>;
@@ -1,5 +1,6 @@
1
- import { defineElementNoInputs, html } from '../index.js';
2
- export const MySimple = defineElementNoInputs({
1
+ import { defineElement } from 'element-vir';
2
+ import { html } from '../index.js';
3
+ export const MySimple = defineElement()({
3
4
  tagName: 'my-simple',
4
5
  render() {
5
6
  return html `
@@ -1 +1 @@
1
- export declare const MyWithAssignment: import("../index.js").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 []>;
@@ -1,6 +1,7 @@
1
- import { defineElementNoInputs, html } from '../index.js';
1
+ import { defineElement } from 'element-vir';
2
+ import { html } from '../index.js';
2
3
  import { MyWithInputs } from './my-with-inputs.element.js';
3
- export const MyWithAssignment = defineElementNoInputs({
4
+ export const MyWithAssignment = defineElement()({
4
5
  tagName: 'my-with-assignment',
5
6
  render() {
6
7
  return html `
@@ -1,3 +1,3 @@
1
- export declare const MyWithAssignmentCleanupCallback: import("../index.js").DeclarativeElementDefinition<"my-with-cleanup-callback", {}, {
1
+ export declare const MyWithAssignmentCleanupCallback: import("element-vir").DeclarativeElementDefinition<"my-with-cleanup-callback", {}, {
2
2
  intervalId: number;
3
3
  }, {}, "my-with-cleanup-callback-", "my-with-cleanup-callback-", readonly []>;
@@ -1,5 +1,6 @@
1
- import { defineElementNoInputs, html } from '../index.js';
2
- export const MyWithAssignmentCleanupCallback = defineElementNoInputs({
1
+ import { defineElement } from 'element-vir';
2
+ import { html } from '../index.js';
3
+ export const MyWithAssignmentCleanupCallback = defineElement()({
3
4
  tagName: 'my-with-cleanup-callback',
4
5
  state() {
5
6
  return {
@@ -1 +1 @@
1
- export declare const MyWithCssVars: import("../index.js").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 []>;
@@ -1,5 +1,6 @@
1
- import { css, defineElementNoInputs, html } from '../index.js';
2
- export const MyWithCssVars = defineElementNoInputs({
1
+ import { defineElement } from 'element-vir';
2
+ import { css, html } from '../index.js';
3
+ export const MyWithCssVars = defineElement()({
3
4
  tagName: 'my-with-css-vars',
4
5
  cssVars: {
5
6
  /** The value assigned here ('blue') becomes the fallback value for this CSS var. */
@@ -1 +1 @@
1
- export declare const MyWithCustomEvents: import("../index.js").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 []>;
@@ -1,7 +1,8 @@
1
1
  import { randomInteger } from '@augment-vir/common';
2
- import { defineElementNoInputs, html, listen } from '../index.js';
2
+ import { defineElement } from 'element-vir';
3
+ import { html, listen } from '../index.js';
3
4
  import { MyCustomActionEvent } from './my-custom-action.event.js';
4
- export const MyWithCustomEvents = defineElementNoInputs({
5
+ export const MyWithCustomEvents = defineElement()({
5
6
  tagName: 'my-with-custom-events',
6
7
  render({ dispatch }) {
7
8
  return html `
@@ -1,3 +1,3 @@
1
- export declare const MyWithEventListening: import("../index.js").DeclarativeElementDefinition<"my-with-event-listening", {}, {
1
+ export declare const MyWithEventListening: import("element-vir").DeclarativeElementDefinition<"my-with-event-listening", {}, {
2
2
  myNumber: number;
3
3
  }, {}, "my-with-event-listening-", "my-with-event-listening-", readonly []>;
@@ -1,6 +1,7 @@
1
- import { defineElementNoInputs, html, listen } from '../index.js';
1
+ import { defineElement } from 'element-vir';
2
+ import { html, listen } from '../index.js';
2
3
  import { MyWithEvents } from './my-with-events.element.js';
3
- export const MyWithEventListening = defineElementNoInputs({
4
+ export const MyWithEventListening = defineElement()({
4
5
  tagName: 'my-with-event-listening',
5
6
  state() {
6
7
  return {
@@ -1,4 +1,4 @@
1
- export declare const MyWithEvents: import("../index.js").DeclarativeElementDefinition<"my-with-events", {}, {}, {
2
- logoutClick: import("../index.js").DefineEvent<void>;
3
- randomNumber: import("../index.js").DefineEvent<number>;
1
+ export declare const MyWithEvents: import("element-vir").DeclarativeElementDefinition<"my-with-events", {}, {}, {
2
+ logoutClick: import("element-vir").DefineEvent<void>;
3
+ randomNumber: import("element-vir").DefineEvent<number>;
4
4
  }, "my-with-events-", "my-with-events-", readonly []>;
@@ -1,6 +1,7 @@
1
1
  import { randomInteger } from '@augment-vir/common';
2
- import { defineElementEvent, defineElementNoInputs, html, listen } from '../index.js';
3
- export const MyWithEvents = defineElementNoInputs({
2
+ import { defineElement } from 'element-vir';
3
+ import { defineElementEvent, html, listen } from '../index.js';
4
+ export const MyWithEvents = defineElement()({
4
5
  tagName: 'my-with-events',
5
6
  events: {
6
7
  logoutClick: defineElementEvent(),
@@ -1,3 +1,3 @@
1
- export declare const MyWithHostClassDefinition: import("../index.js").DeclarativeElementDefinition<"my-with-host-class-definition", {}, {
1
+ export declare const MyWithHostClassDefinition: import("element-vir").DeclarativeElementDefinition<"my-with-host-class-definition", {}, {
2
2
  myProp: string;
3
3
  }, {}, "my-with-host-class-definition-a" | "my-with-host-class-definition-automatic", "my-with-host-class-definition-", readonly []>;
@@ -1,5 +1,6 @@
1
- import { css, defineElementNoInputs, html } from '../index.js';
2
- export const MyWithHostClassDefinition = defineElementNoInputs({
1
+ import { defineElement } from 'element-vir';
2
+ import { css, html } from '../index.js';
3
+ export const MyWithHostClassDefinition = defineElement()({
3
4
  tagName: 'my-with-host-class-definition',
4
5
  state() {
5
6
  return {
@@ -1 +1 @@
1
- export declare const MyWithHostClassUsage: import("../index.js").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 []>;
@@ -1,6 +1,7 @@
1
- import { defineElementNoInputs, html } from '../index.js';
1
+ import { defineElement } from 'element-vir';
2
+ import { html } from '../index.js';
2
3
  import { MyWithHostClassDefinition } from './my-with-host-class-definition.element.js';
3
- export const MyWithHostClassUsage = defineElementNoInputs({
4
+ export const MyWithHostClassUsage = defineElement()({
4
5
  tagName: 'my-with-host-class-usage',
5
6
  render() {
6
7
  return html `
@@ -1 +1 @@
1
- export declare const MyWithOnDomCreated: import("../index.js").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 []>;
@@ -1,5 +1,6 @@
1
- import { defineElementNoInputs, html, onDomCreated } from '../index.js';
2
- export const MyWithOnDomCreated = defineElementNoInputs({
1
+ import { defineElement } from 'element-vir';
2
+ import { html, onDomCreated } from '../index.js';
3
+ export const MyWithOnDomCreated = defineElement()({
3
4
  tagName: 'my-with-on-dom-created',
4
5
  render() {
5
6
  return html `
@@ -1 +1 @@
1
- export declare const MyWithOnResize: import("../index.js").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 []>;
@@ -1,5 +1,6 @@
1
- import { defineElementNoInputs, html, onResize } from '../index.js';
2
- export const MyWithOnResize = defineElementNoInputs({
1
+ import { defineElement } from 'element-vir';
2
+ import { html, onResize } from '../index.js';
3
+ export const MyWithOnResize = defineElement()({
3
4
  tagName: 'my-with-on-resize',
4
5
  render() {
5
6
  return html `
@@ -1 +1 @@
1
- export declare const MyWithStylesAndInterpolatedSelector: import("../index.js").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 []>;
@@ -1,6 +1,7 @@
1
- import { css, defineElementNoInputs, html } from '../index.js';
1
+ import { defineElement } from 'element-vir';
2
+ import { css, html } from '../index.js';
2
3
  import { MySimple } from './my-simple.element.js';
3
- export const MyWithStylesAndInterpolatedSelector = defineElementNoInputs({
4
+ export const MyWithStylesAndInterpolatedSelector = defineElement()({
4
5
  tagName: 'my-with-styles-and-interpolated-selector',
5
6
  styles: css `
6
7
  ${MySimple} {
@@ -1 +1 @@
1
- export declare const MyWithStyles: import("../index.js").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 []>;
@@ -1,5 +1,6 @@
1
- import { css, defineElementNoInputs, html } from '../index.js';
2
- export const MyWithStyles = defineElementNoInputs({
1
+ import { defineElement } from 'element-vir';
2
+ import { css, html } from '../index.js';
3
+ export const MyWithStyles = defineElement()({
3
4
  tagName: 'my-with-styles',
4
5
  styles: css `
5
6
  :host {
@@ -1,4 +1,4 @@
1
- export declare const MyWithUpdateState: import("../index.js").DeclarativeElementDefinition<"my-with-update-state", {}, {
1
+ export declare const MyWithUpdateState: import("element-vir").DeclarativeElementDefinition<"my-with-update-state", {}, {
2
2
  username: string;
3
3
  /**
4
4
  * Use "as" to create state properties that can be types other than the initial value's
@@ -1,5 +1,6 @@
1
- import { defineElementNoInputs, html, listen } from '../index.js';
2
- export const MyWithUpdateState = defineElementNoInputs({
1
+ import { defineElement } from 'element-vir';
2
+ import { html, listen } from '../index.js';
3
+ export const MyWithUpdateState = defineElement()({
3
4
  tagName: 'my-with-update-state',
4
5
  state() {
5
6
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "element-vir",
3
- "version": "25.10.0",
3
+ "version": "25.12.0",
4
4
  "keywords": [
5
5
  "custom",
6
6
  "web",
@@ -39,8 +39,8 @@
39
39
  "test:docs": "virmator docs check"
40
40
  },
41
41
  "dependencies": {
42
- "@augment-vir/assert": "^31.21.0",
43
- "@augment-vir/common": "^31.21.0",
42
+ "@augment-vir/assert": "^31.21.1",
43
+ "@augment-vir/common": "^31.21.1",
44
44
  "date-vir": "^7.3.1",
45
45
  "lit": "^3.3.0",
46
46
  "lit-css-vars": "^3.0.11",
@@ -50,8 +50,8 @@
50
50
  "typed-event-target": "^4.1.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@augment-vir/test": "^31.21.0",
54
- "@augment-vir/web": "^31.21.0",
53
+ "@augment-vir/test": "^31.21.1",
54
+ "@augment-vir/web": "^31.21.1",
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",