shaka-video-element 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react.js +11 -5
- package/dist/shaka-video-element.js +3 -1
- package/package.json +3 -3
package/dist/react.js
CHANGED
|
@@ -4,11 +4,10 @@
|
|
|
4
4
|
import React, { useRef, useEffect } from 'react';
|
|
5
5
|
import Element from '../shaka-video-element.js';
|
|
6
6
|
|
|
7
|
-
export default React.forwardRef((
|
|
7
|
+
export default React.forwardRef((allProps, ref) => {
|
|
8
|
+
let { children, suppressHydrationWarning, ...props } = allProps;
|
|
8
9
|
ref ??= useRef();
|
|
9
10
|
|
|
10
|
-
const attrs = propsToAttrs({ ...props, ref });
|
|
11
|
-
|
|
12
11
|
for (let name in props) {
|
|
13
12
|
if (name[0] === 'o' && name[1] === 'n') {
|
|
14
13
|
const useCapture = name.endsWith('Capture');
|
|
@@ -28,6 +27,8 @@ export default React.forwardRef(({ children, ...props }, ref) => {
|
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
|
|
30
|
+
const attrs = propsToAttrs(props);
|
|
31
|
+
|
|
31
32
|
// Only render the custom element template HTML on the server..
|
|
32
33
|
// The custom element will render itself on the client.
|
|
33
34
|
if (typeof window === 'undefined' && Element?.getTemplateHTML && Element?.shadowRootOptions) {
|
|
@@ -44,7 +45,12 @@ export default React.forwardRef(({ children, ...props }, ref) => {
|
|
|
44
45
|
children = [templateShadowRoot, children];
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
return React.createElement('shaka-video',
|
|
48
|
+
return React.createElement('shaka-video', {
|
|
49
|
+
...attrs,
|
|
50
|
+
ref,
|
|
51
|
+
children,
|
|
52
|
+
suppressHydrationWarning,
|
|
53
|
+
});
|
|
48
54
|
});
|
|
49
55
|
|
|
50
56
|
const ReactPropToAttrNameMap = {
|
|
@@ -67,7 +73,7 @@ function toAttrName(propName, propValue) {
|
|
|
67
73
|
if (ReactPropToAttrNameMap[propName]) return ReactPropToAttrNameMap[propName];
|
|
68
74
|
if (typeof propValue == 'undefined') return undefined;
|
|
69
75
|
if (typeof propValue === 'boolean' && !propValue) return undefined;
|
|
70
|
-
if (
|
|
76
|
+
if (propName.startsWith('on') && typeof propValue === 'function') return undefined;
|
|
71
77
|
if (/[A-Z]/.test(propName)) return propName.toLowerCase();
|
|
72
78
|
return propName;
|
|
73
79
|
}
|
|
@@ -27841,6 +27841,7 @@ var CustomMediaMixin = (superclass, { tag, is }) => {
|
|
|
27841
27841
|
super();
|
|
27842
27842
|
}
|
|
27843
27843
|
get nativeEl() {
|
|
27844
|
+
this.#init();
|
|
27844
27845
|
return this.#nativeEl ?? this.shadowRoot.querySelector(tag) ?? this.querySelector(":scope > [slot=media]") ?? this.querySelector(tag);
|
|
27845
27846
|
}
|
|
27846
27847
|
set nativeEl(val) {
|
|
@@ -27885,6 +27886,7 @@ var CustomMediaMixin = (superclass, { tag, is }) => {
|
|
|
27885
27886
|
this.#upgradeProperty(prop);
|
|
27886
27887
|
}
|
|
27887
27888
|
this.shadowRoot.addEventListener("slotchange", this);
|
|
27889
|
+
this.#syncMediaChildren();
|
|
27888
27890
|
for (let type of this.constructor.Events) {
|
|
27889
27891
|
this.shadowRoot.addEventListener?.(type, this, true);
|
|
27890
27892
|
}
|
|
@@ -27905,7 +27907,7 @@ var CustomMediaMixin = (superclass, { tag, is }) => {
|
|
|
27905
27907
|
*/
|
|
27906
27908
|
#syncMediaChildren() {
|
|
27907
27909
|
const removeNativeChildren = new Map(this.#childMap);
|
|
27908
|
-
this.shadowRoot.querySelector("slot:not([name])").assignedElements().filter((el) => ["track", "source"].includes(el.localName)).forEach((el) => {
|
|
27910
|
+
this.shadowRoot.querySelector("slot:not([name])").assignedElements({ flatten: true }).filter((el) => ["track", "source"].includes(el.localName)).forEach((el) => {
|
|
27909
27911
|
removeNativeChildren.delete(el);
|
|
27910
27912
|
let clone = this.#childMap.get(el);
|
|
27911
27913
|
if (!clone) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shaka-video-element",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Custom element (web component) for Shaka Player",
|
|
5
5
|
"author": "@muxinc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"build": "run-s build:*"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"custom-media-element": "^1.3.
|
|
33
|
+
"custom-media-element": "^1.3.1",
|
|
34
34
|
"shaka-player": "^4.8.4"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"build-react-wrapper": "^0.1.
|
|
37
|
+
"build-react-wrapper": "^0.1.3",
|
|
38
38
|
"npm-run-all": "^4.1.5",
|
|
39
39
|
"wet-run": "^1.2.2"
|
|
40
40
|
},
|