Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configures Lit to work with its decorators #4503

Merged
merged 2 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/beige-students-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/lit': patch
---

Allow using Lit's decorators
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';

@customElement('my-element')
export class MyElement extends LitElement {
@property({ type: Boolean })
bool = 0;

static properties = {
bool: {type: Boolean},
//bool: {type: Boolean},
matthewp marked this conversation as resolved.
Show resolved Hide resolved
str: {type: String, attribute: 'str-attr'},
obj: {type: Object},
reflectedBool: {type: Boolean, reflect: true},
Expand Down Expand Up @@ -36,5 +41,3 @@ export class MyElement extends LitElement {
`;
}
}

customElements.define('my-element', MyElement);
3 changes: 3 additions & 0 deletions packages/astro/test/fixtures/lit-element/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"experimentalDecorators": true
}
2 changes: 1 addition & 1 deletion packages/integrations/lit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function getViteConfiguration() {
exclude: ['@astrojs/lit/server.js'],
},
ssr: {
external: ['lit-element', '@lit-labs/ssr', '@astrojs/lit'],
external: ['lit-element', '@lit-labs/ssr', '@astrojs/lit', 'lit/decorators.js'],
},
};
}
Expand Down