diff --git a/package-lock.json b/package-lock.json
index bcb08b118..f8a4e6f97 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -704,6 +704,56 @@
"@lit/reactive-element": "^1.1.0"
}
},
+ "node_modules/@lit/context": {
+ "version": "1.0.0-pre.0",
+ "resolved": "https://registry.npmjs.org/@lit/context/-/context-1.0.0-pre.0.tgz",
+ "integrity": "sha512-svubKJsq9ZQFxl8Zv0GgCPTH8qImydQh5DHJLsQqCkWCcVuhUTe91POlczzr4VfXgCtfMr/2/apmUT9grdqhXA==",
+ "dependencies": {
+ "@lit/reactive-element": "^2.0.0-pre.1",
+ "lit": "^3.0.0-pre.1"
+ }
+ },
+ "node_modules/@lit/context/node_modules/@lit-labs/ssr-dom-shim": {
+ "version": "1.1.2-pre.1",
+ "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.2-pre.1.tgz",
+ "integrity": "sha512-cRy/vafxn20Upocct6LeVzMatmnR0qHvX+7U00jPK0t9sxNaiAmpZyjHSUhLtUnG4jpuJW9UBIhVgYfZcgMo8A=="
+ },
+ "node_modules/@lit/context/node_modules/@lit/reactive-element": {
+ "version": "2.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.0-pre.1.tgz",
+ "integrity": "sha512-oKzaKLYHbXeeqfuDk8uS660Y3aH/LpMoctBwo5u2cS2vMwvurFX6raavNY/xsr4WsatNVn4sbA2VVx50hIAdTw==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0"
+ }
+ },
+ "node_modules/@lit/context/node_modules/lit": {
+ "version": "3.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/lit/-/lit-3.0.0-pre.1.tgz",
+ "integrity": "sha512-HG5serwzvQuJL/G27Knpe7Hy/jFEJo8N2CaZe0pqipD26icgM5aeInWWaoktsKzE/XUc8/l/M5dghFDBhlEWWg==",
+ "dependencies": {
+ "@lit/reactive-element": "^2.0.0-pre.1",
+ "lit-element": "^4.0.0-pre.1",
+ "lit-html": "^3.0.0-pre.1"
+ }
+ },
+ "node_modules/@lit/context/node_modules/lit-element": {
+ "version": "4.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.0.0-pre.1.tgz",
+ "integrity": "sha512-g6z4W3HRponlFEYUVeJXo4KcnxFj1lWTLhFDAkRxmcUq/7xYkvd955dqkwQ8x1XBVgtCA4m2mOYB3RrwfTlVDw==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0",
+ "@lit/reactive-element": "^2.0.0-pre.1",
+ "lit-html": "^3.0.0-pre.1"
+ }
+ },
+ "node_modules/@lit/context/node_modules/lit-html": {
+ "version": "3.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.0.0-pre.1.tgz",
+ "integrity": "sha512-CzDS/69qdDGA/d5DZx8lvcH3uHS8fYnwyGnSo6z7ztKbHYCpHmyGJRfWh/pMXk4ixvkvHUGuRuGgEA8OnxKHJw==",
+ "dependencies": {
+ "@types/trusted-types": "^2.0.2"
+ }
+ },
"node_modules/@lit/localize": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@lit/localize/-/localize-0.10.4.tgz",
@@ -713,6 +763,14 @@
"lit": "^2.0.0"
}
},
+ "node_modules/@lit/react": {
+ "version": "1.0.0-pre.0",
+ "resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.0-pre.0.tgz",
+ "integrity": "sha512-okNFKmN333NcVe5ofpJrVE+9KKPnt2zDZaarQ3rnnw/20sCcrXIcAqtlUGmfjIzFzJOqu9byV8oqI54+p/I8Rg==",
+ "peerDependencies": {
+ "@types/react": "17 || 18"
+ }
+ },
"node_modules/@lit/reactive-element": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.6.1.tgz",
@@ -721,6 +779,27 @@
"@lit-labs/ssr-dom-shim": "^1.0.0"
}
},
+ "node_modules/@lit/task": {
+ "version": "1.0.0-pre.0",
+ "resolved": "https://registry.npmjs.org/@lit/task/-/task-1.0.0-pre.0.tgz",
+ "integrity": "sha512-9O+XywEqW7LA8Clw5yF/oFG5rTJrjpF7cm5ti3k6maemDUPo2HV7yh0Co7rNEPPSRqucEDG5s9OHmxPBFxVu9g==",
+ "dependencies": {
+ "@lit/reactive-element": "^2.0.0-pre.1"
+ }
+ },
+ "node_modules/@lit/task/node_modules/@lit-labs/ssr-dom-shim": {
+ "version": "1.1.2-pre.1",
+ "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.2-pre.1.tgz",
+ "integrity": "sha512-cRy/vafxn20Upocct6LeVzMatmnR0qHvX+7U00jPK0t9sxNaiAmpZyjHSUhLtUnG4jpuJW9UBIhVgYfZcgMo8A=="
+ },
+ "node_modules/@lit/task/node_modules/@lit/reactive-element": {
+ "version": "2.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.0-pre.1.tgz",
+ "integrity": "sha512-oKzaKLYHbXeeqfuDk8uS660Y3aH/LpMoctBwo5u2cS2vMwvurFX6raavNY/xsr4WsatNVn4sbA2VVx50hIAdTw==",
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0"
+ }
+ },
"node_modules/@lit/ts-transformers": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@lit/ts-transformers/-/ts-transformers-1.1.1.tgz",
@@ -2146,8 +2225,7 @@
"node_modules/@types/prop-types": {
"version": "15.7.5",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
- "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==",
- "dev": true
+ "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w=="
},
"node_modules/@types/qs": {
"version": "6.9.7",
@@ -2163,7 +2241,6 @@
"version": "18.2.6",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.6.tgz",
"integrity": "sha512-wRZClXn//zxCFW+ye/D2qY65UsYP1Fpex2YXorHc8awoNamkMZSvBxwxdYVInsHOZZd2Ppq8isnSzJL5Mpf8OA==",
- "dev": true,
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
@@ -2196,8 +2273,7 @@
"node_modules/@types/scheduler": {
"version": "0.16.2",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
- "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==",
- "dev": true
+ "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
},
"node_modules/@types/serve-static": {
"version": "1.13.10",
@@ -3574,8 +3650,7 @@
"node_modules/csstype": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.0.tgz",
- "integrity": "sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==",
- "dev": true
+ "integrity": "sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA=="
},
"node_modules/data-uri-to-buffer": {
"version": "4.0.0",
@@ -9154,7 +9229,10 @@
"@lit-labs/motion": "^1.0.1",
"@lit-labs/react": "^1.0.8",
"@lit-labs/task": "^3.0.2",
+ "@lit/context": "^1.0.0 || 1.0.0-pre.0",
"@lit/localize": "^0.10.0",
+ "@lit/react": "^1.0.0 || 1.0.0-pre.0",
+ "@lit/task": "^1.0.0 || 1.0.0-pre.0",
"@material/mwc-button": "^0.27.0",
"@material/mwc-checkbox": "^0.27.0",
"@material/mwc-dialog": "^0.27.0",
@@ -9913,6 +9991,58 @@
"@lit/reactive-element": "^1.1.0"
}
},
+ "@lit/context": {
+ "version": "1.0.0-pre.0",
+ "resolved": "https://registry.npmjs.org/@lit/context/-/context-1.0.0-pre.0.tgz",
+ "integrity": "sha512-svubKJsq9ZQFxl8Zv0GgCPTH8qImydQh5DHJLsQqCkWCcVuhUTe91POlczzr4VfXgCtfMr/2/apmUT9grdqhXA==",
+ "requires": {
+ "@lit/reactive-element": "^2.0.0-pre.1",
+ "lit": "^3.0.0-pre.1"
+ },
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": {
+ "version": "1.1.2-pre.1",
+ "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.2-pre.1.tgz",
+ "integrity": "sha512-cRy/vafxn20Upocct6LeVzMatmnR0qHvX+7U00jPK0t9sxNaiAmpZyjHSUhLtUnG4jpuJW9UBIhVgYfZcgMo8A=="
+ },
+ "@lit/reactive-element": {
+ "version": "2.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.0-pre.1.tgz",
+ "integrity": "sha512-oKzaKLYHbXeeqfuDk8uS660Y3aH/LpMoctBwo5u2cS2vMwvurFX6raavNY/xsr4WsatNVn4sbA2VVx50hIAdTw==",
+ "requires": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0"
+ }
+ },
+ "lit": {
+ "version": "3.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/lit/-/lit-3.0.0-pre.1.tgz",
+ "integrity": "sha512-HG5serwzvQuJL/G27Knpe7Hy/jFEJo8N2CaZe0pqipD26icgM5aeInWWaoktsKzE/XUc8/l/M5dghFDBhlEWWg==",
+ "requires": {
+ "@lit/reactive-element": "^2.0.0-pre.1",
+ "lit-element": "^4.0.0-pre.1",
+ "lit-html": "^3.0.0-pre.1"
+ }
+ },
+ "lit-element": {
+ "version": "4.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.0.0-pre.1.tgz",
+ "integrity": "sha512-g6z4W3HRponlFEYUVeJXo4KcnxFj1lWTLhFDAkRxmcUq/7xYkvd955dqkwQ8x1XBVgtCA4m2mOYB3RrwfTlVDw==",
+ "requires": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0",
+ "@lit/reactive-element": "^2.0.0-pre.1",
+ "lit-html": "^3.0.0-pre.1"
+ }
+ },
+ "lit-html": {
+ "version": "3.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.0.0-pre.1.tgz",
+ "integrity": "sha512-CzDS/69qdDGA/d5DZx8lvcH3uHS8fYnwyGnSo6z7ztKbHYCpHmyGJRfWh/pMXk4ixvkvHUGuRuGgEA8OnxKHJw==",
+ "requires": {
+ "@types/trusted-types": "^2.0.2"
+ }
+ }
+ }
+ },
"@lit/localize": {
"version": "0.10.4",
"resolved": "https://registry.npmjs.org/@lit/localize/-/localize-0.10.4.tgz",
@@ -9922,6 +10052,12 @@
"lit": "^2.0.0"
}
},
+ "@lit/react": {
+ "version": "1.0.0-pre.0",
+ "resolved": "https://registry.npmjs.org/@lit/react/-/react-1.0.0-pre.0.tgz",
+ "integrity": "sha512-okNFKmN333NcVe5ofpJrVE+9KKPnt2zDZaarQ3rnnw/20sCcrXIcAqtlUGmfjIzFzJOqu9byV8oqI54+p/I8Rg==",
+ "requires": {}
+ },
"@lit/reactive-element": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.6.1.tgz",
@@ -9930,6 +10066,29 @@
"@lit-labs/ssr-dom-shim": "^1.0.0"
}
},
+ "@lit/task": {
+ "version": "1.0.0-pre.0",
+ "resolved": "https://registry.npmjs.org/@lit/task/-/task-1.0.0-pre.0.tgz",
+ "integrity": "sha512-9O+XywEqW7LA8Clw5yF/oFG5rTJrjpF7cm5ti3k6maemDUPo2HV7yh0Co7rNEPPSRqucEDG5s9OHmxPBFxVu9g==",
+ "requires": {
+ "@lit/reactive-element": "^2.0.0-pre.1"
+ },
+ "dependencies": {
+ "@lit-labs/ssr-dom-shim": {
+ "version": "1.1.2-pre.1",
+ "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.2-pre.1.tgz",
+ "integrity": "sha512-cRy/vafxn20Upocct6LeVzMatmnR0qHvX+7U00jPK0t9sxNaiAmpZyjHSUhLtUnG4jpuJW9UBIhVgYfZcgMo8A=="
+ },
+ "@lit/reactive-element": {
+ "version": "2.0.0-pre.1",
+ "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.0.0-pre.1.tgz",
+ "integrity": "sha512-oKzaKLYHbXeeqfuDk8uS660Y3aH/LpMoctBwo5u2cS2vMwvurFX6raavNY/xsr4WsatNVn4sbA2VVx50hIAdTw==",
+ "requires": {
+ "@lit-labs/ssr-dom-shim": "^1.1.2-pre.0"
+ }
+ }
+ }
+ },
"@lit/ts-transformers": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@lit/ts-transformers/-/ts-transformers-1.1.1.tgz",
@@ -11282,8 +11441,7 @@
"@types/prop-types": {
"version": "15.7.5",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
- "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==",
- "dev": true
+ "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w=="
},
"@types/qs": {
"version": "6.9.7",
@@ -11299,7 +11457,6 @@
"version": "18.2.6",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.6.tgz",
"integrity": "sha512-wRZClXn//zxCFW+ye/D2qY65UsYP1Fpex2YXorHc8awoNamkMZSvBxwxdYVInsHOZZd2Ppq8isnSzJL5Mpf8OA==",
- "dev": true,
"requires": {
"@types/prop-types": "*",
"@types/scheduler": "*",
@@ -11332,8 +11489,7 @@
"@types/scheduler": {
"version": "0.16.2",
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
- "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==",
- "dev": true
+ "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
},
"@types/serve-static": {
"version": "1.13.10",
@@ -12434,8 +12590,7 @@
"csstype": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.0.tgz",
- "integrity": "sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==",
- "dev": true
+ "integrity": "sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA=="
},
"data-uri-to-buffer": {
"version": "4.0.0",
@@ -14386,7 +14541,10 @@
"@lit-labs/ssr": "^3.1.2",
"@lit-labs/ssr-client": "^1.1.1",
"@lit-labs/task": "^3.0.2",
+ "@lit/context": "^1.0.0 || 1.0.0-pre.0",
"@lit/localize": "^0.10.0",
+ "@lit/react": "^1.0.0 || 1.0.0-pre.0",
+ "@lit/task": "^1.0.0 || 1.0.0-pre.0",
"@material/mwc-button": "^0.27.0",
"@material/mwc-checkbox": "^0.27.0",
"@material/mwc-dialog": "^0.27.0",
diff --git a/packages/lit-dev-content/package.json b/packages/lit-dev-content/package.json
index 9844da21e..433f5c5eb 100644
--- a/packages/lit-dev-content/package.json
+++ b/packages/lit-dev-content/package.json
@@ -199,6 +199,9 @@
"@lit-labs/react": "^1.0.8",
"@lit-labs/task": "^3.0.2",
"@lit/localize": "^0.10.0",
+ "@lit/context": "^1.0.0 || 1.0.0-pre.0",
+ "@lit/react": "^1.0.0 || 1.0.0-pre.0",
+ "@lit/task": "^1.0.0 || 1.0.0-pre.0",
"@material/mwc-button": "^0.27.0",
"@material/mwc-checkbox": "^0.27.0",
"@material/mwc-dialog": "^0.27.0",
diff --git a/packages/lit-dev-content/samples/examples/async-task/npm-info.ts b/packages/lit-dev-content/samples/examples/async-task/npm-info.ts
index b4a71353f..5175f0b5f 100644
--- a/packages/lit-dev-content/samples/examples/async-task/npm-info.ts
+++ b/packages/lit-dev-content/samples/examples/async-task/npm-info.ts
@@ -1,31 +1,39 @@
import {LitElement, css, html} from 'lit';
import {customElement, state} from 'lit/decorators.js';
-import {Task} from '@lit-labs/task';
+import {map} from 'lit/directives/map.js';
+import {Task, initialState} from '@lit/task';
import {fetchPackageInfo} from './npm.js';
@customElement('npm-info')
export class NpmInfo extends LitElement {
@state()
- private _package = 'lit';
+ private _packageName = 'lit';
- private _fetchNpmInfoTask = new Task(this, {
+ /*
+ * This is the async Task that fetches data from npm.
+ *
+ * The current state of the task is rendered below with
+ * `this._npmInfoTask.render()`.
+ */
+ private _npmInfoTask = new Task(this, {
task: async ([pkgName], {signal}) => {
if (pkgName === undefined || pkgName === '') {
- throw new Error('Empty package name');
+ // This puts the task back into the INITIAL state
+ return initialState;
}
return await fetchPackageInfo(pkgName, signal);
},
- args: () => [this._package],
+ args: () => [this._packageName],
});
render() {
return html`
${this._package}
+ ${this._packageName}
${this._packageName}
`,
complete: (pkg) => html`
${tag}: ${version}