@lrnwebcomponents/responsive-utility
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -23,2 +23,3 @@ import { html } from "lit"; | ||
type: Boolean, | ||
reflect: true, | ||
attribute: "disable-responsive", | ||
@@ -92,3 +93,3 @@ }, | ||
if (!this.disableResponsive) { | ||
window.ResponsiveUtility.requestAvailability(); | ||
globalThis.ResponsiveUtility.requestAvailability(); | ||
this.dispatchEvent( | ||
@@ -108,3 +109,3 @@ new CustomEvent("responsive-element", { | ||
}, | ||
}) | ||
}), | ||
); | ||
@@ -124,3 +125,3 @@ } | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -127,0 +128,0 @@ } |
@@ -15,3 +15,3 @@ { | ||
}, | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "Automated conversion of responsive-utility/", | ||
@@ -32,7 +32,8 @@ "repository": { | ||
"lighthouse": "gulp lighthouse --gulpfile=gulpfile.cjs", | ||
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox --watch", | ||
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox" | ||
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium --watch", | ||
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium" | ||
}, | ||
"author": { | ||
"name": "btopro" | ||
"name": "haxtheweb", | ||
"url": "https://hax.psu.edu/" | ||
}, | ||
@@ -42,13 +43,13 @@ "license": "Apache-2.0", | ||
"@juggle/resize-observer": "^3.0.0", | ||
"lit": "^3.1.0" | ||
"lit": "^3.1.2" | ||
}, | ||
"devDependencies": { | ||
"@lrnwebcomponents/deduping-fix": "^8.0.0", | ||
"@lrnwebcomponents/storybook-utilities": "^8.0.0", | ||
"@open-wc/testing": "3.2.0", | ||
"@lrnwebcomponents/deduping-fix": "^8.0.1", | ||
"@lrnwebcomponents/storybook-utilities": "^8.0.1", | ||
"@open-wc/testing": "4.0.0", | ||
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page", | ||
"@polymer/iron-demo-helpers": "3.1.0", | ||
"@web/dev-server": "0.3.1", | ||
"@web/dev-server": "0.4.2", | ||
"@webcomponents/webcomponentsjs": "^2.8.0", | ||
"concurrently": "8.2.0", | ||
"concurrently": "8.2.2", | ||
"wct-browser-legacy": "1.0.2" | ||
@@ -64,3 +65,3 @@ }, | ||
], | ||
"gitHead": "2791492ff7ab40c7d4c827c4b305e33c0a971230" | ||
"gitHead": "246242dfc335bb0f3baa59f801241be9d3b69180" | ||
} |
@@ -13,5 +13,5 @@ import { LitElement, html, css } from "lit"; | ||
window.ResponsiveUtility = {}; | ||
globalThis.ResponsiveUtility = {}; | ||
window.ResponsiveUtility.instance = null; | ||
globalThis.ResponsiveUtility.instance = null; | ||
class ResponsiveUtility extends LitElement { | ||
@@ -44,3 +44,3 @@ render() { | ||
this.details.push(detail); | ||
window.ResponsiveUtility.setSize(detail); | ||
globalThis.ResponsiveUtility.setSize(detail); | ||
} | ||
@@ -51,9 +51,9 @@ | ||
en.forEach((e) => | ||
window.ResponsiveUtility.setSize( | ||
globalThis.ResponsiveUtility.setSize( | ||
detail, | ||
e.contentBoxSize || e.borderBoxSize || e.contentRect || e.target | ||
? e.target.offsetWidth | ||
: 0 | ||
) | ||
) | ||
: 0, | ||
), | ||
), | ||
); | ||
@@ -91,14 +91,14 @@ } | ||
this.details = []; | ||
window.addEventListener( | ||
globalThis.addEventListener( | ||
"responsive-element", | ||
this.responiveElementEvent.bind(this) | ||
this.responiveElementEvent.bind(this), | ||
); | ||
/* handle element deregistration */ | ||
window.addEventListener( | ||
globalThis.addEventListener( | ||
"delete-responsive-element", | ||
this.deleteResponiveElementEvent.bind(this) | ||
this.deleteResponiveElementEvent.bind(this), | ||
); | ||
if (window.ResponsiveUtility.instance == null) | ||
window.ResponsiveUtility.instance = this; | ||
if (globalThis.ResponsiveUtility.instance == null) | ||
globalThis.ResponsiveUtility.instance = this; | ||
} | ||
@@ -112,8 +112,9 @@ } | ||
*/ | ||
window.ResponsiveUtility.requestAvailability = () => { | ||
if (window.ResponsiveUtility.instance == null) { | ||
window.ResponsiveUtility.instance = | ||
document.createElement("responsive-utility"); | ||
globalThis.ResponsiveUtility.requestAvailability = () => { | ||
if (globalThis.ResponsiveUtility.instance == null && globalThis.document) { | ||
globalThis.ResponsiveUtility.instance = | ||
globalThis.document.createElement("responsive-utility"); | ||
globalThis.document.body.appendChild(globalThis.ResponsiveUtility.instance); | ||
} | ||
document.body.appendChild(window.ResponsiveUtility.instance); | ||
return globalThis.ResponsiveUtility.instance; | ||
}; | ||
@@ -131,3 +132,3 @@ /** | ||
*/ | ||
window.ResponsiveUtility.setSize = (detail, width = 0) => { | ||
globalThis.ResponsiveUtility.setSize = (detail, width = 0) => { | ||
let size, | ||
@@ -134,0 +135,0 @@ el = detail.element, |
@@ -13,5 +13,5 @@ import { LitElement, html, css } from "lit"; | ||
window.ResponsiveUtility = {}; | ||
globalThis.ResponsiveUtility = {}; | ||
window.ResponsiveUtility.instance = null; | ||
globalThis.ResponsiveUtility.instance = null; | ||
class ResponsiveUtility extends LitElement { | ||
@@ -44,3 +44,3 @@ render() { | ||
this.details.push(detail); | ||
window.ResponsiveUtility.setSize(detail); | ||
globalThis.ResponsiveUtility.setSize(detail); | ||
} | ||
@@ -51,9 +51,9 @@ | ||
en.forEach((e) => | ||
window.ResponsiveUtility.setSize( | ||
globalThis.ResponsiveUtility.setSize( | ||
detail, | ||
e.contentBoxSize || e.borderBoxSize || e.contentRect || e.target | ||
? e.target.offsetWidth | ||
: 0 | ||
) | ||
) | ||
: 0, | ||
), | ||
), | ||
); | ||
@@ -91,14 +91,14 @@ } | ||
this.details = []; | ||
window.addEventListener( | ||
globalThis.addEventListener( | ||
"responsive-element", | ||
this.responiveElementEvent.bind(this) | ||
this.responiveElementEvent.bind(this), | ||
); | ||
/* handle element deregistration */ | ||
window.addEventListener( | ||
globalThis.addEventListener( | ||
"delete-responsive-element", | ||
this.deleteResponiveElementEvent.bind(this) | ||
this.deleteResponiveElementEvent.bind(this), | ||
); | ||
if (window.ResponsiveUtility.instance == null) | ||
window.ResponsiveUtility.instance = this; | ||
if (globalThis.ResponsiveUtility.instance == null) | ||
globalThis.ResponsiveUtility.instance = this; | ||
} | ||
@@ -112,8 +112,9 @@ } | ||
*/ | ||
window.ResponsiveUtility.requestAvailability = () => { | ||
if (window.ResponsiveUtility.instance == null) { | ||
window.ResponsiveUtility.instance = | ||
document.createElement("responsive-utility"); | ||
globalThis.ResponsiveUtility.requestAvailability = () => { | ||
if (globalThis.ResponsiveUtility.instance == null && globalThis.document) { | ||
globalThis.ResponsiveUtility.instance = | ||
globalThis.document.createElement("responsive-utility"); | ||
globalThis.document.body.appendChild(globalThis.ResponsiveUtility.instance); | ||
} | ||
document.body.appendChild(window.ResponsiveUtility.instance); | ||
return globalThis.ResponsiveUtility.instance; | ||
}; | ||
@@ -131,3 +132,3 @@ /** | ||
*/ | ||
window.ResponsiveUtility.setSize = (detail, width = 0) => { | ||
globalThis.ResponsiveUtility.setSize = (detail, width = 0) => { | ||
let size, | ||
@@ -134,0 +135,0 @@ el = detail.element, |
@@ -8,5 +8,5 @@ import { fixture, expect, html } from "@open-wc/testing"; | ||
beforeEach(async () => { | ||
element = await fixture( | ||
html` <responsive-utility title="test-title"></responsive-utility> ` | ||
); | ||
element = await fixture(html` | ||
<responsive-utility title="test-title"></responsive-utility> | ||
`); | ||
}); | ||
@@ -13,0 +13,0 @@ |
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
50549
777
Updatedlit@^3.1.2