Skip to content

Commit daddeb3

Browse files
author
Steve Orvell
authored
[lit-html] Provide directive exports via async-directive (#3003)
[lit-html] Provide directive exports via async-directive. Fixes #2790. This is being done for convenience.
1 parent 1ac5805 commit daddeb3

7 files changed

Lines changed: 22 additions & 11 deletions

File tree

.changeset/curly-cars-peel.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'lit-html': patch
3+
'lit': patch
4+
---
5+
6+
Lit's `async-directive` now re-exports everything from the `directive` module.

packages/labs/cli/src/lib/generate/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface GenerateCommand extends Omit<ResolvedCommand, 'run'> {
3535

3636
const frameworkCommands = {
3737
react: reactCommand,
38-
vue: vueCommand
38+
vue: vueCommand,
3939
};
4040

4141
type FrameworkName = keyof typeof frameworkCommands;

packages/labs/context/src/lib/controllers/context-provider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ export class ContextProvider<T extends ContextKey<unknown, unknown>>
5656
public onContextRequest = (
5757
ev: ContextRequestEvent<ContextKey<unknown, unknown>>
5858
): void => {
59-
// Only call the callback if the context matches.
60-
// Also, in case an element is a consumer AND a provider
59+
// Only call the callback if the context matches.
60+
// Also, in case an element is a consumer AND a provider
6161
// of the same context, we want to avoid the element to self-register.
6262
// The check on composedPath (as opposed to ev.target) is to cover cases
63-
// where the consumer is in the shadowDom of the provider (in which case,
63+
// where the consumer is in the shadowDom of the provider (in which case,
6464
// event.target === this.host because of event retargeting).
6565
if (ev.context !== this.context || ev.composedPath()[0] === this.host) {
6666
return;

packages/lit-html/src/async-directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
import {AttributePart, ChildPart, Disconnectable, Part} from './lit-html.js';
122122
import {isSingleExpression} from './directive-helpers.js';
123123
import {Directive, PartInfo, PartType} from './directive.js';
124-
export {directive} from './directive.js';
124+
export * from './directive.js';
125125

126126
const DEV_MODE = true;
127127

packages/lit-html/src/directives/async-replace.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
*/
66

77
import {ChildPart, noChange} from '../lit-html.js';
8-
import {directive, DirectiveParameters} from '../directive.js';
9-
import {AsyncDirective} from '../async-directive.js';
8+
import {
9+
AsyncDirective,
10+
directive,
11+
DirectiveParameters,
12+
} from '../async-directive.js';
1013
import {Pauser, PseudoWeakRef, forAwaitOf} from './private-async-helpers.js';
1114

1215
type Mapper<T> = (v: T, index?: number) => unknown;

packages/lit-html/src/directives/until.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
*/
66

77
import {Part, noChange} from '../lit-html.js';
8-
import {directive} from '../directive.js';
98
import {isPrimitive} from '../directive-helpers.js';
10-
import {AsyncDirective} from '../async-directive.js';
9+
import {directive, AsyncDirective} from '../async-directive.js';
1110
import {Pauser, PseudoWeakRef} from './private-async-helpers.js';
1211

1312
const isPromise = (x: unknown) => {

packages/lit-html/src/test/directive-helpers_test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
66
import {html, ChildPart, render, svg} from 'lit-html';
7-
import {directive, Directive} from 'lit-html/directive.js';
87
import {assert} from '@esm-bundle/chai';
98
import {stripExpressionComments} from './test-utils/strip-markers.js';
109
import {
@@ -18,7 +17,11 @@ import {
1817
TemplateResultType,
1918
} from 'lit-html/directive-helpers.js';
2019
import {classMap} from 'lit-html/directives/class-map.js';
21-
import {AsyncDirective} from 'lit-html/async-directive.js';
20+
import {
21+
directive,
22+
Directive,
23+
AsyncDirective,
24+
} from 'lit-html/async-directive.js';
2225

2326
suite('directive-helpers', () => {
2427
let container: HTMLDivElement;

0 commit comments

Comments
 (0)