@lit-labs/observers
Advanced tools
Comparing version 2.0.0 to 2.0.1-pre.0
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type IntersectionValueCallback<T = unknown> = (...args: Parameters<IntersectionObserverCallback>) => T; | ||
export type IntersectionValueCallback<T = unknown> = (...args: Parameters<IntersectionObserverCallback>) => T; | ||
/** | ||
@@ -13,0 +13,0 @@ * The config options for a IntersectionController. |
@@ -32,5 +32,5 @@ /** | ||
if (target !== null) { | ||
this._targets.add(target !== null && target !== void 0 ? target : host); | ||
this._targets.add(target ?? host); | ||
} | ||
this._skipInitial = skipInitial !== null && skipInitial !== void 0 ? skipInitial : this._skipInitial; | ||
this._skipInitial = skipInitial ?? this._skipInitial; | ||
this.callback = callback; | ||
@@ -58,4 +58,3 @@ // Check browser support. | ||
handleChanges(entries) { | ||
var _a; | ||
this.value = (_a = this.callback) === null || _a === void 0 ? void 0 : _a.call(this, entries, this._observer); | ||
this.value = this.callback?.(entries, this._observer); | ||
} | ||
@@ -62,0 +61,0 @@ hostConnected() { |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type MutationValueCallback<T = unknown> = (...args: Parameters<MutationCallback>) => T; | ||
export type MutationValueCallback<T = unknown> = (...args: Parameters<MutationCallback>) => T; | ||
/** | ||
@@ -13,0 +13,0 @@ * The config options for a MutationController. |
@@ -30,6 +30,6 @@ /** | ||
if (target !== null) { | ||
this._targets.add(target !== null && target !== void 0 ? target : host); | ||
this._targets.add(target ?? host); | ||
} | ||
this._config = config; | ||
this._skipInitial = skipInitial !== null && skipInitial !== void 0 ? skipInitial : this._skipInitial; | ||
this._skipInitial = skipInitial ?? this._skipInitial; | ||
this.callback = callback; | ||
@@ -52,4 +52,3 @@ // Check browser support. | ||
handleChanges(records) { | ||
var _a; | ||
this.value = (_a = this.callback) === null || _a === void 0 ? void 0 : _a.call(this, records, this._observer); | ||
this.value = this.callback?.(records, this._observer); | ||
} | ||
@@ -56,0 +55,0 @@ hostConnected() { |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type PerformanceValueCallback<T = unknown> = (entries: PerformanceEntryList, observer: PerformanceObserver, entryList?: PerformanceObserverEntryList) => T; | ||
export type PerformanceValueCallback<T = unknown> = (entries: PerformanceEntryList, observer: PerformanceObserver, entryList?: PerformanceObserverEntryList) => T; | ||
/** | ||
@@ -13,0 +13,0 @@ * The config options for a PerformanceController. |
@@ -25,3 +25,3 @@ /** | ||
this._config = config; | ||
this._skipInitial = skipInitial !== null && skipInitial !== void 0 ? skipInitial : this._skipInitial; | ||
this._skipInitial = skipInitial ?? this._skipInitial; | ||
this.callback = callback; | ||
@@ -44,4 +44,3 @@ // Check browser support. | ||
handleChanges(entries, entryList) { | ||
var _a; | ||
this.value = (_a = this.callback) === null || _a === void 0 ? void 0 : _a.call(this, entries, this._observer, entryList); | ||
this.value = this.callback?.(entries, this._observer, entryList); | ||
} | ||
@@ -48,0 +47,0 @@ hostConnected() { |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type ResizeValueCallback<T = unknown> = (...args: Parameters<ResizeObserverCallback>) => T; | ||
export type ResizeValueCallback<T = unknown> = (...args: Parameters<ResizeObserverCallback>) => T; | ||
/** | ||
@@ -13,0 +13,0 @@ * The config options for a ResizeController. |
@@ -29,6 +29,6 @@ /** | ||
if (target !== null) { | ||
this._targets.add(target !== null && target !== void 0 ? target : host); | ||
this._targets.add(target ?? host); | ||
} | ||
this._config = config; | ||
this._skipInitial = skipInitial !== null && skipInitial !== void 0 ? skipInitial : this._skipInitial; | ||
this._skipInitial = skipInitial ?? this._skipInitial; | ||
this.callback = callback; | ||
@@ -51,4 +51,3 @@ // Check browser support. | ||
handleChanges(entries) { | ||
var _a; | ||
this.value = (_a = this.callback) === null || _a === void 0 ? void 0 : _a.call(this, entries, this._observer); | ||
this.value = this.callback?.(entries, this._observer); | ||
} | ||
@@ -55,0 +54,0 @@ hostConnected() { |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type IntersectionValueCallback<T = unknown> = (...args: Parameters<IntersectionObserverCallback>) => T; | ||
export type IntersectionValueCallback<T = unknown> = (...args: Parameters<IntersectionObserverCallback>) => T; | ||
/** | ||
@@ -13,0 +13,0 @@ * The config options for a IntersectionController. |
@@ -1,2 +0,2 @@ | ||
class t{constructor(t,{target:s,config:i,callback:h,skipInitial:e}){this.t=new Set,this.o=!1,this.i=!1,this.h=t,null!==s&&this.t.add(null!=s?s:t),this.o=null!=e?e:this.o,this.callback=h,window.IntersectionObserver?(this.u=new IntersectionObserver((t=>{const s=this.i;this.i=!1,this.o&&s||(this.handleChanges(t),this.h.requestUpdate())}),i),t.addController(this)):console.warn("IntersectionController error: browser does not support IntersectionObserver.")}handleChanges(t){var s;this.value=null===(s=this.callback)||void 0===s?void 0:s.call(this,t,this.u)}hostConnected(){for(const t of this.t)this.observe(t)}hostDisconnected(){this.disconnect()}async hostUpdated(){const t=this.u.takeRecords();t.length&&this.handleChanges(t)}observe(t){this.t.add(t),this.u.observe(t),this.i=!0}unobserve(t){this.t.delete(t),this.u.unobserve(t)}disconnect(){this.u.disconnect()}}export{t as IntersectionController}; | ||
class t{constructor(t,{target:s,config:i,callback:h,skipInitial:e}){this.t=new Set,this.o=!1,this.i=!1,this.h=t,null!==s&&this.t.add(s??t),this.o=e??this.o,this.callback=h,window.IntersectionObserver?(this.u=new IntersectionObserver((t=>{const s=this.i;this.i=!1,this.o&&s||(this.handleChanges(t),this.h.requestUpdate())}),i),t.addController(this)):console.warn("IntersectionController error: browser does not support IntersectionObserver.")}handleChanges(t){this.value=this.callback?.(t,this.u)}hostConnected(){for(const t of this.t)this.observe(t)}hostDisconnected(){this.disconnect()}async hostUpdated(){const t=this.u.takeRecords();t.length&&this.handleChanges(t)}observe(t){this.t.add(t),this.u.observe(t),this.i=!0}unobserve(t){this.t.delete(t),this.u.unobserve(t)}disconnect(){this.u.disconnect()}}export{t as IntersectionController}; | ||
//# sourceMappingURL=intersection-controller.js.map |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type MutationValueCallback<T = unknown> = (...args: Parameters<MutationCallback>) => T; | ||
export type MutationValueCallback<T = unknown> = (...args: Parameters<MutationCallback>) => T; | ||
/** | ||
@@ -13,0 +13,0 @@ * The config options for a MutationController. |
@@ -1,2 +0,2 @@ | ||
class t{constructor(t,{target:s,config:i,callback:h,skipInitial:o}){this.t=new Set,this.o=!1,this.i=!1,this.h=t,null!==s&&this.t.add(null!=s?s:t),this.l=i,this.o=null!=o?o:this.o,this.callback=h,window.MutationObserver?(this.u=new MutationObserver((t=>{this.handleChanges(t),this.h.requestUpdate()})),t.addController(this)):console.warn("MutationController error: browser does not support MutationObserver.")}handleChanges(t){var s;this.value=null===(s=this.callback)||void 0===s?void 0:s.call(this,t,this.u)}hostConnected(){for(const t of this.t)this.observe(t)}hostDisconnected(){this.disconnect()}async hostUpdated(){const t=this.u.takeRecords();(t.length||!this.o&&this.i)&&this.handleChanges(t),this.i=!1}observe(t){this.t.add(t),this.u.observe(t,this.l),this.i=!0,this.h.requestUpdate()}disconnect(){this.u.disconnect()}}export{t as MutationController}; | ||
class t{constructor(t,{target:s,config:i,callback:h,skipInitial:o}){this.t=new Set,this.o=!1,this.i=!1,this.h=t,null!==s&&this.t.add(s??t),this.l=i,this.o=o??this.o,this.callback=h,window.MutationObserver?(this.u=new MutationObserver((t=>{this.handleChanges(t),this.h.requestUpdate()})),t.addController(this)):console.warn("MutationController error: browser does not support MutationObserver.")}handleChanges(t){this.value=this.callback?.(t,this.u)}hostConnected(){for(const t of this.t)this.observe(t)}hostDisconnected(){this.disconnect()}async hostUpdated(){const t=this.u.takeRecords();(t.length||!this.o&&this.i)&&this.handleChanges(t),this.i=!1}observe(t){this.t.add(t),this.u.observe(t,this.l),this.i=!0,this.h.requestUpdate()}disconnect(){this.u.disconnect()}}export{t as MutationController}; | ||
//# sourceMappingURL=mutation-controller.js.map |
{ | ||
"name": "@lit-labs/observers", | ||
"version": "2.0.0", | ||
"version": "2.0.1-pre.0", | ||
"description": "A set of reactive controllers that facilitate using the platform observer objects.", | ||
@@ -168,6 +168,6 @@ "license": "BSD-3-Clause", | ||
"@types/trusted-types": "^2.0.2", | ||
"@lit-internal/scripts": "^1.0.0" | ||
"@lit-internal/scripts": "^1.0.1-pre.0" | ||
}, | ||
"dependencies": { | ||
"@lit/reactive-element": "^1.1.0" | ||
"@lit/reactive-element": "^2.0.0-pre.0" | ||
}, | ||
@@ -174,0 +174,0 @@ "publishConfig": { |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type PerformanceValueCallback<T = unknown> = (entries: PerformanceEntryList, observer: PerformanceObserver, entryList?: PerformanceObserverEntryList) => T; | ||
export type PerformanceValueCallback<T = unknown> = (entries: PerformanceEntryList, observer: PerformanceObserver, entryList?: PerformanceObserverEntryList) => T; | ||
/** | ||
@@ -13,0 +13,0 @@ * The config options for a PerformanceController. |
@@ -1,2 +0,2 @@ | ||
class s{constructor(s,{config:t,callback:i,skipInitial:h}){this.o=!1,this.i=!1,this.h=s,this.l=t,this.o=null!=h?h:this.o,this.callback=i,window.PerformanceObserver?(this.u=new PerformanceObserver((s=>{this.handleChanges(s.getEntries(),s),this.h.requestUpdate()})),s.addController(this)):console.warn("PerformanceController error: browser does not support PerformanceObserver.")}handleChanges(s,t){var i;this.value=null===(i=this.callback)||void 0===i?void 0:i.call(this,s,this.u,t)}hostConnected(){this.observe()}hostDisconnected(){this.disconnect()}async hostUpdated(){const s=this.u.takeRecords();(s.length||!this.o&&this.i)&&this.handleChanges(s),this.i=!1}flush(){const s=this.u.takeRecords();s.length&&(this.handleChanges(s),this.h.requestUpdate())}observe(){this.u.observe(this.l),this.i=!0,this.h.requestUpdate()}disconnect(){this.u.disconnect()}}export{s as PerformanceController}; | ||
class s{constructor(s,{config:t,callback:i,skipInitial:h}){this.o=!1,this.i=!1,this.h=s,this.l=t,this.o=h??this.o,this.callback=i,window.PerformanceObserver?(this.u=new PerformanceObserver((s=>{this.handleChanges(s.getEntries(),s),this.h.requestUpdate()})),s.addController(this)):console.warn("PerformanceController error: browser does not support PerformanceObserver.")}handleChanges(s,t){this.value=this.callback?.(s,this.u,t)}hostConnected(){this.observe()}hostDisconnected(){this.disconnect()}async hostUpdated(){const s=this.u.takeRecords();(s.length||!this.o&&this.i)&&this.handleChanges(s),this.i=!1}flush(){const s=this.u.takeRecords();s.length&&(this.handleChanges(s),this.h.requestUpdate())}observe(){this.u.observe(this.l),this.i=!0,this.h.requestUpdate()}disconnect(){this.u.disconnect()}}export{s as PerformanceController}; | ||
//# sourceMappingURL=performance-controller.js.map |
@@ -10,3 +10,3 @@ /** | ||
*/ | ||
export declare type ResizeValueCallback<T = unknown> = (...args: Parameters<ResizeObserverCallback>) => T; | ||
export type ResizeValueCallback<T = unknown> = (...args: Parameters<ResizeObserverCallback>) => T; | ||
/** | ||
@@ -13,0 +13,0 @@ * The config options for a ResizeController. |
@@ -1,2 +0,2 @@ | ||
class s{constructor(s,{target:t,config:i,callback:h,skipInitial:e}){this.t=new Set,this.o=!1,this.i=!1,this.h=s,null!==t&&this.t.add(null!=t?t:s),this.l=i,this.o=null!=e?e:this.o,this.callback=h,window.ResizeObserver?(this.u=new ResizeObserver((s=>{this.handleChanges(s),this.h.requestUpdate()})),s.addController(this)):console.warn("ResizeController error: browser does not support ResizeObserver.")}handleChanges(s){var t;this.value=null===(t=this.callback)||void 0===t?void 0:t.call(this,s,this.u)}hostConnected(){for(const s of this.t)this.observe(s)}hostDisconnected(){this.disconnect()}async hostUpdated(){!this.o&&this.i&&this.handleChanges([]),this.i=!1}observe(s){this.t.add(s),this.u.observe(s,this.l),this.i=!0,this.h.requestUpdate()}unobserve(s){this.t.delete(s),this.u.unobserve(s)}disconnect(){this.u.disconnect()}}export{s as ResizeController}; | ||
class s{constructor(s,{target:t,config:i,callback:h,skipInitial:e}){this.t=new Set,this.o=!1,this.i=!1,this.h=s,null!==t&&this.t.add(t??s),this.l=i,this.o=e??this.o,this.callback=h,window.ResizeObserver?(this.u=new ResizeObserver((s=>{this.handleChanges(s),this.h.requestUpdate()})),s.addController(this)):console.warn("ResizeController error: browser does not support ResizeObserver.")}handleChanges(s){this.value=this.callback?.(s,this.u)}hostConnected(){for(const s of this.t)this.observe(s)}hostDisconnected(){this.disconnect()}async hostUpdated(){!this.o&&this.i&&this.handleChanges([]),this.i=!1}observe(s){this.t.add(s),this.u.observe(s,this.l),this.i=!0,this.h.requestUpdate()}unobserve(s){this.t.delete(s),this.u.unobserve(s)}disconnect(){this.u.disconnect()}}export{s as ResizeController}; | ||
//# sourceMappingURL=resize-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
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
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
123378
1190
1
+ Added@lit/reactive-element@2.0.4(transitive)
- Removed@lit/reactive-element@1.6.3(transitive)