@lit-labs/react
Advanced tools
Comparing version 1.0.0-rc.1 to 1.0.0-rc.2
@@ -20,2 +20,8 @@ # Change Log | ||
## [1.0.0-rc.2] - 2021-05-07 | ||
### Fixed | ||
- Fixed a bug where `host.requestUpdate()` only worked on the first call from within `useController()`. | ||
## [1.0.0-rc.1] - 2021-04-20 | ||
@@ -22,0 +28,0 @@ |
@@ -34,3 +34,3 @@ /** | ||
*/ | ||
export declare const createComponent: <I extends HTMLElement, E>(React: typeof ReactModule, tagName: string, elementClass: Constructor<I>, events?: StringValued<E> | undefined) => ReactModule.ForwardRefExoticComponent<ReactModule.PropsWithRef<Partial<I> & Events<E>> & { | ||
export declare const createComponent: <I extends HTMLElement, E>(React: typeof ReactModule, tagName: string, elementClass: Constructor<I>, events?: StringValued<E> | undefined) => ReactModule.ForwardRefExoticComponent<ReactModule.PropsWithRef<Partial<Pick<I, Exclude<keyof I, "children">>> & Events<E>> & { | ||
children?: ReactModule.ReactNode; | ||
@@ -37,0 +37,0 @@ } & ReactModule.RefAttributes<unknown>>; |
{ | ||
"name": "@lit-labs/react", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"description": "A React component wrapper for web components.", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
@@ -126,4 +126,6 @@ /** | ||
// ref, as well as special event and element properties. | ||
// TODO: we might need to omit more properties from HTMLElement than just | ||
// 'children', but 'children' is special to JSX, so we must at least do that. | ||
type UserProps = React.PropsWithChildren< | ||
React.PropsWithRef<Partial<I> & Events<E>> | ||
React.PropsWithRef<Partial<Omit<I, 'children'>> & Events<E>> | ||
>; | ||
@@ -130,0 +132,0 @@ |
/** | ||
* @license | ||
* Copyright (c) 2021 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at | ||
* http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at | ||
* http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at | ||
* http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at | ||
* http://polymer.github.io/PATENTS.txt | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
@@ -70,3 +62,3 @@ | ||
// Trigger a React update by updating some state | ||
microtask.then(() => this._kick(this._kickCount + 1)); | ||
microtask.then(() => this._kick(++this._kickCount)); | ||
} | ||
@@ -73,0 +65,0 @@ } |
/** | ||
* @license | ||
* Copyright (c) 2021 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at | ||
* http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at | ||
* http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at | ||
* http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at | ||
* http://polymer.github.io/PATENTS.txt | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
@@ -14,0 +6,0 @@ import type * as ReactModule from 'react'; |
/** | ||
* @license | ||
* Copyright (c) 2021 The Polymer Project Authors. All rights reserved. | ||
* This code may only be used under the BSD style license found at | ||
* http://polymer.github.io/LICENSE.txt | ||
* The complete set of authors may be found at | ||
* http://polymer.github.io/AUTHORS.txt | ||
* The complete set of contributors may be found at | ||
* http://polymer.github.io/CONTRIBUTORS.txt | ||
* Code distributed by Google as part of the polymer project is also | ||
* subject to an additional IP rights grant found at | ||
* http://polymer.github.io/PATENTS.txt | ||
* Copyright 2021 Google LLC | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
const t=Promise.resolve();class s{constructor(t,s){this.t=[],this.i=!0,this.o=t,this.h=s,this.u=new Promise(((t,s)=>{this.l=t}))}addController(t){this.t.push(t)}removeController(t){var s;null===(s=this.t)||void 0===s||s.splice(this.t.indexOf(t)>>>0,1)}requestUpdate(){this.i||(this.i=!0,t.then((()=>this.h(this.o+1))))}get updateComplete(){return this.u}v(){this.t.forEach((t=>{var s;return null===(s=t.hostConnected)||void 0===s?void 0:s.call(t)}))}p(){this.t.forEach((t=>{var s;return null===(s=t.hostDisconnected)||void 0===s?void 0:s.call(t)}))}m(){this.t.forEach((t=>{var s;return null===(s=t.hostUpdate)||void 0===s?void 0:s.call(t)}))}_(){this.i=!1;const t=this.l;this.u=new Promise(((t,s)=>{this.l=t})),this.t.forEach((t=>{var s;return null===(s=t.hostUpdated)||void 0===s?void 0:s.call(t)})),t(this.i)}}const i=(t,i)=>{const{useState:e,useLayoutEffect:r}=t,[o,n]=e(0),[h]=e((()=>{const t=new s(o,n),e=i(t);return t.g=e,t.v(),t}));return h.i=!0,r((()=>h._())),r((()=>()=>h.p()),[]),h.m(),h.g};export{i as useController}; | ||
const t=Promise.resolve();class s{constructor(t,s){this.t=[],this.i=!0,this.o=t,this.h=s,this.u=new Promise(((t,s)=>{this.l=t}))}addController(t){this.t.push(t)}removeController(t){var s;null===(s=this.t)||void 0===s||s.splice(this.t.indexOf(t)>>>0,1)}requestUpdate(){this.i||(this.i=!0,t.then((()=>this.h(++this.o))))}get updateComplete(){return this.u}v(){this.t.forEach((t=>{var s;return null===(s=t.hostConnected)||void 0===s?void 0:s.call(t)}))}p(){this.t.forEach((t=>{var s;return null===(s=t.hostDisconnected)||void 0===s?void 0:s.call(t)}))}m(){this.t.forEach((t=>{var s;return null===(s=t.hostUpdate)||void 0===s?void 0:s.call(t)}))}_(){this.i=!1;const t=this.l;this.u=new Promise(((t,s)=>{this.l=t})),this.t.forEach((t=>{var s;return null===(s=t.hostUpdated)||void 0===s?void 0:s.call(t)})),t(this.i)}}const i=(t,i)=>{const{useState:e,useLayoutEffect:r}=t,[o,n]=e(0),[h]=e((()=>{const t=new s(o,n),e=i(t);return t.g=e,t.v(),t}));return h.i=!0,r((()=>h._())),r((()=>()=>h.p()),[]),h.m(),h.g};export{i as useController}; | ||
//# sourceMappingURL=use-controller.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
47393
461