Skip to content

Commit 6b92ea1

Browse files
Feat/lit2 (#369)
* wip: upgrade to lit 2 * Replacing references of NodePart to ChildPart per Lit 2.0 upgrade guide. Upgrading testing dependency to use Lit 2.0. Five failing tests. * WIP: Virtual components w/ Lit 2.0. Three failing tests. * Some tweaks, but still have failing tests. * Switching to AsyncDirective per the lit 2.0 upgrade guide. One failing test. * The lit 2 upgrade guide had indicated that the weakmaps should be removed in favor of state within the directive class. In our case it turns out we needed those weakmaps because that is how we keep track of schedulers for the virtual components. * Upgrading some dev dependencies in an effort to purge older versions of lit from the lock file. Only partially successful. * Updating check in virtual component update() method to address issue #337. * Reverting rocket dev dependencies. Co-authored-by: Benny Powers <[email protected]>
1 parent d85d7a6 commit 6b92ea1

23 files changed

+18937
-2684
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ lib/*.js: src/*.ts
1111

1212
haunted.js: lib/*.js
1313
$(COMPILE) -f es -o $@ -e lit-html lib/haunted.js
14-
./sed.sh -i.bu 's/lit-html/https:\/\/unpkg\.com\/lit-html@\^1\.0\.0\/lit-html\.js/' $@
14+
./sed.sh -i.bu 's/lit/https:\/\/unpkg\.com\/lit\?module/' $@
1515
rm -f $@.bu
1616

1717
web.js: haunted.js
18-
./sed.sh 's/https:\/\/unpkg\.com\/lit-html@\^1\.0\.0\/lit-html\.js/\.\.\/lit-html\/lit-html\.js/' $^ > $@
18+
./sed.sh 's/https:\/\/unpkg\.com\/lit\?module/\.\.\/lit\/index.js/' $^ > $@
1919

2020
clean:
2121
@rm -rf lib haunted.js web.js

custom-elements.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,15 @@
300300
"name": "html",
301301
"declaration": {
302302
"name": "html",
303-
"package": "https://unpkg.com/lit-html@^1.0.0/lit-html.js"
303+
"package": "https://unpkg.com/lit?module"
304304
}
305305
},
306306
{
307307
"kind": "js",
308308
"name": "render",
309309
"declaration": {
310310
"name": "render",
311-
"package": "https://unpkg.com/lit-html@^1.0.0/lit-html.js"
311+
"package": "https://unpkg.com/lit?module"
312312
}
313313
},
314314
{

docs/docs/guides/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The main entry point is intended for [lit-html](https://github.com/Polymer/lit-h
5959
**Haunted** can work directly in the browser without using any build tools. Simply import the `haunted.js` bundle. You can use the [unpkg](https://unpkg.com/) or [pika](https://www.pika.dev/cdn) CDNs. This works great for demo pages and small apps. Here's an example with unpkg:
6060

6161
```js
62-
import { html } from 'https://unpkg.com/lit-html/lit-html.js';
62+
import { html } from 'https://unpkg.com/lit?module';
6363
import { component, useState } from 'https://unpkg.com/haunted/haunted.js';
6464
```
6565

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ callToActionItems:
1616
</style>
1717

1818
```js playground example my-counter.js
19-
import { html } from 'https://unpkg.com/lit-html/lit-html.js';
19+
import { html } from 'https://unpkg.com/lit?module';
2020
import { component, useState } from 'https://unpkg.com/haunted/haunted.js';
2121

2222
function Counter() {

examples/counter.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<my-counter></my-counter>
44

55
<script type="module">
6-
import { html } from 'https://unpkg.com/lit-html/lit-html.js';
6+
import { html } from 'https://unpkg.com/lit?module';
77
import { component, useState } from '../haunted.js';
88

99
function Counter() {
@@ -16,4 +16,4 @@
1616
}
1717

1818
customElements.define('my-counter', component(Counter));
19-
</script>
19+
</script>

examples/lit/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { html } from 'https://unpkg.com/lit[email protected]/lit-element.js?module';
1+
import { html } from 'https://unpkg.com/lit?module';
22
import { useState } from '../../haunted.js';
33
import LitHauntedElement, { litHaunted } from './lit-haunted-element.js';
44

@@ -32,7 +32,7 @@ function App() {
3232
return html`
3333
<p>A paragraph</p>
3434
<click-element @increment=${() => setCount(count + 1)}></click-element>
35-
35+
3636
<p><strong>Count:</strong> ${count}</p>
3737
`;
3838
}

examples/lit/lit-haunted-element.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LitElement } from 'https://unpkg.com/lit[email protected]/lit-element.js?module';
1+
import { LitElement } from 'https://unpkg.com/lit?module';
22
import { State } from '../../haunted.js';
33

44
export default class LitHauntedElement extends LitElement {
@@ -25,4 +25,4 @@ export const litHaunted = (renderer) => {
2525
return renderer.call(this, this);
2626
}
2727
}
28-
};
28+
};

examples/lit/make-base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LitElement } from 'https://unpkg.com/lit[email protected]/lit-element.js?module';
1+
import { LitElement } from 'https://unpkg.com/lit?module';
22
import { State } from '../../haunted.js';
33

44
export default function(renderer) {
@@ -30,4 +30,4 @@ export default function(renderer) {
3030
super.disconnectedCallback();
3131
}
3232
}
33-
}
33+
}

examples/memo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<my-app></my-app>
44

55
<script type="module">
6-
import { html } from 'https://unpkg.com/lit-html/lit-html.js';
6+
import { html } from 'https://unpkg.com/lit?module';
77
import { component, useMemo, useState } from '../haunted.js';
88

99
function fibonacci(num) {

examples/props.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<my-parent></my-parent>
33

44
<script type="module">
5-
import { html } from 'https://unpkg.com/lit-html/lit-html.js';
5+
import { html } from 'https://unpkg.com/lit?module';
66
import { component, useState } from '../haunted.js';
77

88
function MyParent() {

0 commit comments

Comments
 (0)