Socket
Socket
Sign inDemoInstall

@lit-labs/observers

Package Overview
Dependencies
Maintainers
11
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lit-labs/observers - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

5

development/intersection-controller.d.ts

@@ -1,6 +0,1 @@

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { ReactiveController, ReactiveControllerHost } from '@lit/reactive-element/reactive-controller.js';

@@ -7,0 +2,0 @@ /**

9

development/intersection-controller.js
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { isServer } from 'lit-html/is-server.js';
/**
* IntersectionController is a ReactiveController that integrates an

@@ -36,2 +42,5 @@ * IntersectionObserver with a ReactiveControllerHost's reactive update

this.callback = callback;
if (isServer) {
return;
}
// Check browser support.

@@ -38,0 +47,0 @@ if (!window.IntersectionObserver) {

@@ -1,6 +0,1 @@

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { ReactiveController, ReactiveControllerHost } from '@lit/reactive-element/reactive-controller.js';

@@ -7,0 +2,0 @@ /**

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { isServer } from 'lit-html/is-server.js';
/**
* MutationController is a ReactiveController that integrates a MutationObserver

@@ -35,2 +41,5 @@ * with a ReactiveControllerHost's reactive update lifecycle. This is typically

this.callback = callback;
if (isServer) {
return;
}
// Check browser support.

@@ -37,0 +46,0 @@ if (!window.MutationObserver) {

@@ -1,6 +0,1 @@

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { ReactiveController, ReactiveControllerHost } from '@lit/reactive-element/reactive-controller.js';

@@ -7,0 +2,0 @@ /**

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { isServer } from 'lit-html/is-server.js';
/**
* PerformanceController is a ReactiveController that integrates a

@@ -27,2 +33,5 @@ * PerformanceObserver with a ReactiveControllerHost's reactive update

this.callback = callback;
if (isServer) {
return;
}
// Check browser support.

@@ -29,0 +38,0 @@ if (!window.PerformanceObserver) {

@@ -1,6 +0,1 @@

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { ReactiveController, ReactiveControllerHost } from '@lit/reactive-element/reactive-controller.js';

@@ -7,0 +2,0 @@ /**

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { isServer } from 'lit-html/is-server.js';
/**
* ResizeController is a ReactiveController that integrates a ResizeObserver

@@ -34,2 +40,5 @@ * with a ReactiveControllerHost's reactive update lifecycle. This is typically

this.callback = callback;
if (isServer) {
return;
}
// Check browser support.

@@ -36,0 +45,0 @@ if (!window.ResizeObserver) {

@@ -1,6 +0,1 @@

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { ReactiveController, ReactiveControllerHost } from '@lit/reactive-element/reactive-controller.js';

@@ -7,0 +2,0 @@ /**

7

intersection-controller.js

@@ -1,2 +0,7 @@

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};
import{isServer as s}from"lit-html/is-server.js";
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class h{constructor(t,{target:i,config:h,callback:e,skipInitial:o}){this.t=new Set,this.o=!1,this.i=!1,this.h=t,null!==i&&this.t.add(i??t),this.o=o??this.o,this.callback=e,s||(window.IntersectionObserver?(this.u=new IntersectionObserver((t=>{const s=this.i;this.i=!1,this.o&&s||(this.handleChanges(t),this.h.requestUpdate())}),h),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{h as IntersectionController};
//# sourceMappingURL=intersection-controller.js.map

@@ -1,6 +0,1 @@

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { ReactiveController, ReactiveControllerHost } from '@lit/reactive-element/reactive-controller.js';

@@ -7,0 +2,0 @@ /**

@@ -1,2 +0,7 @@

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};
import{isServer as s}from"lit-html/is-server.js";
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class h{constructor(t,{target:i,config:h,callback:o,skipInitial:e}){this.t=new Set,this.o=!1,this.i=!1,this.h=t,null!==i&&this.t.add(i??t),this.l=h,this.o=e??this.o,this.callback=o,s||(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{h as MutationController};
//# sourceMappingURL=mutation-controller.js.map
{
"name": "@lit-labs/observers",
"version": "2.0.2",
"version": "2.0.3",
"description": "A set of reactive controllers that facilitate using the platform observer objects.",

@@ -171,2 +171,3 @@ "license": "BSD-3-Clause",

"dependencies": {
"lit-html": "^3.2.0",
"@lit/reactive-element": "^1.0.0 || ^2.0.0"

@@ -173,0 +174,0 @@ },

@@ -1,6 +0,1 @@

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { ReactiveController, ReactiveControllerHost } from '@lit/reactive-element/reactive-controller.js';

@@ -7,0 +2,0 @@ /**

@@ -1,2 +0,7 @@

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};
import{isServer as s}from"lit-html/is-server.js";
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class h{constructor(t,{config:i,callback:h,skipInitial:e}){this.o=!1,this.i=!1,this.h=t,this.l=i,this.o=e??this.o,this.callback=h,s||(window.PerformanceObserver?(this.u=new PerformanceObserver((s=>{this.handleChanges(s.getEntries(),s),this.h.requestUpdate()})),t.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{h as PerformanceController};
//# sourceMappingURL=performance-controller.js.map

@@ -1,6 +0,1 @@

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { ReactiveController, ReactiveControllerHost } from '@lit/reactive-element/reactive-controller.js';

@@ -7,0 +2,0 @@ /**

@@ -1,2 +0,7 @@

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};
import{isServer as s}from"lit-html/is-server.js";
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class h{constructor(t,{target:i,config:h,callback:e,skipInitial:o}){this.t=new Set,this.o=!1,this.i=!1,this.h=t,null!==i&&this.t.add(i??t),this.l=h,this.o=o??this.o,this.callback=e,s||(window.ResizeObserver?(this.u=new ResizeObserver((s=>{this.handleChanges(s),this.h.requestUpdate()})),t.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{h 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc