element-vir 22.2.2 → 23.1.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.
- package/README.md +44 -38
- package/dist/declarative-element/custom-tag-name.d.ts +6 -0
- package/dist/declarative-element/declarative-element-init.d.ts +20 -14
- package/dist/declarative-element/declarative-element.d.ts +70 -24
- package/dist/declarative-element/declarative-element.js +34 -1
- package/dist/declarative-element/define-element-no-inputs.d.ts +31 -6
- package/dist/declarative-element/define-element-no-inputs.js +154 -257
- package/dist/declarative-element/define-element.d.ts +35 -7
- package/dist/declarative-element/define-element.js +26 -4
- package/dist/declarative-element/definition-options.d.ts +10 -0
- package/dist/declarative-element/definition-options.js +5 -0
- package/dist/declarative-element/directives/assign.directive.d.ts +8 -11
- package/dist/declarative-element/directives/assign.directive.js +6 -13
- package/dist/declarative-element/directives/async-prop.d.ts +19 -4
- package/dist/declarative-element/directives/async-prop.js +14 -4
- package/dist/declarative-element/directives/create-attribute-directive.d.ts +19 -4
- package/dist/declarative-element/directives/create-attribute-directive.js +18 -8
- package/dist/declarative-element/directives/directive-helpers.d.ts +19 -4
- package/dist/declarative-element/directives/directive-helpers.js +14 -2
- package/dist/declarative-element/directives/is-resolved.directive.d.ts +107 -1
- package/dist/declarative-element/directives/is-resolved.directive.js +107 -1
- package/dist/declarative-element/directives/listen.directive.d.ts +84 -10
- package/dist/declarative-element/directives/listen.directive.js +5 -15
- package/dist/declarative-element/directives/on-dom-created.directive.d.ts +37 -4
- package/dist/declarative-element/directives/on-dom-created.directive.js +32 -12
- package/dist/declarative-element/directives/on-dom-rendered.directive.d.ts +33 -3
- package/dist/declarative-element/directives/on-dom-rendered.directive.js +29 -6
- package/dist/declarative-element/directives/on-resize.directive.d.ts +37 -4
- package/dist/declarative-element/directives/on-resize.directive.js +37 -24
- package/dist/declarative-element/directives/render-async.directive.d.ts +44 -4
- package/dist/declarative-element/directives/render-async.directive.js +13 -3
- package/dist/declarative-element/directives/render-if.directive.d.ts +31 -0
- package/dist/declarative-element/directives/render-if.directive.js +32 -1
- package/dist/declarative-element/directives/test-id.directive.d.ts +48 -4
- package/dist/declarative-element/directives/test-id.directive.js +47 -2
- package/dist/declarative-element/has-declarative-element-parent.js +1 -1
- package/dist/declarative-element/is-declarative-element-definition.d.ts +15 -1
- package/dist/declarative-element/is-declarative-element-definition.js +21 -18
- package/dist/declarative-element/is-declarative-element.d.ts +5 -1
- package/dist/declarative-element/is-declarative-element.js +7 -3
- package/dist/declarative-element/properties/assign-inputs.js +1 -1
- package/dist/declarative-element/properties/css-properties.d.ts +11 -1
- package/dist/declarative-element/properties/css-properties.js +5 -0
- package/dist/declarative-element/properties/css-vars.d.ts +14 -4
- package/dist/declarative-element/properties/element-events.d.ts +61 -7
- package/dist/declarative-element/properties/element-events.js +40 -5
- package/dist/declarative-element/properties/element-properties.d.ts +15 -6
- package/dist/declarative-element/properties/element-properties.js +1 -21
- package/dist/declarative-element/properties/element-vir-state-setup.d.ts +43 -3
- package/dist/declarative-element/properties/element-vir-state-setup.js +17 -3
- package/dist/declarative-element/properties/host-classes.d.ts +25 -12
- package/dist/declarative-element/properties/host-classes.js +5 -0
- package/dist/declarative-element/properties/per-instance.d.ts +23 -2
- package/dist/declarative-element/properties/per-instance.js +24 -3
- package/dist/declarative-element/properties/property-proxy.d.ts +19 -4
- package/dist/declarative-element/properties/property-proxy.js +14 -4
- package/dist/declarative-element/properties/styles.d.ts +33 -8
- package/dist/declarative-element/properties/styles.js +12 -2
- package/dist/declarative-element/properties/tag-name.d.ts +5 -0
- package/dist/declarative-element/render-callback.d.ts +38 -11
- package/dist/declarative-element/render-callback.js +6 -0
- package/dist/declarative-element/slot-names.d.ts +10 -2
- package/dist/declarative-element/slot-names.js +5 -1
- package/dist/declarative-element/wrap-define-element.d.ts +38 -11
- package/dist/declarative-element/wrap-define-element.js +17 -2
- package/dist/index.d.ts +40 -40
- package/dist/index.js +40 -39
- package/dist/lit-exports/all-lit-exports.d.ts +2 -2
- package/dist/lit-exports/all-lit-exports.js +2 -2
- package/dist/lit-exports/lit-repeat-fix.d.ts +60 -4
- package/dist/lit-exports/lit-repeat-fix.js +35 -1
- package/dist/readme-examples/my-app.element.d.ts +1 -0
- package/dist/readme-examples/my-app.element.js +11 -0
- package/dist/readme-examples/my-custom-action.event.d.ts +1 -0
- package/dist/readme-examples/my-custom-action.event.js +2 -0
- package/dist/readme-examples/my-custom-define.d.ts +4 -0
- package/dist/readme-examples/my-custom-define.js +19 -0
- package/dist/readme-examples/my-simple.element.d.ts +1 -0
- package/dist/readme-examples/my-simple.element.js +9 -0
- package/dist/readme-examples/my-with-assignment.element.d.ts +1 -0
- package/dist/readme-examples/my-with-assignment.element.js +14 -0
- package/dist/readme-examples/my-with-async-prop.element.d.ts +9 -0
- package/dist/readme-examples/my-with-async-prop.element.js +46 -0
- package/dist/readme-examples/my-with-cleanup-callback.element.d.ts +3 -0
- package/dist/readme-examples/my-with-cleanup-callback.element.js +23 -0
- package/dist/readme-examples/my-with-css-vars.element.d.ts +1 -0
- package/dist/readme-examples/my-with-css-vars.element.js +24 -0
- package/dist/readme-examples/my-with-custom-events.element.d.ts +1 -0
- package/dist/readme-examples/my-with-custom-events.element.js +21 -0
- package/dist/readme-examples/my-with-event-listening.element.d.ts +3 -0
- package/dist/readme-examples/my-with-event-listening.element.js +22 -0
- package/dist/readme-examples/my-with-events.element.d.ts +4 -0
- package/dist/readme-examples/my-with-events.element.js +19 -0
- package/dist/readme-examples/my-with-host-class-definition.element.d.ts +3 -0
- package/dist/readme-examples/my-with-host-class-definition.element.js +39 -0
- package/dist/readme-examples/my-with-host-class-usage.element.d.ts +1 -0
- package/dist/readme-examples/my-with-host-class-usage.element.js +12 -0
- package/dist/readme-examples/my-with-inputs.element.d.ts +4 -0
- package/dist/readme-examples/my-with-inputs.element.js +9 -0
- package/dist/readme-examples/my-with-on-dom-created.element.d.ts +1 -0
- package/dist/readme-examples/my-with-on-dom-created.element.js +16 -0
- package/dist/readme-examples/my-with-on-resize.element.d.ts +1 -0
- package/dist/readme-examples/my-with-on-resize.element.js +17 -0
- package/dist/readme-examples/my-with-render-if.element.d.ts +3 -0
- package/dist/readme-examples/my-with-render-if.element.js +11 -0
- package/dist/readme-examples/my-with-styles-and-interpolated-selector.element.d.ts +1 -0
- package/dist/readme-examples/my-with-styles-and-interpolated-selector.element.js +15 -0
- package/dist/readme-examples/my-with-styles.element.d.ts +1 -0
- package/dist/readme-examples/my-with-styles.element.js +21 -0
- package/dist/readme-examples/my-with-update-state.element.d.ts +8 -0
- package/dist/readme-examples/my-with-update-state.element.js +23 -0
- package/dist/readme-examples/require-declarative-element.d.ts +1 -0
- package/dist/readme-examples/require-declarative-element.js +2 -0
- package/dist/require-declarative-element.d.ts +12 -0
- package/dist/require-declarative-element.js +12 -0
- package/dist/template-transforms/minimal-element-definition.d.ts +30 -2
- package/dist/template-transforms/minimal-element-definition.js +14 -3
- package/dist/template-transforms/nested-mapped-templates.d.ts +1 -1
- package/dist/template-transforms/nested-mapped-templates.js +4 -3
- package/dist/template-transforms/template-transform-type.d.ts +1 -1
- package/dist/template-transforms/transform-template.d.ts +1 -1
- package/dist/template-transforms/transform-template.js +17 -21
- package/dist/template-transforms/vir-css/css-transform.d.ts +3 -3
- package/dist/template-transforms/vir-css/css-transform.js +3 -2
- package/dist/template-transforms/vir-css/vir-css.d.ts +11 -2
- package/dist/template-transforms/vir-css/vir-css.js +11 -2
- package/dist/template-transforms/vir-html/html-interpolation.d.ts +9 -5
- package/dist/template-transforms/vir-html/html-transform.d.ts +3 -3
- package/dist/template-transforms/vir-html/html-transform.js +14 -12
- package/dist/template-transforms/vir-html/vir-html.d.ts +4 -2
- package/dist/template-transforms/vir-html/vir-html.js +4 -2
- package/dist/typed-event/typed-event.d.ts +42 -6
- package/dist/typed-event/typed-event.js +31 -28
- package/dist/util/lit-template.d.ts +6 -1
- package/dist/util/lit-template.js +10 -7
- package/dist/util/type.d.ts +5 -0
- package/package.json +37 -35
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ All of [`lit`](https://lit.dev)'s syntax and functionality is available for use
|
|
|
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 `
|
|
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:
|
|
40
40
|
|
|
41
41
|
<!-- example-link: src/readme-examples/my-simple.element.ts -->
|
|
42
42
|
|
|
@@ -45,7 +45,7 @@ import {defineElementNoInputs, html} from 'element-vir';
|
|
|
45
45
|
|
|
46
46
|
export const MySimple = defineElementNoInputs({
|
|
47
47
|
tagName: 'my-simple',
|
|
48
|
-
|
|
48
|
+
render() {
|
|
49
49
|
return html`
|
|
50
50
|
<span>Hello there!</span>
|
|
51
51
|
`;
|
|
@@ -63,11 +63,11 @@ To use already defined elements (like the example above), they must be interpola
|
|
|
63
63
|
|
|
64
64
|
```TypeScript
|
|
65
65
|
import {defineElementNoInputs, html} from 'element-vir';
|
|
66
|
-
import {MySimple} from './my-simple.element';
|
|
66
|
+
import {MySimple} from './my-simple.element.js';
|
|
67
67
|
|
|
68
68
|
export const MyApp = defineElementNoInputs({
|
|
69
69
|
tagName: 'my-app',
|
|
70
|
-
|
|
70
|
+
render() {
|
|
71
71
|
return html`
|
|
72
72
|
<h1>My App</h1>
|
|
73
73
|
<${MySimple}></${MySimple}>
|
|
@@ -100,7 +100,7 @@ export const MyWithStyles = defineElementNoInputs({
|
|
|
100
100
|
margin-top: 16px;
|
|
101
101
|
}
|
|
102
102
|
`,
|
|
103
|
-
|
|
103
|
+
render() {
|
|
104
104
|
return html`
|
|
105
105
|
<span>Hello there!</span>
|
|
106
106
|
<span>How are you doing?</span>
|
|
@@ -117,7 +117,7 @@ Declarative element definitions can be used in the `css` tagged template just li
|
|
|
117
117
|
|
|
118
118
|
```TypeScript
|
|
119
119
|
import {css, defineElementNoInputs, html} from 'element-vir';
|
|
120
|
-
import {MySimple} from './my-simple.element';
|
|
120
|
+
import {MySimple} from './my-simple.element.js';
|
|
121
121
|
|
|
122
122
|
export const MyWithStylesAndInterpolatedSelector = defineElementNoInputs({
|
|
123
123
|
tagName: 'my-with-styles-and-interpolated-selector',
|
|
@@ -126,7 +126,7 @@ export const MyWithStylesAndInterpolatedSelector = defineElementNoInputs({
|
|
|
126
126
|
background-color: blue;
|
|
127
127
|
}
|
|
128
128
|
`,
|
|
129
|
-
|
|
129
|
+
render() {
|
|
130
130
|
return html`
|
|
131
131
|
<${MySimple}></${MySimple}>
|
|
132
132
|
`;
|
|
@@ -138,7 +138,7 @@ export const MyWithStylesAndInterpolatedSelector = defineElementNoInputs({
|
|
|
138
138
|
|
|
139
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`).
|
|
140
140
|
|
|
141
|
-
To use an element's inputs for use in its template, grab `inputs` from `
|
|
141
|
+
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
142
|
|
|
143
143
|
<!-- example-link: src/readme-examples/my-with-inputs.element.ts -->
|
|
144
144
|
|
|
@@ -150,7 +150,7 @@ export const MyWithInputs = defineElement<{
|
|
|
150
150
|
email: string;
|
|
151
151
|
}>()({
|
|
152
152
|
tagName: 'my-with-inputs',
|
|
153
|
-
|
|
153
|
+
render({inputs}) {
|
|
154
154
|
return html`
|
|
155
155
|
<span>Hello there ${inputs.username}!</span>
|
|
156
156
|
`;
|
|
@@ -160,7 +160,7 @@ export const MyWithInputs = defineElement<{
|
|
|
160
160
|
|
|
161
161
|
## Defining internal state
|
|
162
162
|
|
|
163
|
-
Define initial internal state values and types with the `stateInit` property when defining an element. Grab it with `state` in `
|
|
163
|
+
Define initial internal state values and types with the `stateInit` property when defining an element. Grab it with `state` in `render` to use state. Grab `updateState` in `render` to update state:
|
|
164
164
|
|
|
165
165
|
<!-- example-link: src/readme-examples/my-with-update-state.element.ts -->
|
|
166
166
|
|
|
@@ -177,7 +177,7 @@ export const MyWithUpdateState = defineElementNoInputs({
|
|
|
177
177
|
*/
|
|
178
178
|
email: undefined as string | undefined,
|
|
179
179
|
},
|
|
180
|
-
|
|
180
|
+
render({state, updateState}) {
|
|
181
181
|
return html`
|
|
182
182
|
<span
|
|
183
183
|
${listen('click', () => {
|
|
@@ -199,11 +199,11 @@ Use the `assign` directive to assign values to child custom elements inputs:
|
|
|
199
199
|
|
|
200
200
|
```TypeScript
|
|
201
201
|
import {defineElementNoInputs, html} from 'element-vir';
|
|
202
|
-
import {MyWithInputs} from './my-with-inputs.element';
|
|
202
|
+
import {MyWithInputs} from './my-with-inputs.element.js';
|
|
203
203
|
|
|
204
204
|
export const MyWithAssignment = defineElementNoInputs({
|
|
205
205
|
tagName: 'my-with-assignment',
|
|
206
|
-
|
|
206
|
+
render() {
|
|
207
207
|
return html`
|
|
208
208
|
<h1>My App</h1>
|
|
209
209
|
<${MyWithInputs.assign({
|
|
@@ -219,8 +219,8 @@ export const MyWithAssignment = defineElementNoInputs({
|
|
|
219
219
|
|
|
220
220
|
There are two other callbacks you can define that are sort of similar to lifecycle callbacks. They are much simpler than lifecycle callbacks however.
|
|
221
221
|
|
|
222
|
-
-
|
|
223
|
-
-
|
|
222
|
+
- `init`: called right before the first render and has all state and inputs setup. (This is similar to `connectedCallback` in standard HTMLElement classes but is fired much later, after inputs are assigned, to avoid race conditions.)
|
|
223
|
+
- `cleanup`: called when an element is removed from the DOM. (This is the same as the `disconnectedCallback` in standard HTMLElement classes.)
|
|
224
224
|
|
|
225
225
|
<!-- example-link: src/readme-examples/my-with-cleanup-callback.element.ts -->
|
|
226
226
|
|
|
@@ -232,17 +232,17 @@ export const MyWithAssignmentCleanupCallback = defineElementNoInputs({
|
|
|
232
232
|
stateInitStatic: {
|
|
233
233
|
intervalId: undefined as undefined | number,
|
|
234
234
|
},
|
|
235
|
-
|
|
235
|
+
init: ({updateState}) => {
|
|
236
236
|
updateState({
|
|
237
237
|
intervalId: window.setInterval(() => console.info('hi'), 1000),
|
|
238
238
|
});
|
|
239
239
|
},
|
|
240
|
-
|
|
240
|
+
render() {
|
|
241
241
|
return html`
|
|
242
242
|
<h1>My App</h1>
|
|
243
243
|
`;
|
|
244
244
|
},
|
|
245
|
-
|
|
245
|
+
cleanup: ({state, updateState}) => {
|
|
246
246
|
window.clearInterval(state.intervalId);
|
|
247
247
|
updateState({
|
|
248
248
|
intervalId: undefined,
|
|
@@ -255,11 +255,12 @@ export const MyWithAssignmentCleanupCallback = defineElementNoInputs({
|
|
|
255
255
|
|
|
256
256
|
When defining a declarative element, use `events` to setup event names and types. Each event must be initialized with `defineElementEvent` and a type parameter but no run-time inputs.
|
|
257
257
|
|
|
258
|
-
To dispatch an event, grab `dispatch` and `events` from `
|
|
258
|
+
To dispatch an event, grab `dispatch` and `events` from `render`'s parameters.
|
|
259
259
|
|
|
260
260
|
<!-- example-link: src/readme-examples/my-with-events.element.ts -->
|
|
261
261
|
|
|
262
262
|
```TypeScript
|
|
263
|
+
import {randomInteger} from '@augment-vir/common';
|
|
263
264
|
import {defineElementEvent, defineElementNoInputs, html, listen} from 'element-vir';
|
|
264
265
|
|
|
265
266
|
export const MyWithEvents = defineElementNoInputs({
|
|
@@ -268,10 +269,14 @@ export const MyWithEvents = defineElementNoInputs({
|
|
|
268
269
|
logoutClick: defineElementEvent<void>(),
|
|
269
270
|
randomNumber: defineElementEvent<number>(),
|
|
270
271
|
},
|
|
271
|
-
|
|
272
|
+
render({dispatch, events}) {
|
|
272
273
|
return html`
|
|
273
274
|
<button ${listen('click', () => dispatch(new events.logoutClick()))}>log out</button>
|
|
274
|
-
<button
|
|
275
|
+
<button
|
|
276
|
+
${listen('click', () =>
|
|
277
|
+
dispatch(new events.randomNumber(randomInteger({min: 0, max: 1_000_000}))),
|
|
278
|
+
)}
|
|
279
|
+
>
|
|
275
280
|
generate random number
|
|
276
281
|
</button>
|
|
277
282
|
`;
|
|
@@ -287,14 +292,14 @@ Use the `listen` directive to listen to events emitted by your custom elements:
|
|
|
287
292
|
|
|
288
293
|
```TypeScript
|
|
289
294
|
import {defineElementNoInputs, html, listen} from 'element-vir';
|
|
290
|
-
import {MyWithEvents} from './my-with-events.element';
|
|
295
|
+
import {MyWithEvents} from './my-with-events.element.js';
|
|
291
296
|
|
|
292
297
|
export const MyWithEventListening = defineElementNoInputs({
|
|
293
298
|
tagName: 'my-with-event-listening',
|
|
294
299
|
stateInitStatic: {
|
|
295
300
|
myNumber: -1,
|
|
296
301
|
},
|
|
297
|
-
|
|
302
|
+
render({state, updateState}) {
|
|
298
303
|
return html`
|
|
299
304
|
<h1>My App</h1>
|
|
300
305
|
<${MyWithEvents}
|
|
@@ -332,12 +337,13 @@ Dispatching a custom event and listening to a custom event is the same as doing
|
|
|
332
337
|
<!-- example-link: src/readme-examples/my-with-custom-events.element.ts -->
|
|
333
338
|
|
|
334
339
|
```TypeScript
|
|
340
|
+
import {randomInteger} from '@augment-vir/common';
|
|
335
341
|
import {defineElementNoInputs, html, listen} from 'element-vir';
|
|
336
|
-
import {MyCustomActionEvent} from './my-custom-action.event';
|
|
342
|
+
import {MyCustomActionEvent} from './my-custom-action.event.js';
|
|
337
343
|
|
|
338
344
|
export const MyWithCustomEvents = defineElementNoInputs({
|
|
339
345
|
tagName: 'my-with-custom-events',
|
|
340
|
-
|
|
346
|
+
render({dispatch}) {
|
|
341
347
|
return html`
|
|
342
348
|
<div
|
|
343
349
|
${listen(MyCustomActionEvent, (event) => {
|
|
@@ -346,7 +352,7 @@ export const MyWithCustomEvents = defineElementNoInputs({
|
|
|
346
352
|
>
|
|
347
353
|
<div
|
|
348
354
|
${listen('click', () => {
|
|
349
|
-
dispatch(new MyCustomActionEvent(
|
|
355
|
+
dispatch(new MyCustomActionEvent(randomInteger({min: 0, max: 1_000_000})));
|
|
350
356
|
})}
|
|
351
357
|
></div>
|
|
352
358
|
</div>
|
|
@@ -361,10 +367,10 @@ export const MyWithCustomEvents = defineElementNoInputs({
|
|
|
361
367
|
|
|
362
368
|
Host classes can be defined and used with type safety. Host classes are used to provide alternative styles for custom elements. They are purely driven by CSS and are thus applied to the the `class` HTML attribute.
|
|
363
369
|
|
|
364
|
-
Host classes are defined by passing an object to `hostClasses` at element definition time. Each property name in the `hostClasses` object creates a host class name (note that host class names must start with the element's tag name). Each value in the `hostClasses` object defines behavior for
|
|
370
|
+
Host classes are defined by passing an object to `hostClasses` at element definition time. Each property name in the `hostClasses` object creates a host class name (note that host class names must start with the element's tag name). Each value in the `hostClasses` object defines behavior for the host class:
|
|
365
371
|
|
|
366
|
-
-
|
|
367
|
-
-
|
|
372
|
+
- if the value is a callback, that host class will automatically be applied if the callback returns true after a render is executed.
|
|
373
|
+
- if the value is `false`, the host class is never automatically applied, it must be manually applied by consumers.
|
|
368
374
|
|
|
369
375
|
Apply host classes in the element's stylesheet by using a callback for the styles property:
|
|
370
376
|
|
|
@@ -386,7 +392,7 @@ export const MyWithHostClassDefinition = defineElementNoInputs({
|
|
|
386
392
|
'my-with-host-class-definition-a': false,
|
|
387
393
|
/**
|
|
388
394
|
* This host class will be automatically applied if the given callback is evaluated to true
|
|
389
|
-
* after a call to
|
|
395
|
+
* after a call to render.
|
|
390
396
|
*/
|
|
391
397
|
'my-with-host-class-definition-automatic': ({state}) => {
|
|
392
398
|
return state.myProp === 'foo';
|
|
@@ -405,7 +411,7 @@ export const MyWithHostClassDefinition = defineElementNoInputs({
|
|
|
405
411
|
color: red;
|
|
406
412
|
}
|
|
407
413
|
`,
|
|
408
|
-
|
|
414
|
+
render({state}) {
|
|
409
415
|
return html`
|
|
410
416
|
${state.myProp}
|
|
411
417
|
`;
|
|
@@ -421,11 +427,11 @@ To apply a host class in a consumer, access the child element's `.hostClasses` p
|
|
|
421
427
|
|
|
422
428
|
```TypeScript
|
|
423
429
|
import {defineElementNoInputs, html} from 'element-vir';
|
|
424
|
-
import {MyWithHostClassDefinition} from './my-with-host-class-definition.element';
|
|
430
|
+
import {MyWithHostClassDefinition} from './my-with-host-class-definition.element.js';
|
|
425
431
|
|
|
426
432
|
export const MyWithHostClassUsage = defineElementNoInputs({
|
|
427
433
|
tagName: 'my-with-host-class-usage',
|
|
428
|
-
|
|
434
|
+
render() {
|
|
429
435
|
return html`
|
|
430
436
|
<${MyWithHostClassDefinition}
|
|
431
437
|
class=${MyWithHostClassDefinition.hostClasses['my-with-host-class-definition-a']}
|
|
@@ -463,7 +469,7 @@ export const MyWithCssVars = defineElementNoInputs({
|
|
|
463
469
|
color: ${cssVars['my-with-css-vars-my-var'].value};
|
|
464
470
|
}
|
|
465
471
|
`,
|
|
466
|
-
|
|
472
|
+
render() {
|
|
467
473
|
return html``;
|
|
468
474
|
},
|
|
469
475
|
});
|
|
@@ -526,7 +532,7 @@ import {defineElementNoInputs, html, onDomCreated} from 'element-vir';
|
|
|
526
532
|
|
|
527
533
|
export const MyWithOnDomCreated = defineElementNoInputs({
|
|
528
534
|
tagName: 'my-with-on-dom-created',
|
|
529
|
-
|
|
535
|
+
render() {
|
|
530
536
|
return html`
|
|
531
537
|
<span
|
|
532
538
|
${onDomCreated((element) => {
|
|
@@ -552,7 +558,7 @@ import {defineElementNoInputs, html, onResize} from 'element-vir';
|
|
|
552
558
|
|
|
553
559
|
export const MyWithOnResize = defineElementNoInputs({
|
|
554
560
|
tagName: 'my-with-on-resize',
|
|
555
|
-
|
|
561
|
+
render() {
|
|
556
562
|
return html`
|
|
557
563
|
<span
|
|
558
564
|
${onResize((entry) => {
|
|
@@ -583,7 +589,7 @@ import {defineElement, html, renderIf} from 'element-vir';
|
|
|
583
589
|
|
|
584
590
|
export const MyWithRenderIf = defineElement<{shouldRender: boolean}>()({
|
|
585
591
|
tagName: 'my-with-render-if',
|
|
586
|
-
|
|
592
|
+
render({inputs}) {
|
|
587
593
|
return html`
|
|
588
594
|
${renderIf(
|
|
589
595
|
inputs.shouldRender,
|
|
@@ -630,7 +636,7 @@ export const MyWithAsyncProp = defineElement<{endpoint: string}>()({
|
|
|
630
636
|
},
|
|
631
637
|
}),
|
|
632
638
|
},
|
|
633
|
-
|
|
639
|
+
render({inputs, state}) {
|
|
634
640
|
/**
|
|
635
641
|
* This causes the a promise which automatically updates the state.data prop once the
|
|
636
642
|
* promise resolves. It only creates a new promise if the first input, the trigger, value
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The spec-required type for all custom tag names (they must contain a hyphen).
|
|
3
|
+
*
|
|
4
|
+
* @category Internal
|
|
5
|
+
* @see https://developer.mozilla.org/docs/Web/API/Web_components/Using_custom_elements#name
|
|
6
|
+
*/
|
|
1
7
|
export type CustomElementTagName = `${string}-${string}`;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { CSSResult } from '../lit-exports/
|
|
2
|
-
import { CustomElementTagName } from './custom-tag-name';
|
|
3
|
-
import { DeclarativeElementDefinitionOptions } from './definition-options';
|
|
4
|
-
import { BaseCssPropertyName } from './properties/css-properties';
|
|
5
|
-
import { CssVarsInitMap } from './properties/css-vars';
|
|
6
|
-
import { EventsInitMap } from './properties/element-events';
|
|
7
|
-
import { PropertyInitMapBase } from './properties/element-properties';
|
|
8
|
-
import { HostClassesInitMap } from './properties/host-classes';
|
|
9
|
-
import { StylesCallback } from './properties/styles';
|
|
10
|
-
import { InitCallback, RenderCallback } from './render-callback';
|
|
1
|
+
import { type CSSResult } from '../lit-exports/base-lit-exports.js';
|
|
2
|
+
import { type CustomElementTagName } from './custom-tag-name.js';
|
|
3
|
+
import { type DeclarativeElementDefinitionOptions } from './definition-options.js';
|
|
4
|
+
import { type BaseCssPropertyName } from './properties/css-properties.js';
|
|
5
|
+
import { type CssVarsInitMap } from './properties/css-vars.js';
|
|
6
|
+
import { type EventsInitMap } from './properties/element-events.js';
|
|
7
|
+
import { type PropertyInitMapBase } from './properties/element-properties.js';
|
|
8
|
+
import { type HostClassesInitMap } from './properties/host-classes.js';
|
|
9
|
+
import { type StylesCallback } from './properties/styles.js';
|
|
10
|
+
import { type InitCallback, type RenderCallback } from './render-callback.js';
|
|
11
|
+
/**
|
|
12
|
+
* Initialization for an element-vir declarative element. This defines all the pieces required for
|
|
13
|
+
* rendering the element.
|
|
14
|
+
*
|
|
15
|
+
* @category Internal
|
|
16
|
+
*/
|
|
11
17
|
export type DeclarativeElementInit<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, StateInit extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = {
|
|
12
18
|
/**
|
|
13
19
|
* HTML tag name. This should not be used directly, as interpolating it with the html tagged
|
|
@@ -39,9 +45,9 @@ export type DeclarativeElementInit<TagName extends CustomElementTagName, Inputs
|
|
|
39
45
|
* then passed to the styles property, which must be a callback to take advantage of these.
|
|
40
46
|
*/
|
|
41
47
|
cssVars?: CssVarsInitMap<TagName, CssVarKeys>;
|
|
42
|
-
/** Called as part of the first
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
/** Called as part of the first render call, before the first render call. */
|
|
49
|
+
init?: InitCallback<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
50
|
+
render: RenderCallback<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
51
|
+
cleanup?: InitCallback<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
46
52
|
options?: Partial<DeclarativeElementDefinitionOptions> | undefined;
|
|
47
53
|
};
|
|
@@ -1,30 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IsAny, IsEmptyObject } from 'type-fest';
|
|
3
|
-
import {
|
|
4
|
-
import { MinimalDefinitionWithInputs } from '../template-transforms/minimal-element-definition';
|
|
5
|
-
import { CustomElementTagName } from './custom-tag-name';
|
|
6
|
-
import { DeclarativeElementInit } from './declarative-element-init';
|
|
7
|
-
import { DeclarativeElementDefinitionOptions } from './definition-options';
|
|
8
|
-
import { BaseCssPropertyName } from './properties/css-properties';
|
|
9
|
-
import { CssVars } from './properties/css-vars';
|
|
10
|
-
import { EventDescriptorMap, EventsInitMap } from './properties/element-events';
|
|
11
|
-
import { ElementPropertyDescriptorMap, PropertyInitMapBase } from './properties/element-properties';
|
|
12
|
-
import { FlattenElementVirStateSetup } from './properties/element-vir-state-setup';
|
|
13
|
-
import { HostClassNamesMap } from './properties/host-classes';
|
|
14
|
-
import { ObservableListenerMap } from './properties/property-proxy';
|
|
15
|
-
import type
|
|
16
|
-
import { SlotNameMap } from './slot-names';
|
|
17
|
-
|
|
1
|
+
import { type SetRequiredAndNotNull } from '@augment-vir/common';
|
|
2
|
+
import { type EmptyObject, type IsAny, type IsEmptyObject } from 'type-fest';
|
|
3
|
+
import { LitElement, type CSSResult } from '../lit-exports/base-lit-exports.js';
|
|
4
|
+
import { type MinimalDefinitionWithInputs } from '../template-transforms/minimal-element-definition.js';
|
|
5
|
+
import { type CustomElementTagName } from './custom-tag-name.js';
|
|
6
|
+
import { type DeclarativeElementInit } from './declarative-element-init.js';
|
|
7
|
+
import { type DeclarativeElementDefinitionOptions } from './definition-options.js';
|
|
8
|
+
import { type BaseCssPropertyName } from './properties/css-properties.js';
|
|
9
|
+
import { type CssVars } from './properties/css-vars.js';
|
|
10
|
+
import { type EventDescriptorMap, type EventsInitMap } from './properties/element-events.js';
|
|
11
|
+
import { type ElementPropertyDescriptorMap, type PropertyInitMapBase } from './properties/element-properties.js';
|
|
12
|
+
import { type FlattenElementVirStateSetup } from './properties/element-vir-state-setup.js';
|
|
13
|
+
import { type HostClassNamesMap } from './properties/host-classes.js';
|
|
14
|
+
import { type ObservableListenerMap } from './properties/property-proxy.js';
|
|
15
|
+
import { type RenderCallback, type RenderParams, type UpdateStateCallback } from './render-callback.js';
|
|
16
|
+
import { type SlotNameMap } from './slot-names.js';
|
|
17
|
+
/**
|
|
18
|
+
* The `host` type for a declarative element. This references a declarative element instance's
|
|
19
|
+
* top-level HTML element and always contains a shadow root (wherein the element is rendered).
|
|
20
|
+
*
|
|
21
|
+
* @category Internal
|
|
22
|
+
*/
|
|
23
|
+
export type DeclarativeElementHost<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> = SetRequiredAndNotNull<Omit<DeclarativeElement<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>, Exclude<keyof StaticDeclarativeElementProperties<any, any, any, any, any, any, any>, keyof HTMLElement>>, 'shadowRoot'>;
|
|
24
|
+
/**
|
|
25
|
+
* The full definition for a declarative element.
|
|
26
|
+
*
|
|
27
|
+
* @category Internal
|
|
28
|
+
*/
|
|
18
29
|
export type DeclarativeElementDefinition<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> = (new () => DeclarativeElementHost<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) & StaticDeclarativeElementProperties<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames> & {
|
|
19
30
|
instanceType: DeclarativeElementHost<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
20
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* Abstract class base for all declarative elements.
|
|
34
|
+
*
|
|
35
|
+
* @category Internal
|
|
36
|
+
*/
|
|
21
37
|
export declare abstract class DeclarativeElement<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> extends LitElement {
|
|
22
|
-
|
|
23
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Assign inputs to an element instantiation. Use only on the opening tag.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* import {html} from 'element-vir';
|
|
45
|
+
*
|
|
46
|
+
* const myTemplate = html`
|
|
47
|
+
* <${MyElement.assign({input1: 'a', input2: 'b'})}></${MyElement}>
|
|
48
|
+
* `;
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
static readonly assign: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['assign'];
|
|
52
|
+
static readonly assignedInputs: PropertyInitMapBase | undefined;
|
|
24
53
|
static readonly tagName: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['tagName'];
|
|
25
54
|
static readonly styles: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['styles'];
|
|
26
|
-
static readonly
|
|
27
|
-
static readonly renderCallback: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['renderCallback'];
|
|
55
|
+
static readonly render: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['render'];
|
|
28
56
|
static readonly inputsType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['inputsType'];
|
|
29
57
|
static readonly stateType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['stateType'];
|
|
30
58
|
static readonly updateStateType: StaticDeclarativeElementProperties<CustomElementTagName, PropertyInitMapBase, PropertyInitMapBase, EventsInitMap, BaseCssPropertyName<CustomElementTagName>, BaseCssPropertyName<CustomElementTagName>, ReadonlyArray<string>>['updateStateType'];
|
|
@@ -38,23 +66,42 @@ export declare abstract class DeclarativeElement<TagName extends CustomElementTa
|
|
|
38
66
|
abstract _lastRenderError: Error | undefined;
|
|
39
67
|
abstract _internalRenderCount: number;
|
|
40
68
|
abstract _lastRenderedProps: Readonly<Pick<RenderParams<any, Inputs, StateInit, any, any, any, any>, 'inputs' | 'state'>>;
|
|
69
|
+
/**
|
|
70
|
+
* Calls all destroy methods on all state properties, if they exist. This is automatically
|
|
71
|
+
* called whenever the element is detached.
|
|
72
|
+
*/
|
|
41
73
|
abstract destroy(): void;
|
|
42
74
|
abstract render(): unknown;
|
|
43
75
|
abstract readonly instanceState: FlattenElementVirStateSetup<StateInit>;
|
|
44
76
|
abstract readonly observablePropertyListenerMap: ObservableListenerMap<StateInit & Inputs>;
|
|
45
77
|
abstract readonly instanceInputs: Inputs;
|
|
46
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Used to assign inputs to the given element. This can be externally called as an API for
|
|
80
|
+
* setting inputs on an element reference, though this is discouraged. Inputs should typically
|
|
81
|
+
* be called using the `.assign()` method on an element definition inside of an HTML template.
|
|
82
|
+
*/
|
|
83
|
+
abstract assignInputs(inputs: EmptyObject extends Required<Inputs> ? never : Partial<Inputs>): void;
|
|
47
84
|
abstract _haveInputsBeenSet: boolean;
|
|
48
85
|
/** The element definition for this element instance. */
|
|
49
86
|
abstract readonly definition: DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
50
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* The assign inputs method of a declarative element.
|
|
90
|
+
*
|
|
91
|
+
* @category Internal
|
|
92
|
+
*/
|
|
51
93
|
export type AssignMethod<Inputs extends PropertyInitMapBase> = IsAny<Inputs> extends true ? any : IsEmptyObject<Required<Inputs>> extends true ? (inputsObject: never) => never : (inputsObject: IsEmptyObject<Required<Inputs>> extends true ? never : Inputs) => MinimalDefinitionWithInputs;
|
|
94
|
+
/**
|
|
95
|
+
* All static properties on a declarative element. These all come from the element's definition.
|
|
96
|
+
*
|
|
97
|
+
* @category Internal
|
|
98
|
+
*/
|
|
52
99
|
export type StaticDeclarativeElementProperties<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, StateInit extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = {
|
|
53
100
|
/** Assign inputs to an element directly on its interpolated tag. */
|
|
54
101
|
readonly assign: AssignMethod<Inputs>;
|
|
55
102
|
assignedInputs: Inputs | undefined;
|
|
56
103
|
/** Pass through the render callback for direct unit testability */
|
|
57
|
-
readonly
|
|
104
|
+
readonly render: RenderCallback<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
58
105
|
readonly events: EventDescriptorMap<TagName, EventsInit>;
|
|
59
106
|
readonly stateInitStatic: ElementPropertyDescriptorMap<StateInit>;
|
|
60
107
|
readonly slotNames: SlotNameMap<SlotNames>;
|
|
@@ -63,7 +110,6 @@ export type StaticDeclarativeElementProperties<TagName extends CustomElementTagN
|
|
|
63
110
|
readonly inputsType: Inputs;
|
|
64
111
|
readonly stateType: Readonly<FlattenElementVirStateSetup<StateInit>>;
|
|
65
112
|
readonly updateStateType: UpdateStateCallback<StateInit>;
|
|
66
|
-
readonly isStrictInstance: (element: unknown) => element is DeclarativeElement<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
67
113
|
readonly hostClasses: HostClassNamesMap<string, HostClassKeys>;
|
|
68
114
|
readonly cssVars: CssVars<TagName, CssVarKeys>;
|
|
69
115
|
readonly tagName: string;
|
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
import { LitElement } from '../lit-exports/
|
|
1
|
+
import { LitElement } from '../lit-exports/base-lit-exports.js';
|
|
2
|
+
/**
|
|
3
|
+
* Abstract class base for all declarative elements.
|
|
4
|
+
*
|
|
5
|
+
* @category Internal
|
|
6
|
+
*/
|
|
2
7
|
export class DeclarativeElement extends LitElement {
|
|
8
|
+
/**
|
|
9
|
+
* Assign inputs to an element instantiation. Use only on the opening tag.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* import {html} from 'element-vir';
|
|
15
|
+
*
|
|
16
|
+
* const myTemplate = html`
|
|
17
|
+
* <${MyElement.assign({input1: 'a', input2: 'b'})}></${MyElement}>
|
|
18
|
+
* `;
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
static assign;
|
|
22
|
+
static assignedInputs;
|
|
23
|
+
static tagName;
|
|
24
|
+
static styles;
|
|
25
|
+
static render;
|
|
26
|
+
static inputsType;
|
|
27
|
+
static stateType;
|
|
28
|
+
static updateStateType;
|
|
29
|
+
static events;
|
|
30
|
+
static stateInitStatic;
|
|
31
|
+
static init;
|
|
32
|
+
static elementOptions;
|
|
33
|
+
static hostClasses;
|
|
34
|
+
static cssVars;
|
|
35
|
+
static slotNames;
|
|
3
36
|
}
|
|
@@ -1,8 +1,33 @@
|
|
|
1
|
-
import { CustomElementTagName } from './custom-tag-name';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { BaseCssPropertyName } from './properties/css-properties';
|
|
5
|
-
import { EventsInitMap } from './properties/element-events';
|
|
6
|
-
import { PropertyInitMapBase } from './properties/element-properties';
|
|
1
|
+
import { CustomElementTagName } from './custom-tag-name.js';
|
|
2
|
+
import { DeclarativeElementInit } from './declarative-element-init.js';
|
|
3
|
+
import { DeclarativeElementDefinition } from './declarative-element.js';
|
|
4
|
+
import { BaseCssPropertyName } from './properties/css-properties.js';
|
|
5
|
+
import { EventsInitMap } from './properties/element-events.js';
|
|
6
|
+
import { PropertyInitMapBase } from './properties/element-properties.js';
|
|
7
|
+
/**
|
|
8
|
+
* Verifies that the given {@link DeclarativeElementInit} for an element definition without inputs
|
|
9
|
+
* does not have any state properties that clash with built-in HTML element properties.
|
|
10
|
+
*
|
|
11
|
+
* @category Internal
|
|
12
|
+
*/
|
|
7
13
|
export type VerifiedElementNoInputsInit<TagName extends CustomElementTagName, Inputs extends PropertyInitMapBase, StateInit extends PropertyInitMapBase, EventsInit extends EventsInitMap, HostClassKeys extends BaseCssPropertyName<TagName>, CssVarKeys extends BaseCssPropertyName<TagName>, SlotNames extends ReadonlyArray<string>> = Extract<keyof StateInit, keyof HTMLElement> extends never ? DeclarativeElementInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames> : 'ERROR: Cannot define an element state property that clashes with native HTMLElement properties.';
|
|
14
|
+
/**
|
|
15
|
+
* Defines an element without any inputs.
|
|
16
|
+
*
|
|
17
|
+
* @category Element Definition
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* import {defineElementNoInputs, html} from 'element-vir';
|
|
22
|
+
*
|
|
23
|
+
* const MyElement = defineElementNoInputs({
|
|
24
|
+
* tagName: 'my-element',
|
|
25
|
+
* render() {
|
|
26
|
+
* return html`
|
|
27
|
+
* <p>hi</p>
|
|
28
|
+
* `;
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
8
33
|
export declare function defineElementNoInputs<const TagName extends CustomElementTagName = '-', Inputs extends PropertyInitMapBase = {}, StateInit extends PropertyInitMapBase = {}, EventsInit extends EventsInitMap = {}, const HostClassKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const CssVarKeys extends BaseCssPropertyName<TagName> = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = Readonly<[]>>(initInput: VerifiedElementNoInputsInit<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>): DeclarativeElementDefinition<TagName, Inputs, StateInit, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|