msc-any-pip
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -12,4 +12,4 @@ import { _wcl } from './common-lib.js'; | ||
const defaults = { | ||
width: 0, | ||
height: 0 | ||
winwidth: 0, | ||
winheight: 0 | ||
}; | ||
@@ -182,4 +182,4 @@ const booleanAttrs = []; // booleanAttrs default should be false | ||
switch (attrName) { | ||
case 'width': | ||
case 'height': | ||
case 'winwidth': | ||
case 'winheight': | ||
this.#config[attrName] = _wcl.isNumeric(newValue) ? parseFloat(newValue) : defaults[attrName]; | ||
@@ -237,26 +237,26 @@ break; | ||
set width(value) { | ||
set winwidth(value) { | ||
if (value) { | ||
this.setAttribute('width', value); | ||
this.setAttribute('winwidth', value); | ||
} else { | ||
this.removeAttribute('width'); | ||
this.removeAttribute('winwidth'); | ||
} | ||
} | ||
get width() { | ||
get winwidth() { | ||
const { width } = this.getBoundingClientRect(); | ||
return this.#config.width !== 0 ? this.#config.width : width; | ||
return this.#config.winwidth !== 0 ? this.#config.winwidth : width; | ||
} | ||
set height(value) { | ||
set winheight(value) { | ||
if (value) { | ||
this.setAttribute('height', value); | ||
this.setAttribute('winheight', value); | ||
} else { | ||
this.removeAttribute('height'); | ||
this.removeAttribute('winheight'); | ||
} | ||
} | ||
get height() { | ||
get winheight() { | ||
const { height } = this.getBoundingClientRect(); | ||
return this.#config.height !== 0 ? this.#config.height : height; | ||
return this.#config.winheight !== 0 ? this.#config.winheight : height; | ||
} | ||
@@ -293,4 +293,4 @@ | ||
const pipWindow = await window?.documentPictureInPicture.requestWindow({ | ||
width: this.width, | ||
height: this.height + delta | ||
width: this.winwidth, | ||
height: this.winheight + delta | ||
}); | ||
@@ -297,0 +297,0 @@ _wcl.cloneStyleSheetsToDocument(pipWindow.document); |
{ | ||
"name": "msc-any-pip", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Imaging what if we can let anything Picture-in-Picture (not only <video />) ?! Here comes <msc-any-pip /> to let it dream comes true. <msc-any-pip /> apply Document Picture-in-Picture API to given elements have Picture-in-Picture feature.", | ||
@@ -5,0 +5,0 @@ "main": "index.html", |
@@ -30,4 +30,4 @@ # msc-any-pip | ||
{ | ||
"width": 450, | ||
"height": 300 | ||
"winwidth": 450, | ||
"winheight": 300 | ||
} | ||
@@ -73,9 +73,9 @@ </script> | ||
nodeB.appendChild(template.content.cloneNode(true)); | ||
nodeB.width = 450; | ||
nodeB.height = 300; | ||
nodeB.winwidth = 450; | ||
nodeB.winheight = 300; | ||
// new instance with Class & default config | ||
const config = { | ||
width: 450, | ||
height: 300 | ||
winwidth: 450, | ||
winheight: 300 | ||
}; | ||
@@ -106,3 +106,3 @@ const nodeC = new MscAnyPip(config); | ||
- **width** | ||
- **winwidth** | ||
@@ -112,3 +112,3 @@ Set Picture-in-Picture window width. Default is <msc-any-pip />'s `clientWidth`. (Picture-in-Picture's min window width is 300) | ||
```html | ||
<msc-any-pip width="450"> | ||
<msc-any-pip winwidth="450"> | ||
... | ||
@@ -118,3 +118,3 @@ </msc-any-pip> | ||
- **height** | ||
- **winheight** | ||
@@ -124,3 +124,3 @@ Set Picture-in-Picture window height. Default is <msc-any-pip />'s `clientHeight`. (Picture-in-Picture's min window height is 300) | ||
```html | ||
<msc-any-pip height="300"> | ||
<msc-any-pip winheight="300"> | ||
... | ||
@@ -134,4 +134,4 @@ </msc-any-pip> | ||
| ----------- | ----------- | ----------- | | ||
| width | Number | Getter / Setter for Picture-in-Picture window width. Default is <msc-any-pip />'s clientWidth. | | ||
| height | Number | Getter / Setter for Picture-in-Picture window height. Default is <msc-any-pip />'s clientHeight. | | ||
| winwidth | Number | Getter / Setter for Picture-in-Picture window width. Default is <msc-any-pip />'s clientWidth. | | ||
| winheight | Number | Getter / Setter for Picture-in-Picture window height. Default is <msc-any-pip />'s clientHeight. | | ||
@@ -138,0 +138,0 @@ ## Events |
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
57738