From 3b77c3b99fa7ea995eb10f884aed04f4baa23c4b Mon Sep 17 00:00:00 2001 From: Alan Chambers Date: Thu, 14 Sep 2023 16:13:29 +0100 Subject: [PATCH 1/2] updated react wrapper (#1565) - updated @lit-labs/react to latest version with improved type compatibility - added small preact section to the react docs with link to preact/compat typescript config guide --- docs/pages/frameworks/react.md | 4 ++++ package-lock.json | 14 +++++++------- package.json | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/pages/frameworks/react.md b/docs/pages/frameworks/react.md index 86f208efea..b87cb9c700 100644 --- a/docs/pages/frameworks/react.md +++ b/docs/pages/frameworks/react.md @@ -32,6 +32,10 @@ If you'd rather not use the CDN for assets, you can create a [build task](https: Now you can start using components! +### Preact + +Preact users facing type errors using components may benefit from setting "paths" in their tsconfig.json so that react types will instead resolve to preact/compat as described in [Preact's typescript documentation](https://preactjs.com/guide/v10/typescript/#typescript-preactcompat-configuration). + ## Usage ### Importing Components diff --git a/package-lock.json b/package-lock.json index 44151bdb5b..f5355740dc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@ctrl/tinycolor": "^4.0.1", "@floating-ui/dom": "^1.2.1", - "@lit-labs/react": "^2.0.1", + "@lit-labs/react": "^2.0.3", "@shoelace-style/animations": "^1.1.0", "@shoelace-style/localize": "^3.1.1", "composed-offset-position": "^0.0.4", @@ -1474,9 +1474,9 @@ } }, "node_modules/@lit-labs/react": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@lit-labs/react/-/react-2.0.1.tgz", - "integrity": "sha512-Nj+XB3HamqaWefN91lpFPJaqjJ78XzGkPWCedB4jyH22GBFEenpE9A/h8B/2dnIGXtNtd9D/RFpUdQ/dBtWFqA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@lit-labs/react/-/react-2.0.3.tgz", + "integrity": "sha512-lSvWbTrbxWqYv/iiOwbAEJfFZrKjO/QjJ4IEXhg43sdD5fNFz4wRXpVsntfVn4DnxpQd+NVRnrsF2USgK0XCTw==", "peerDependencies": { "@types/react": "17 || 18" } @@ -18290,9 +18290,9 @@ } }, "@lit-labs/react": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@lit-labs/react/-/react-2.0.1.tgz", - "integrity": "sha512-Nj+XB3HamqaWefN91lpFPJaqjJ78XzGkPWCedB4jyH22GBFEenpE9A/h8B/2dnIGXtNtd9D/RFpUdQ/dBtWFqA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@lit-labs/react/-/react-2.0.3.tgz", + "integrity": "sha512-lSvWbTrbxWqYv/iiOwbAEJfFZrKjO/QjJ4IEXhg43sdD5fNFz4wRXpVsntfVn4DnxpQd+NVRnrsF2USgK0XCTw==", "requires": {} }, "@lit-labs/ssr-dom-shim": { diff --git a/package.json b/package.json index a13591147b..a0de7626a1 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "dependencies": { "@ctrl/tinycolor": "^4.0.1", "@floating-ui/dom": "^1.2.1", - "@lit-labs/react": "^2.0.1", + "@lit-labs/react": "^2.0.3", "@shoelace-style/animations": "^1.1.0", "@shoelace-style/localize": "^3.1.1", "composed-offset-position": "^0.0.4", From 1d28e1bbc53fcee43840b2db16a10904a53b0c1f Mon Sep 17 00:00:00 2001 From: Christian Schuller Date: Thu, 14 Sep 2023 17:17:12 +0200 Subject: [PATCH 2/2] fix: add missing super.disconnectCallback() calls (#1564) --- src/components/details/details.component.ts | 1 + src/components/mutation-observer/mutation-observer.component.ts | 1 + src/components/popup/popup.component.ts | 1 + src/components/tab-group/tab-group.component.ts | 1 + 4 files changed, 4 insertions(+) diff --git a/src/components/details/details.component.ts b/src/components/details/details.component.ts index b7eab44608..d8b83a43cf 100644 --- a/src/components/details/details.component.ts +++ b/src/components/details/details.component.ts @@ -87,6 +87,7 @@ export default class SlDetails extends ShoelaceElement { } disconnectedCallback() { + super.disconnectedCallback(); this.detailsObserver.disconnect(); } diff --git a/src/components/mutation-observer/mutation-observer.component.ts b/src/components/mutation-observer/mutation-observer.component.ts index 61b05ce45b..85ed39e7b4 100644 --- a/src/components/mutation-observer/mutation-observer.component.ts +++ b/src/components/mutation-observer/mutation-observer.component.ts @@ -52,6 +52,7 @@ export default class SlMutationObserver extends ShoelaceElement { } disconnectedCallback() { + super.disconnectedCallback(); this.stopObserver(); } diff --git a/src/components/popup/popup.component.ts b/src/components/popup/popup.component.ts index 3ab4c0d10d..f04f0be407 100644 --- a/src/components/popup/popup.component.ts +++ b/src/components/popup/popup.component.ts @@ -198,6 +198,7 @@ export default class SlPopup extends ShoelaceElement { } disconnectedCallback() { + super.disconnectedCallback(); this.stop(); } diff --git a/src/components/tab-group/tab-group.component.ts b/src/components/tab-group/tab-group.component.ts index f1753807ef..27ecf18a34 100644 --- a/src/components/tab-group/tab-group.component.ts +++ b/src/components/tab-group/tab-group.component.ts @@ -117,6 +117,7 @@ export default class SlTabGroup extends ShoelaceElement { } disconnectedCallback() { + super.disconnectedCallback(); this.mutationObserver.disconnect(); this.resizeObserver.unobserve(this.nav); }