@lit-labs/observers
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,2 @@ | ||
export {}; | ||
/** | ||
@@ -2,0 +3,0 @@ * @license |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
export {}; | ||
/** | ||
@@ -3,0 +3,0 @@ * @license |
@@ -0,1 +1,2 @@ | ||
export {}; | ||
/** | ||
@@ -2,0 +3,0 @@ * @license |
@@ -1,2 +0,2 @@ | ||
class t{constructor(t,{target:s,config:i,callback:h,skipInitial:n}){this.t=!1,this.i=!1,this.callback=()=>!0,(this.h=t).addController(this),this.o=null===s||null!=s?s:this.h,this.t=null!=n?n:this.t,this.callback=null!=h?h:this.callback,window.IntersectionObserver?this.l=new IntersectionObserver((t=>{const s=this.i;this.i=!1,this.t&&s||(this.handleChanges(t),this.h.requestUpdate())}),i):console.warn("IntersectionController error: browser does not support IntersectionObserver.")}handleChanges(t){this.value=this.callback(t,this.l)}hostConnected(){this.o&&this.observe(this.o)}hostDisconnected(){this.disconnect()}async hostUpdated(){const t=this.l.takeRecords();t.length&&this.handleChanges(t)}observe(t){this.l.observe(t),this.i=!0}disconnect(){this.l.disconnect()}}export{t as IntersectionController}; | ||
class t{constructor(t,{target:s,config:i,callback:h,skipInitial:n}){this.t=!1,this.o=!1,this.callback=()=>!0,(this.i=t).addController(this),this.h=null===s||null!=s?s:this.i,this.t=null!=n?n:this.t,this.callback=null!=h?h:this.callback,window.IntersectionObserver?this.u=new IntersectionObserver((t=>{const s=this.o;this.o=!1,this.t&&s||(this.handleChanges(t),this.i.requestUpdate())}),i):console.warn("IntersectionController error: browser does not support IntersectionObserver.")}handleChanges(t){this.value=this.callback(t,this.u)}hostConnected(){this.h&&this.observe(this.h)}hostDisconnected(){this.disconnect()}async hostUpdated(){const t=this.u.takeRecords();t.length&&this.handleChanges(t)}observe(t){this.u.observe(t),this.o=!0}disconnect(){this.u.disconnect()}}export{t as IntersectionController}; | ||
//# sourceMappingURL=intersection_controller.js.map |
@@ -1,2 +0,2 @@ | ||
class t{constructor(t,{target:s,config:i,callback:h,skipInitial:n}){this.t=!1,this.i=!1,this.callback=()=>!0,(this.h=t).addController(this),this.o=null===s||null!=s?s:this.h,this.l=i,this.t=null!=n?n:this.t,this.callback=null!=h?h:this.callback,window.MutationObserver?this.u=new MutationObserver((t=>{this.handleChanges(t),this.h.requestUpdate()})):console.warn("MutationController error: browser does not support MutationObserver.")}handleChanges(t){this.value=this.callback(t,this.u)}hostConnected(){this.o&&this.observe(this.o)}hostDisconnected(){this.disconnect()}async hostUpdated(){const t=this.u.takeRecords();(t.length||!this.t&&this.i)&&this.handleChanges(t),this.i=!1}observe(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:n}){this.t=!1,this.o=!1,this.callback=()=>!0,(this.i=t).addController(this),this.h=null===s||null!=s?s:this.i,this.l=i,this.t=null!=n?n:this.t,this.callback=null!=h?h:this.callback,window.MutationObserver?this.u=new MutationObserver((t=>{this.handleChanges(t),this.i.requestUpdate()})):console.warn("MutationController error: browser does not support MutationObserver.")}handleChanges(t){this.value=this.callback(t,this.u)}hostConnected(){this.h&&this.observe(this.h)}hostDisconnected(){this.disconnect()}async hostUpdated(){const t=this.u.takeRecords();(t.length||!this.t&&this.o)&&this.handleChanges(t),this.o=!1}observe(t){this.u.observe(t,this.l),this.o=!0,this.i.requestUpdate()}disconnect(){this.u.disconnect()}}export{t as MutationController}; | ||
//# sourceMappingURL=mutation_controller.js.map |
128
package.json
{ | ||
"name": "@lit-labs/observers", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A set of reactive controllers that facilitate using the platform observer objects.", | ||
@@ -21,2 +21,3 @@ "license": "BSD-3-Clause", | ||
".": { | ||
"types": "./development/index.d.ts", | ||
"development": "./development/index.js", | ||
@@ -26,2 +27,3 @@ "default": "./index.js" | ||
"./mutation_controller.js": { | ||
"types": "./development/mutation_controller.d.ts", | ||
"development": "./development/mutation_controller.js", | ||
@@ -31,2 +33,3 @@ "default": "./mutation_controller.js" | ||
"./performance_controller.js": { | ||
"types": "./development/performance_controller.d.ts", | ||
"development": "./development/performance_controller.js", | ||
@@ -36,2 +39,3 @@ "default": "./performance_controller.js" | ||
"./resize_controller.js": { | ||
"types": "./development/resize_controller.d.ts", | ||
"development": "./development/resize_controller.js", | ||
@@ -41,2 +45,3 @@ "default": "./resize_controller.js" | ||
"./intersection_controller.js": { | ||
"types": "./development/intersection_controller.d.ts", | ||
"development": "./development/intersection_controller.js", | ||
@@ -56,28 +61,105 @@ "default": "./intersection_controller.js" | ||
"scripts": { | ||
"build": "npm run clean && npm run build:ts --build && rollup -c", | ||
"build:watch": "rollup -c --watch", | ||
"build:ts": "tsc --build && treemirror development . '**/*.d.ts{,.map}'", | ||
"build:ts:watch": "tsc --build --watch", | ||
"clean": "rm -rf {index,mutation_controller,performance_controller,resize_controller,intersection_controller}.{js,js.map,d.ts} development/ test/ *.tsbuildinfo", | ||
"dev": "scripts/dev.sh", | ||
"test": "npm run test:dev && npm run test:prod", | ||
"test:dev": "cd ../../tests && npx wtr '../labs/observers/development/**/*_test.js'", | ||
"test:prod": "TEST_PROD_BUILD=true npm run test:dev", | ||
"test:watch": "npm run test:dev -- --watch", | ||
"checksize": "rollup -c --environment=CHECKSIZE", | ||
"regen-package-lock": "rm -rf node_modules package-lock.json; npm install" | ||
"build": "wireit", | ||
"build:ts": "wireit", | ||
"build:ts:types": "wireit", | ||
"build:rollup": "wireit", | ||
"test": "wireit", | ||
"test:dev": "wireit", | ||
"test:prod": "wireit", | ||
"checksize": "wireit" | ||
}, | ||
"wireit": { | ||
"build": { | ||
"dependencies": [ | ||
"build:ts", | ||
"build:ts:types", | ||
"build:rollup", | ||
"../../reactive-element:build" | ||
] | ||
}, | ||
"build:ts": { | ||
"command": "tsc --build --pretty", | ||
"dependencies": [ | ||
"../../reactive-element:build:ts:types" | ||
], | ||
"clean": "if-file-deleted", | ||
"files": [ | ||
"src/**/*.ts", | ||
"tsconfig.json" | ||
], | ||
"output": [ | ||
"development", | ||
"tsconfig.tsbuildinfo" | ||
] | ||
}, | ||
"build:ts:types": { | ||
"command": "treemirror development . \"**/*.d.ts{,.map}\"", | ||
"dependencies": [ | ||
"../../internal-scripts:build", | ||
"build:ts" | ||
], | ||
"files": [], | ||
"output": [ | ||
"*.d.ts{,.map}", | ||
"test/**/*.d.ts{,.map}" | ||
] | ||
}, | ||
"build:rollup": { | ||
"command": "rollup -c", | ||
"dependencies": [ | ||
"build:ts" | ||
], | ||
"files": [ | ||
"rollup.config.js", | ||
"../../../rollup-common.js" | ||
], | ||
"output": [ | ||
"index.js{,.map}", | ||
"intersection_controller.js{,.map}", | ||
"mutation_controller.js{,.map}", | ||
"performance_controller.js{,.map}", | ||
"resize_controller.js{,.map}", | ||
"test/**/*.js{,.map}" | ||
] | ||
}, | ||
"checksize": { | ||
"command": "rollup -c --environment=CHECKSIZE", | ||
"dependencies": [ | ||
"build:ts" | ||
], | ||
"files": [ | ||
"rollup.config.js", | ||
"../../../rollup-common.js" | ||
], | ||
"output": [] | ||
}, | ||
"test": { | ||
"dependencies": [ | ||
"test:dev", | ||
"test:prod" | ||
] | ||
}, | ||
"test:dev": { | ||
"command": "MODE=dev node ../../tests/run-web-tests.js \"development/**/*_test.js\" --config ../../tests/web-test-runner.config.js", | ||
"dependencies": [ | ||
"build", | ||
"../../tests:build" | ||
], | ||
"files": [], | ||
"output": [] | ||
}, | ||
"test:prod": { | ||
"command": "MODE=prod node ../../tests/run-web-tests.js \"development/**/*_test.js\" --config ../../tests/web-test-runner.config.js", | ||
"dependencies": [ | ||
"build", | ||
"../../tests:build" | ||
], | ||
"files": [], | ||
"output": [] | ||
} | ||
}, | ||
"author": "Google LLC", | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.1.5", | ||
"@types/chai": "^4.0.1", | ||
"@types/mocha": "^9.0.0", | ||
"@types/trusted-types": "^2.0.2", | ||
"@web/test-runner-mocha": "^0.7.4", | ||
"chokidar-cli": "^3.0.0", | ||
"concurrently": "^6.2.1", | ||
"mocha": "^9.1.1", | ||
"rollup": "^2.28.2", | ||
"typescript": "^4.3.5", | ||
"internal-scripts": "^1.0.0" | ||
"@lit-internal/scripts": "^1.0.0" | ||
}, | ||
@@ -84,0 +166,0 @@ "dependencies": { |
@@ -1,2 +0,2 @@ | ||
class s{constructor(s,{config:t,callback:i,skipInitial:h}){this.t=!1,this.i=!1,this.callback=()=>!0,(this.h=s).addController(this),this.o=t,this.t=null!=h?h:this.t,this.callback=null!=i?i:this.callback,window.PerformanceObserver?this.l=new PerformanceObserver((s=>{this.handleChanges(s.getEntries(),s),this.h.requestUpdate()})):console.warn("PerformanceController error: browser does not support PerformanceObserver.")}handleChanges(s,t){this.value=this.callback(s,this.l,t)}hostConnected(){this.observe()}hostDisconnected(){this.disconnect()}async hostUpdated(){const s=this.l.takeRecords();(s.length||!this.t&&this.i)&&this.handleChanges(s),this.i=!1}flush(){const s=this.l.takeRecords();s.length&&(this.handleChanges(s),this.h.requestUpdate())}observe(){this.l.observe(this.o),this.i=!0,this.h.requestUpdate()}disconnect(){this.l.disconnect()}}export{s as PerformanceController}; | ||
class s{constructor(s,{config:t,callback:i,skipInitial:h}){this.t=!1,this.o=!1,this.callback=()=>!0,(this.i=s).addController(this),this.l=t,this.t=null!=h?h:this.t,this.callback=null!=i?i:this.callback,window.PerformanceObserver?this.u=new PerformanceObserver((s=>{this.handleChanges(s.getEntries(),s),this.i.requestUpdate()})):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.t&&this.o)&&this.handleChanges(s),this.o=!1}flush(){const s=this.u.takeRecords();s.length&&(this.handleChanges(s),this.i.requestUpdate())}observe(){this.u.observe(this.l),this.o=!0,this.i.requestUpdate()}disconnect(){this.u.disconnect()}}export{s as PerformanceController}; | ||
//# sourceMappingURL=performance_controller.js.map |
@@ -1,2 +0,2 @@ | ||
class s{constructor(s,{target:t,config:i,callback:h,skipInitial:e}){this.t=!1,this.i=!1,this.callback=()=>!0,(this.h=s).addController(this),this.o=null===t||null!=t?t:this.h,this.l=i,this.t=null!=e?e:this.t,this.callback=null!=h?h:this.callback,window.ResizeObserver?this.u=new ResizeObserver((s=>{this.handleChanges(s),this.h.requestUpdate()})):console.warn("ResizeController error: browser does not support ResizeObserver.")}handleChanges(s){this.value=this.callback(s,this.u)}hostConnected(){this.o&&this.observe(this.o)}hostDisconnected(){this.disconnect()}async hostUpdated(){!this.t&&this.i&&this.handleChanges([]),this.i=!1}observe(s){this.u.observe(s,this.l),this.i=!0,this.h.requestUpdate()}disconnect(){this.u.disconnect()}}export{s as ResizeController}; | ||
class s{constructor(s,{target:t,config:i,callback:h,skipInitial:e}){this.t=!1,this.o=!1,this.callback=()=>!0,(this.i=s).addController(this),this.h=null===t||null!=t?t:this.i,this.l=i,this.t=null!=e?e:this.t,this.callback=null!=h?h:this.callback,window.ResizeObserver?this.u=new ResizeObserver((s=>{this.handleChanges(s),this.i.requestUpdate()})):console.warn("ResizeController error: browser does not support ResizeObserver.")}handleChanges(s){this.value=this.callback(s,this.u)}hostConnected(){this.h&&this.observe(this.h)}hostDisconnected(){this.disconnect()}async hostUpdated(){!this.t&&this.o&&this.handleChanges([]),this.o=!1}observe(s){this.u.observe(s,this.l),this.o=!0,this.i.requestUpdate()}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
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
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
120274
2
1160
43
1