Skip to content

Commit

Permalink
Configures Lit to work with its decorators (#4503)
Browse files Browse the repository at this point in the history
* Configures Lit to work with its decorators

* Remove comment
  • Loading branch information
matthewp authored Aug 29, 2022
1 parent feb88af commit 1222ab9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
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,12 @@
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},
str: {type: String, attribute: 'str-attr'},
obj: {type: Object},
reflectedBool: {type: Boolean, reflect: true},
Expand Down Expand Up @@ -36,5 +40,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

0 comments on commit 1222ab9

Please sign in to comment.