@lit-labs/react
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -42,6 +42,4 @@ /** | ||
*/ | ||
export declare const createComponent: <I extends HTMLElement, E extends Events>(React: typeof ReactModule, tagName: string, elementClass: Constructor<I>, events?: E | undefined, displayName?: string | undefined) => ReactModule.ForwardRefExoticComponent<ReactModule.PropsWithRef<Partial<Omit<I, "children">> & Partial<EventProps<E>> & Omit<ReactModule.HTMLAttributes<HTMLElement>, keyof E>> & { | ||
children?: ReactModule.ReactNode; | ||
} & ReactModule.RefAttributes<unknown>>; | ||
export declare const createComponent: <I extends HTMLElement, E extends Events>(React: typeof ReactModule, tagName: string, elementClass: Constructor<I>, events?: E | undefined, displayName?: string) => ReactModule.ForwardRefExoticComponent<ReactModule.PropsWithoutRef<ReactModule.PropsWithChildren<ReactModule.PropsWithRef<Partial<Omit<I, "children">> & Partial<EventProps<E>> & Omit<ReactModule.HTMLAttributes<HTMLElement>, keyof E>>>> & ReactModule.RefAttributes<unknown>>; | ||
export {}; | ||
//# sourceMappingURL=create-component.d.ts.map |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
const t=new Set(["children","localName","ref","style","className"]),e=new WeakMap,n=(t,n,s,o,i)=>{const l=null==i?void 0:i[n];void 0!==l?s!==o&&((t,n,s)=>{let o=e.get(t);void 0===o&&e.set(t,o=new Map);let i=o.get(n);void 0!==s?void 0===i?(o.set(n,i={handleEvent:s}),t.addEventListener(n,i)):i.handleEvent=s:void 0!==i&&(o.delete(n),t.removeEventListener(n,i))})(t,l,s):t[n]=s},s=(e,s,o,i,l)=>{const c=e.Component,r=e.createElement,d=new Set(Object.keys(null!=i?i:{}));for(const e in o.prototype)e in HTMLElement.prototype||(t.has(e)?console.warn(`${s} contains property ${e} which is a React reserved property. It will be used by React and not set on the element.`):d.add(e));class h extends c{constructor(){super(...arguments),this.t=null}o(t){if(null!==this.t)for(const e in this.i)n(this.t,e,this.props[e],t?t[e]:void 0,i)}componentDidMount(){this.o()}componentDidUpdate(t){this.o(t)}render(){const t=this.props.l;void 0!==this.h&&this.u===t||(this.h=e=>{null===this.t&&(this.t=e),null!==t&&((t,e)=>{"function"==typeof t?t(e):t.current=e})(t,e),this.u=t});const e={ref:this.h};this.i={};for(const[t,n]of Object.entries(this.props))"__forwardedRef"!==t&&(d.has(t)?this.i[t]=n:e["className"===t?"class":t]=n);return r(s,e)}}h.displayName=null!=l?l:o.name;const a=e.forwardRef(((t,e)=>r(h,{...t,l:e},null==t?void 0:t.children)));return a.displayName=h.displayName,a};export{s as createComponent}; | ||
const t=new Set(["children","localName","ref","style","className"]),e=new WeakMap,n=(t,n,s,o,i)=>{const l=null==i?void 0:i[n];void 0!==l?s!==o&&((t,n,s)=>{let o=e.get(t);void 0===o&&e.set(t,o=new Map);let i=o.get(n);void 0!==s?void 0===i?(o.set(n,i={handleEvent:s}),t.addEventListener(n,i)):i.handleEvent=s:void 0!==i&&(o.delete(n),t.removeEventListener(n,i))})(t,l,s):t[n]=s},s=(e,s,o,i,l)=>{const c=e.Component,r=e.createElement,d=new Set(Object.keys(null!=i?i:{}));for(const e in o.prototype)e in HTMLElement.prototype||(t.has(e)?console.warn(`${s} contains property ${e} which is a React reserved property. It will be used by React and not set on the element.`):d.add(e));class h extends c{constructor(){super(...arguments),this.o=null}t(t){if(null!==this.o)for(const e in this.i)n(this.o,e,this.props[e],t?t[e]:void 0,i)}componentDidMount(){this.t()}componentDidUpdate(t){this.t(t)}render(){const t=this.props._$Gl;void 0!==this.h&&this.u===t||(this.h=e=>{null===this.o&&(this.o=e),null!==t&&((t,e)=>{"function"==typeof t?t(e):t.current=e})(t,e),this.u=t});const e={ref:this.h};this.i={};for(const[t,n]of Object.entries(this.props))"__forwardedRef"!==t&&(d.has(t)?this.i[t]=n:e["className"===t?"class":t]=n);return r(s,e)}}h.displayName=null!=l?l:o.name;const a=e.forwardRef(((t,e)=>r(h,{...t,_$Gl:e},null==t?void 0:t.children)));return a.displayName=h.displayName,a};export{s as createComponent}; | ||
//# sourceMappingURL=create-component.js.map |
@@ -42,6 +42,4 @@ /** | ||
*/ | ||
export declare const createComponent: <I extends HTMLElement, E extends Events>(React: typeof ReactModule, tagName: string, elementClass: Constructor<I>, events?: E | undefined, displayName?: string | undefined) => ReactModule.ForwardRefExoticComponent<ReactModule.PropsWithRef<Partial<Omit<I, "children">> & Partial<EventProps<E>> & Omit<ReactModule.HTMLAttributes<HTMLElement>, keyof E>> & { | ||
children?: ReactModule.ReactNode; | ||
} & ReactModule.RefAttributes<unknown>>; | ||
export declare const createComponent: <I extends HTMLElement, E extends Events>(React: typeof ReactModule, tagName: string, elementClass: Constructor<I>, events?: E | undefined, displayName?: string) => ReactModule.ForwardRefExoticComponent<ReactModule.PropsWithoutRef<ReactModule.PropsWithChildren<ReactModule.PropsWithRef<Partial<Omit<I, "children">> & Partial<EventProps<E>> & Omit<ReactModule.HTMLAttributes<HTMLElement>, keyof E>>>> & ReactModule.RefAttributes<unknown>>; | ||
export {}; | ||
//# sourceMappingURL=create-component.d.ts.map |
{ | ||
"name": "@lit-labs/react", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A React component wrapper for web components.", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
const t=Promise.resolve();class s{constructor(t,s){this.t=[],this.i=!0,this.o=!1,this.h=t,this.u=s,this.l=new Promise(((t,s)=>{this.v=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.u(++this.h))))}get updateComplete(){return this.l}p(){this.o=!0,this.t.forEach((t=>{var s;return null===(s=t.hostConnected)||void 0===s?void 0:s.call(t)}))}m(){this.o=!1,this.t.forEach((t=>{var s;return null===(s=t.hostDisconnected)||void 0===s?void 0:s.call(t)}))}_(){this.t.forEach((t=>{var s;return null===(s=t.hostUpdate)||void 0===s?void 0:s.call(t)}))}C(){this.i=!1;const t=this.v;this.l=new Promise(((t,s)=>{this.v=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=(i,e)=>{const{useState:r,useLayoutEffect:o}=i,[n,h]=r(0);let u=!1;const[d]=r((()=>{const i=new s(n,h),r=e(i);return i.P=r,i.p(),u=!0,t.then((()=>{u&&i.m()})),i}));return d.i=!0,o((()=>(u=!1,d.o||d.p(),()=>d.m())),[]),o((()=>d.C())),d._(),d.P};export{i as useController}; | ||
const t=Promise.resolve();class s{constructor(t,s){this.v=[],this.p=!0,this._=!1,this.m=t,this.C=s,this.j=new Promise(((t,s)=>{this.O=t}))}addController(t){this.v.push(t)}removeController(t){var s;null===(s=this.v)||void 0===s||s.splice(this.v.indexOf(t)>>>0,1)}requestUpdate(){this.p||(this.p=!0,t.then((()=>this.C(++this.m))))}get updateComplete(){return this.j}M(){this._=!0,this.v.forEach((t=>{var s;return null===(s=t.hostConnected)||void 0===s?void 0:s.call(t)}))}R(){this._=!1,this.v.forEach((t=>{var s;return null===(s=t.hostDisconnected)||void 0===s?void 0:s.call(t)}))}N(){this.v.forEach((t=>{var s;return null===(s=t.hostUpdate)||void 0===s?void 0:s.call(t)}))}P(){this.p=!1;const t=this.O;this.j=new Promise(((t,s)=>{this.O=t})),this.v.forEach((t=>{var s;return null===(s=t.hostUpdated)||void 0===s?void 0:s.call(t)})),t(this.p)}}const i=(i,e)=>{const{useState:r,useLayoutEffect:o}=i,[n,h]=r(0);let u=!1;const[d]=r((()=>{const i=new s(n,h),r=e(i);return i.S=r,i.M(),u=!0,t.then((()=>{u&&i.R()})),i}));return d.p=!0,o((()=>(u=!1,d._||d.M(),()=>d.R())),[]),o((()=>d.P())),d.N(),d.S};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
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
83882
521