@plasmicpkgs/react-youtube 7.13.2 → 7.13.6
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/index.d.ts +5 -0
- package/dist/react-youtube.cjs.development.js +69 -27
- package/dist/react-youtube.cjs.development.js.map +1 -1
- package/dist/react-youtube.cjs.production.min.js +1 -1
- package/dist/react-youtube.cjs.production.min.js.map +1 -1
- package/dist/react-youtube.esm.js +68 -27
- package/dist/react-youtube.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import registerComponent, { ComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import YouTubeImpl, { PlayerVars, YouTubeProps as YouTubeImplProps } from "react-youtube";
|
|
3
4
|
export declare type YouTubeProps = YouTubeImplProps & {
|
|
@@ -27,4 +28,8 @@ declare const YouTube: React.ForwardRefExoticComponent<YouTubeImplProps & {
|
|
|
27
28
|
start?: number | undefined;
|
|
28
29
|
mute?: 0 | 1 | undefined;
|
|
29
30
|
} & React.RefAttributes<YouTubeImpl>>;
|
|
31
|
+
export declare const youtubeMeta: ComponentMeta<YouTubeProps>;
|
|
32
|
+
export declare function registerYouTube(loader?: {
|
|
33
|
+
registerComponent: typeof registerComponent;
|
|
34
|
+
}, customYouTubeMeta?: ComponentMeta<YouTubeProps>): void;
|
|
30
35
|
export default YouTube;
|
|
@@ -8,6 +8,24 @@ var registerComponent = _interopDefault(require('@plasmicapp/host/registerCompon
|
|
|
8
8
|
var React = _interopDefault(require('react'));
|
|
9
9
|
var YouTubeImpl = _interopDefault(require('react-youtube'));
|
|
10
10
|
|
|
11
|
+
function _extends() {
|
|
12
|
+
_extends = Object.assign || function (target) {
|
|
13
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14
|
+
var source = arguments[i];
|
|
15
|
+
|
|
16
|
+
for (var key in source) {
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
18
|
+
target[key] = source[key];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return target;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return _extends.apply(this, arguments);
|
|
27
|
+
}
|
|
28
|
+
|
|
11
29
|
function _unsupportedIterableToArray(o, minLen) {
|
|
12
30
|
if (!o) return;
|
|
13
31
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -50,67 +68,74 @@ var playerParams = ["autoplay", "cc_load_policy", "color", "controls", "disablek
|
|
|
50
68
|
var booleanParams = ["autoplay", "cc_load_policy", "controls", "disablekb", "fs", "loop", "modestbranding", "playsinline", "rel"];
|
|
51
69
|
var booleanParamsSet = /*#__PURE__*/new Set(booleanParams);
|
|
52
70
|
var YouTube = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
71
|
+
var finalProps = _extends({}, props);
|
|
72
|
+
|
|
53
73
|
for (var _iterator = _createForOfIteratorHelperLoose(playerParams), _step; !(_step = _iterator()).done;) {
|
|
54
74
|
var prop = _step.value;
|
|
55
75
|
|
|
56
|
-
if (prop in
|
|
57
|
-
var value =
|
|
58
|
-
delete
|
|
76
|
+
if (prop in finalProps) {
|
|
77
|
+
var value = finalProps[prop];
|
|
78
|
+
delete finalProps[prop];
|
|
59
79
|
|
|
60
|
-
if (!
|
|
61
|
-
|
|
80
|
+
if (!finalProps.opts) {
|
|
81
|
+
finalProps.opts = {};
|
|
62
82
|
}
|
|
63
83
|
|
|
64
|
-
if (!
|
|
65
|
-
|
|
84
|
+
if (!finalProps.opts.playerVars) {
|
|
85
|
+
finalProps.opts.playerVars = {};
|
|
66
86
|
}
|
|
67
87
|
|
|
68
88
|
if (booleanParamsSet.has(prop)) {
|
|
69
89
|
if (prop === "cc_load_policy" || prop === "modestbranding") {
|
|
70
90
|
// undefined or 1
|
|
71
91
|
if (value) {
|
|
72
|
-
|
|
92
|
+
finalProps.opts.playerVars[prop] = 1;
|
|
73
93
|
} else {
|
|
74
|
-
delete
|
|
94
|
+
delete finalProps.opts.playerVars[prop];
|
|
75
95
|
}
|
|
76
96
|
} else {
|
|
77
97
|
// 0 or 1
|
|
78
|
-
|
|
98
|
+
finalProps.opts.playerVars[prop] = value ? 1 : 0;
|
|
79
99
|
}
|
|
80
100
|
} else {
|
|
81
|
-
|
|
101
|
+
finalProps.opts.playerVars[prop] = value;
|
|
82
102
|
}
|
|
83
103
|
}
|
|
84
104
|
}
|
|
85
105
|
|
|
86
106
|
return React.createElement(YouTubeImpl, Object.assign({
|
|
87
107
|
ref: ref
|
|
88
|
-
},
|
|
108
|
+
}, finalProps));
|
|
89
109
|
});
|
|
90
|
-
|
|
91
|
-
name: "
|
|
110
|
+
var youtubeMeta = {
|
|
111
|
+
name: "hostless-youtube",
|
|
112
|
+
displayName: "YouTube",
|
|
113
|
+
importName: "YouTube",
|
|
92
114
|
importPath: "@plasmicpkgs/react-youtube",
|
|
93
115
|
props: {
|
|
94
116
|
videoId: {
|
|
95
117
|
type: "string",
|
|
96
118
|
defaultValue: "R6MeLqRQzYw",
|
|
97
119
|
displayName: "Video ID",
|
|
98
|
-
description: "The ID for the YouTube video
|
|
120
|
+
description: "The ID for the YouTube video"
|
|
99
121
|
},
|
|
100
122
|
autoplay: {
|
|
101
123
|
type: "boolean",
|
|
102
124
|
displayName: "Auto Play",
|
|
103
|
-
description: "Whether the video
|
|
125
|
+
description: "Whether the video should automatically start playing when the player loads",
|
|
126
|
+
defaultValueHint: false
|
|
104
127
|
},
|
|
105
128
|
cc_load_policy: {
|
|
106
129
|
type: "boolean",
|
|
107
130
|
displayName: "Show Captions",
|
|
108
|
-
description: "Whether the captions should be shown by default, even if the user has turned captions off"
|
|
131
|
+
description: "Whether the captions should be shown by default, even if the user has turned captions off",
|
|
132
|
+
defaultValueHint: false
|
|
109
133
|
},
|
|
110
134
|
start: {
|
|
111
135
|
type: "number",
|
|
112
136
|
displayName: "Start",
|
|
113
|
-
description: "The video should begin at this amount of seconds from the start of the video"
|
|
137
|
+
description: "The video should begin at this amount of seconds from the start of the video",
|
|
138
|
+
defaultValueHint: 0
|
|
114
139
|
},
|
|
115
140
|
end: {
|
|
116
141
|
type: "number",
|
|
@@ -121,42 +146,50 @@ registerComponent(YouTube, {
|
|
|
121
146
|
type: "choice",
|
|
122
147
|
displayName: "Color",
|
|
123
148
|
options: ["red", "white"],
|
|
124
|
-
description: "The color used in the display bar to highlight how much of the video the viewer has already seen"
|
|
149
|
+
description: "The color used in the display bar to highlight how much of the video the viewer has already seen",
|
|
150
|
+
defaultValueHint: "red"
|
|
125
151
|
},
|
|
126
152
|
controls: {
|
|
127
153
|
type: "boolean",
|
|
128
154
|
displayName: "Show Controls",
|
|
129
|
-
description: "Whether the YouTube video player controls should be displayed"
|
|
155
|
+
description: "Whether the YouTube video player controls should be displayed",
|
|
156
|
+
defaultValueHint: true
|
|
130
157
|
},
|
|
131
158
|
disablekb: {
|
|
132
159
|
type: "boolean",
|
|
133
160
|
displayName: "Disable Keyboard",
|
|
134
|
-
description: "Whether the keyboard controls should be disabled"
|
|
161
|
+
description: "Whether the keyboard controls should be disabled",
|
|
162
|
+
defaultValueHint: false
|
|
135
163
|
},
|
|
136
164
|
fs: {
|
|
137
165
|
type: "boolean",
|
|
138
166
|
displayName: "FullScreen Button",
|
|
139
|
-
description: "Whether the fullscreen button should be displayed"
|
|
167
|
+
description: "Whether the fullscreen button should be displayed",
|
|
168
|
+
defaultValueHint: true
|
|
140
169
|
},
|
|
141
170
|
loop: {
|
|
142
171
|
type: "boolean",
|
|
143
172
|
displayName: "Loop",
|
|
144
|
-
description: "Whether the video should be played again after it finishes"
|
|
173
|
+
description: "Whether the video should be played again after it finishes",
|
|
174
|
+
defaultValueHint: false
|
|
145
175
|
},
|
|
146
176
|
modestbranding: {
|
|
147
177
|
type: "boolean",
|
|
148
178
|
displayName: "Hide Logo",
|
|
149
|
-
description: "Hide the YouTube logo"
|
|
179
|
+
description: "Hide the YouTube logo in the control bar",
|
|
180
|
+
defaultValueHint: false
|
|
150
181
|
},
|
|
151
182
|
playsinline: {
|
|
152
183
|
type: "boolean",
|
|
153
184
|
displayName: "Play Inline",
|
|
154
|
-
description: "Whether the video should be played inline or fullscreen on iOS"
|
|
185
|
+
description: "Whether the video should be played inline or fullscreen on iOS",
|
|
186
|
+
defaultValueHint: false
|
|
155
187
|
},
|
|
156
188
|
rel: {
|
|
157
189
|
type: "boolean",
|
|
158
190
|
displayName: "Related Videos",
|
|
159
|
-
description: "Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)"
|
|
191
|
+
description: "Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)",
|
|
192
|
+
defaultValueHint: true
|
|
160
193
|
}
|
|
161
194
|
},
|
|
162
195
|
isDefaultExport: true,
|
|
@@ -166,7 +199,16 @@ registerComponent(YouTube, {
|
|
|
166
199
|
maxHeight: "100%",
|
|
167
200
|
maxWidth: "100%"
|
|
168
201
|
}
|
|
169
|
-
}
|
|
202
|
+
};
|
|
203
|
+
function registerYouTube(loader, customYouTubeMeta) {
|
|
204
|
+
if (loader) {
|
|
205
|
+
loader.registerComponent(YouTube, customYouTubeMeta != null ? customYouTubeMeta : youtubeMeta);
|
|
206
|
+
} else {
|
|
207
|
+
registerComponent(YouTube, customYouTubeMeta != null ? customYouTubeMeta : youtubeMeta);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
170
210
|
|
|
171
211
|
exports.default = YouTube;
|
|
212
|
+
exports.registerYouTube = registerYouTube;
|
|
213
|
+
exports.youtubeMeta = youtubeMeta;
|
|
172
214
|
//# sourceMappingURL=react-youtube.cjs.development.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-youtube.cjs.development.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport YouTubeImpl, {\n PlayerVars,\n YouTubeProps as YouTubeImplProps,\n} from \"react-youtube\";\n\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n };\nconst playerParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"color\",\n \"controls\",\n \"disablekb\",\n \"enablejsapi\",\n \"end\",\n \"fs\",\n \"hl\",\n \"iv_load_policy\",\n \"list\",\n \"listType\",\n \"loop\",\n \"modestbranding\",\n \"origin\",\n \"playlist\",\n \"playsinline\",\n \"rel\",\n \"showinfo\",\n \"start\",\n \"mute\",\n] as const;\n\nconst booleanParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"controls\",\n \"disablekb\",\n \"fs\",\n \"loop\",\n \"modestbranding\",\n \"playsinline\",\n \"rel\",\n] as const;\n\nconst booleanParamsSet = new Set<string>(booleanParams);\n\nconst YouTube = React.forwardRef<YouTubeImpl, YouTubeProps>(\n (props: YouTubeProps, ref) => {\n for (const prop of playerParams) {\n if (prop in props) {\n const value = props[prop];\n delete props[prop];\n if (!props.opts) {\n props.opts = {};\n }\n if (!props.opts.playerVars) {\n props.opts.playerVars = {};\n }\n if (booleanParamsSet.has(prop)) {\n if (prop === \"cc_load_policy\" || prop === \"modestbranding\") {\n // undefined or 1\n if (value) {\n props.opts.playerVars[prop] = 1;\n } else {\n delete props.opts.playerVars[prop];\n }\n } else {\n // 0 or 1\n props.opts.playerVars[prop] = (value ? 1 : 0) as any;\n }\n } else {\n props.opts.playerVars[prop] = value as any;\n }\n }\n }\n return <YouTubeImpl ref={ref} {...props} />;\n }\n);\n\nregisterComponent(YouTube, {\n name: \"YouTube\",\n importPath: \"@plasmicpkgs/react-youtube\",\n props: {\n videoId: {\n type: \"string\",\n defaultValue: \"R6MeLqRQzYw\",\n displayName: \"Video ID\",\n description: \"The ID for the YouTube video.\",\n },\n autoplay: {\n type: \"boolean\",\n displayName: \"Auto Play\",\n description:\n \"Whether the video show automatically start playing when the player loads\",\n },\n cc_load_policy: {\n type: \"boolean\",\n displayName: \"Show Captions\",\n description:\n \"Whether the captions should be shown by default, even if the user has turned captions off\",\n },\n start: {\n type: \"number\",\n displayName: \"Start\",\n description:\n \"The video should begin at this amount of seconds from the start of the video\",\n },\n end: {\n type: \"number\",\n displayName: \"End\",\n description:\n \"Stop playing the video after this amount of seconds (measured from the start of the video)\",\n },\n color: {\n type: \"choice\",\n displayName: \"Color\",\n options: [\"red\", \"white\"],\n description:\n \"The color used in the display bar to highlight how much of the video the viewer has already seen\",\n },\n controls: {\n type: \"boolean\",\n displayName: \"Show Controls\",\n description:\n \"Whether the YouTube video player controls should be displayed\",\n },\n disablekb: {\n type: \"boolean\",\n displayName: \"Disable Keyboard\",\n description: \"Whether the keyboard controls should be disabled\",\n },\n fs: {\n type: \"boolean\",\n displayName: \"FullScreen Button\",\n description: \"Whether the fullscreen button should be displayed\",\n },\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description: \"Whether the video should be played again after it finishes\",\n },\n modestbranding: {\n type: \"boolean\",\n displayName: \"Hide Logo\",\n description: \"Hide the YouTube logo\",\n },\n playsinline: {\n type: \"boolean\",\n displayName: \"Play Inline\",\n description:\n \"Whether the video should be played inline or fullscreen on iOS\",\n },\n rel: {\n type: \"boolean\",\n displayName: \"Related Videos\",\n description:\n \"Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)\",\n },\n },\n isDefaultExport: true,\n defaultStyles: {\n height: \"390px\",\n width: \"640px\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n },\n});\n\nexport default YouTube;\n"],"names":["playerParams","booleanParams","booleanParamsSet","Set","YouTube","React","forwardRef","props","ref","prop","value","opts","playerVars","has","YouTubeImpl","registerComponent","name","importPath","videoId","type","defaultValue","displayName","description","autoplay","cc_load_policy","start","end","color","options","controls","disablekb","fs","loop","modestbranding","playsinline","rel","isDefaultExport","defaultStyles","height","width","maxHeight","maxWidth"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AM,EAAE,OADK;AAEbC,IAAAA,KAAK,EAAE,OAFM;AAGbC,IAAAA,SAAS,EAAE,MAHE;AAIbC,IAAAA,QAAQ,EAAE;AAJG;AAjFU,CAAV,CAAjB;;;;"}
|
|
1
|
+
{"version":3,"file":"react-youtube.cjs.development.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport YouTubeImpl, {\n PlayerVars,\n YouTubeProps as YouTubeImplProps,\n} from \"react-youtube\";\n\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n };\nconst playerParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"color\",\n \"controls\",\n \"disablekb\",\n \"enablejsapi\",\n \"end\",\n \"fs\",\n \"hl\",\n \"iv_load_policy\",\n \"list\",\n \"listType\",\n \"loop\",\n \"modestbranding\",\n \"origin\",\n \"playlist\",\n \"playsinline\",\n \"rel\",\n \"showinfo\",\n \"start\",\n \"mute\",\n] as const;\n\nconst booleanParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"controls\",\n \"disablekb\",\n \"fs\",\n \"loop\",\n \"modestbranding\",\n \"playsinline\",\n \"rel\",\n] as const;\n\nconst booleanParamsSet = new Set<string>(booleanParams);\n\nconst YouTube = React.forwardRef<YouTubeImpl, YouTubeProps>(\n (props: YouTubeProps, ref) => {\n const finalProps = { ...props };\n for (const prop of playerParams) {\n if (prop in finalProps) {\n const value = finalProps[prop];\n delete finalProps[prop];\n if (!finalProps.opts) {\n finalProps.opts = {};\n }\n if (!finalProps.opts.playerVars) {\n finalProps.opts.playerVars = {};\n }\n if (booleanParamsSet.has(prop)) {\n if (prop === \"cc_load_policy\" || prop === \"modestbranding\") {\n // undefined or 1\n if (value) {\n finalProps.opts.playerVars[prop] = 1;\n } else {\n delete finalProps.opts.playerVars[prop];\n }\n } else {\n // 0 or 1\n finalProps.opts.playerVars[prop] = (value ? 1 : 0) as any;\n }\n } else {\n finalProps.opts.playerVars[prop] = value as any;\n }\n }\n }\n return <YouTubeImpl ref={ref} {...finalProps} />;\n }\n);\n\nexport const youtubeMeta: ComponentMeta<YouTubeProps> = {\n name: \"hostless-youtube\",\n displayName: \"YouTube\",\n importName: \"YouTube\",\n importPath: \"@plasmicpkgs/react-youtube\",\n props: {\n videoId: {\n type: \"string\",\n defaultValue: \"R6MeLqRQzYw\",\n displayName: \"Video ID\",\n description: \"The ID for the YouTube video\",\n },\n autoplay: {\n type: \"boolean\",\n displayName: \"Auto Play\",\n description:\n \"Whether the video should automatically start playing when the player loads\",\n defaultValueHint: false,\n },\n cc_load_policy: {\n type: \"boolean\",\n displayName: \"Show Captions\",\n description:\n \"Whether the captions should be shown by default, even if the user has turned captions off\",\n defaultValueHint: false,\n },\n start: {\n type: \"number\",\n displayName: \"Start\",\n description:\n \"The video should begin at this amount of seconds from the start of the video\",\n defaultValueHint: 0,\n },\n end: {\n type: \"number\",\n displayName: \"End\",\n description:\n \"Stop playing the video after this amount of seconds (measured from the start of the video)\",\n },\n color: {\n type: \"choice\",\n displayName: \"Color\",\n options: [\"red\", \"white\"],\n description:\n \"The color used in the display bar to highlight how much of the video the viewer has already seen\",\n defaultValueHint: \"red\",\n },\n controls: {\n type: \"boolean\",\n displayName: \"Show Controls\",\n description:\n \"Whether the YouTube video player controls should be displayed\",\n defaultValueHint: true,\n },\n disablekb: {\n type: \"boolean\",\n displayName: \"Disable Keyboard\",\n description: \"Whether the keyboard controls should be disabled\",\n defaultValueHint: false,\n },\n fs: {\n type: \"boolean\",\n displayName: \"FullScreen Button\",\n description: \"Whether the fullscreen button should be displayed\",\n defaultValueHint: true,\n },\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description: \"Whether the video should be played again after it finishes\",\n defaultValueHint: false,\n },\n modestbranding: {\n type: \"boolean\",\n displayName: \"Hide Logo\",\n description: \"Hide the YouTube logo in the control bar\",\n defaultValueHint: false,\n },\n playsinline: {\n type: \"boolean\",\n displayName: \"Play Inline\",\n description:\n \"Whether the video should be played inline or fullscreen on iOS\",\n defaultValueHint: false,\n },\n rel: {\n type: \"boolean\",\n displayName: \"Related Videos\",\n description:\n \"Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)\",\n defaultValueHint: true,\n },\n },\n isDefaultExport: true,\n defaultStyles: {\n height: \"390px\",\n width: \"640px\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerYouTube(\n loader?: { registerComponent: typeof registerComponent },\n customYouTubeMeta?: ComponentMeta<YouTubeProps>\n) {\n if (loader) {\n loader.registerComponent(YouTube, customYouTubeMeta ?? youtubeMeta);\n } else {\n registerComponent(YouTube, customYouTubeMeta ?? youtubeMeta);\n }\n}\n\nexport default YouTube;\n"],"names":["playerParams","booleanParams","booleanParamsSet","Set","YouTube","React","forwardRef","props","ref","finalProps","prop","value","opts","playerVars","has","YouTubeImpl","youtubeMeta","name","displayName","importName","importPath","videoId","type","defaultValue","description","autoplay","defaultValueHint","cc_load_policy","start","end","color","options","controls","disablekb","fs","loop","modestbranding","playsinline","rel","isDefaultExport","defaultStyles","height","width","maxHeight","maxWidth","registerYouTube","loader","customYouTubeMeta","registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAMA,YAAY,GAAG,CACnB,UADmB,EAEnB,gBAFmB,EAGnB,OAHmB,EAInB,UAJmB,EAKnB,WALmB,EAMnB,aANmB,EAOnB,KAPmB,EAQnB,IARmB,EASnB,IATmB,EAUnB,gBAVmB,EAWnB,MAXmB,EAYnB,UAZmB,EAanB,MAbmB,EAcnB,gBAdmB,EAenB,QAfmB,EAgBnB,UAhBmB,EAiBnB,aAjBmB,EAkBnB,KAlBmB,EAmBnB,UAnBmB,EAoBnB,OApBmB,EAqBnB,MArBmB,CAArB;AAwBA,IAAMC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HM,MAAAA,WAAW,EACT,mHAJC;AAKHE,MAAAA,gBAAgB,EAAE;AALf;AAhFA,GAL+C;AA6FtDa,EAAAA,eAAe,EAAE,IA7FqC;AA8FtDC,EAAAA,aAAa,EAAE;AACbC,IAAAA,MAAM,EAAE,OADK;AAEbC,IAAAA,KAAK,EAAE,OAFM;AAGbC,IAAAA,SAAS,EAAE,MAHE;AAIbC,IAAAA,QAAQ,EAAE;AAJG;AA9FuC;SAsGxCC,gBACdC,QACAC;AAEA,MAAID,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CAAyB5C,OAAzB,EAAkC2C,iBAAlC,WAAkCA,iBAAlC,GAAuD/B,WAAvD;AACD,GAFD,MAEO;AACLgC,IAAAA,iBAAiB,CAAC5C,OAAD,EAAU2C,iBAAV,WAAUA,iBAAV,GAA+B/B,WAA/B,CAAjB;AACD;AACF;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),o=e(require("react")),a=e(require("react-youtube"));function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,a=new Array(t);o<t;o++)a[o]=e[o];return a}var
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("@plasmicapp/host/registerComponent")),o=e(require("react")),a=e(require("react-youtube"));function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(e[a]=o[a])}return e}).apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,a=new Array(t);o<t;o++)a[o]=e[o];return a}var l=["autoplay","cc_load_policy","color","controls","disablekb","enablejsapi","end","fs","hl","iv_load_policy","list","listType","loop","modestbranding","origin","playlist","playsinline","rel","showinfo","start","mute"],n=new Set(["autoplay","cc_load_policy","controls","disablekb","fs","loop","modestbranding","playsinline","rel"]),s=o.forwardRef((function(e,t){for(var s,d=r({},e),p=function(e,t){var o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(o)return(o=o.call(e)).next.bind(o);if(Array.isArray(e)||(o=function(e,t){if(e){if("string"==typeof e)return i(e,void 0);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?i(e,void 0):void 0}}(e))){o&&(e=o);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(l);!(s=p()).done;){var u=s.value;if(u in d){var h=d[u];delete d[u],d.opts||(d.opts={}),d.opts.playerVars||(d.opts.playerVars={}),n.has(u)?"cc_load_policy"===u||"modestbranding"===u?h?d.opts.playerVars[u]=1:delete d.opts.playerVars[u]:d.opts.playerVars[u]=h?1:0:d.opts.playerVars[u]=h}}return o.createElement(a,Object.assign({ref:t},d))})),d={name:"hostless-youtube",displayName:"YouTube",importName:"YouTube",importPath:"@plasmicpkgs/react-youtube",props:{videoId:{type:"string",defaultValue:"R6MeLqRQzYw",displayName:"Video ID",description:"The ID for the YouTube video"},autoplay:{type:"boolean",displayName:"Auto Play",description:"Whether the video should automatically start playing when the player loads",defaultValueHint:!1},cc_load_policy:{type:"boolean",displayName:"Show Captions",description:"Whether the captions should be shown by default, even if the user has turned captions off",defaultValueHint:!1},start:{type:"number",displayName:"Start",description:"The video should begin at this amount of seconds from the start of the video",defaultValueHint:0},end:{type:"number",displayName:"End",description:"Stop playing the video after this amount of seconds (measured from the start of the video)"},color:{type:"choice",displayName:"Color",options:["red","white"],description:"The color used in the display bar to highlight how much of the video the viewer has already seen",defaultValueHint:"red"},controls:{type:"boolean",displayName:"Show Controls",description:"Whether the YouTube video player controls should be displayed",defaultValueHint:!0},disablekb:{type:"boolean",displayName:"Disable Keyboard",description:"Whether the keyboard controls should be disabled",defaultValueHint:!1},fs:{type:"boolean",displayName:"FullScreen Button",description:"Whether the fullscreen button should be displayed",defaultValueHint:!0},loop:{type:"boolean",displayName:"Loop",description:"Whether the video should be played again after it finishes",defaultValueHint:!1},modestbranding:{type:"boolean",displayName:"Hide Logo",description:"Hide the YouTube logo in the control bar",defaultValueHint:!1},playsinline:{type:"boolean",displayName:"Play Inline",description:"Whether the video should be played inline or fullscreen on iOS",defaultValueHint:!1},rel:{type:"boolean",displayName:"Related Videos",description:"Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)",defaultValueHint:!0}},isDefaultExport:!0,defaultStyles:{height:"390px",width:"640px",maxHeight:"100%",maxWidth:"100%"}};exports.default=s,exports.registerYouTube=function(e,o){e?e.registerComponent(s,null!=o?o:d):t(s,null!=o?o:d)},exports.youtubeMeta=d;
|
|
2
2
|
//# sourceMappingURL=react-youtube.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-youtube.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport YouTubeImpl, {\n PlayerVars,\n YouTubeProps as YouTubeImplProps,\n} from \"react-youtube\";\n\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n };\nconst playerParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"color\",\n \"controls\",\n \"disablekb\",\n \"enablejsapi\",\n \"end\",\n \"fs\",\n \"hl\",\n \"iv_load_policy\",\n \"list\",\n \"listType\",\n \"loop\",\n \"modestbranding\",\n \"origin\",\n \"playlist\",\n \"playsinline\",\n \"rel\",\n \"showinfo\",\n \"start\",\n \"mute\",\n] as const;\n\nconst booleanParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"controls\",\n \"disablekb\",\n \"fs\",\n \"loop\",\n \"modestbranding\",\n \"playsinline\",\n \"rel\",\n] as const;\n\nconst booleanParamsSet = new Set<string>(booleanParams);\n\nconst YouTube = React.forwardRef<YouTubeImpl, YouTubeProps>(\n (props: YouTubeProps, ref) => {\n for (const prop of playerParams) {\n if (prop in
|
|
1
|
+
{"version":3,"file":"react-youtube.cjs.production.min.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport YouTubeImpl, {\n PlayerVars,\n YouTubeProps as YouTubeImplProps,\n} from \"react-youtube\";\n\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n };\nconst playerParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"color\",\n \"controls\",\n \"disablekb\",\n \"enablejsapi\",\n \"end\",\n \"fs\",\n \"hl\",\n \"iv_load_policy\",\n \"list\",\n \"listType\",\n \"loop\",\n \"modestbranding\",\n \"origin\",\n \"playlist\",\n \"playsinline\",\n \"rel\",\n \"showinfo\",\n \"start\",\n \"mute\",\n] as const;\n\nconst booleanParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"controls\",\n \"disablekb\",\n \"fs\",\n \"loop\",\n \"modestbranding\",\n \"playsinline\",\n \"rel\",\n] as const;\n\nconst booleanParamsSet = new Set<string>(booleanParams);\n\nconst YouTube = React.forwardRef<YouTubeImpl, YouTubeProps>(\n (props: YouTubeProps, ref) => {\n const finalProps = { ...props };\n for (const prop of playerParams) {\n if (prop in finalProps) {\n const value = finalProps[prop];\n delete finalProps[prop];\n if (!finalProps.opts) {\n finalProps.opts = {};\n }\n if (!finalProps.opts.playerVars) {\n finalProps.opts.playerVars = {};\n }\n if (booleanParamsSet.has(prop)) {\n if (prop === \"cc_load_policy\" || prop === \"modestbranding\") {\n // undefined or 1\n if (value) {\n finalProps.opts.playerVars[prop] = 1;\n } else {\n delete finalProps.opts.playerVars[prop];\n }\n } else {\n // 0 or 1\n finalProps.opts.playerVars[prop] = (value ? 1 : 0) as any;\n }\n } else {\n finalProps.opts.playerVars[prop] = value as any;\n }\n }\n }\n return <YouTubeImpl ref={ref} {...finalProps} />;\n }\n);\n\nexport const youtubeMeta: ComponentMeta<YouTubeProps> = {\n name: \"hostless-youtube\",\n displayName: \"YouTube\",\n importName: \"YouTube\",\n importPath: \"@plasmicpkgs/react-youtube\",\n props: {\n videoId: {\n type: \"string\",\n defaultValue: \"R6MeLqRQzYw\",\n displayName: \"Video ID\",\n description: \"The ID for the YouTube video\",\n },\n autoplay: {\n type: \"boolean\",\n displayName: \"Auto Play\",\n description:\n \"Whether the video should automatically start playing when the player loads\",\n defaultValueHint: false,\n },\n cc_load_policy: {\n type: \"boolean\",\n displayName: \"Show Captions\",\n description:\n \"Whether the captions should be shown by default, even if the user has turned captions off\",\n defaultValueHint: false,\n },\n start: {\n type: \"number\",\n displayName: \"Start\",\n description:\n \"The video should begin at this amount of seconds from the start of the video\",\n defaultValueHint: 0,\n },\n end: {\n type: \"number\",\n displayName: \"End\",\n description:\n \"Stop playing the video after this amount of seconds (measured from the start of the video)\",\n },\n color: {\n type: \"choice\",\n displayName: \"Color\",\n options: [\"red\", \"white\"],\n description:\n \"The color used in the display bar to highlight how much of the video the viewer has already seen\",\n defaultValueHint: \"red\",\n },\n controls: {\n type: \"boolean\",\n displayName: \"Show Controls\",\n description:\n \"Whether the YouTube video player controls should be displayed\",\n defaultValueHint: true,\n },\n disablekb: {\n type: \"boolean\",\n displayName: \"Disable Keyboard\",\n description: \"Whether the keyboard controls should be disabled\",\n defaultValueHint: false,\n },\n fs: {\n type: \"boolean\",\n displayName: \"FullScreen Button\",\n description: \"Whether the fullscreen button should be displayed\",\n defaultValueHint: true,\n },\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description: \"Whether the video should be played again after it finishes\",\n defaultValueHint: false,\n },\n modestbranding: {\n type: \"boolean\",\n displayName: \"Hide Logo\",\n description: \"Hide the YouTube logo in the control bar\",\n defaultValueHint: false,\n },\n playsinline: {\n type: \"boolean\",\n displayName: \"Play Inline\",\n description:\n \"Whether the video should be played inline or fullscreen on iOS\",\n defaultValueHint: false,\n },\n rel: {\n type: \"boolean\",\n displayName: \"Related Videos\",\n description:\n \"Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)\",\n defaultValueHint: true,\n },\n },\n isDefaultExport: true,\n defaultStyles: {\n height: \"390px\",\n width: \"640px\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerYouTube(\n loader?: { registerComponent: typeof registerComponent },\n customYouTubeMeta?: ComponentMeta<YouTubeProps>\n) {\n if (loader) {\n loader.registerComponent(YouTube, customYouTubeMeta ?? youtubeMeta);\n } else {\n registerComponent(YouTube, customYouTubeMeta ?? youtubeMeta);\n }\n}\n\nexport default YouTube;\n"],"names":["playerParams","booleanParamsSet","Set","YouTube","React","forwardRef","props","ref","finalProps","prop","value","opts","playerVars","has","YouTubeImpl","youtubeMeta","name","displayName","importName","importPath","videoId","type","defaultValue","description","autoplay","defaultValueHint","cc_load_policy","start","end","color","options","controls","disablekb","fs","loop","modestbranding","playsinline","rel","isDefaultExport","defaultStyles","height","width","maxHeight","maxWidth","loader","customYouTubeMeta","registerComponent"],"mappings":"8iBAeA,IAAMA,EAAe,CACnB,WACA,iBACA,QACA,WACA,YACA,cACA,MACA,KACA,KACA,iBACA,OACA,WACA,OACA,iBACA,SACA,WACA,cACA,MACA,WACA,QACA,QAeIC,EAAmB,IAAIC,IAZP,CACpB,WACA,iBACA,WACA,YACA,KACA,OACA,iBACA,cACA,QAKIC,EAAUC,EAAMC,YACpB,SAACC,EAAqBC,aACdC,OAAkBF,yrBACLN,kBAAc,KAAtBS,aACLA,KAAQD,EAAY,KAChBE,EAAQF,E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E,kBAAkB,GAEpBY,IAAK,CACHhB,KAAM,UACNJ,YAAa,iBACbM,YACE,oHACFE,kBAAkB,IAGtBa,iBAAiB,EACjBC,cAAe,CACbC,OAAQ,QACRC,MAAO,QACPC,UAAW,OACXC,SAAU,4DAKZC,EACAC,GAEID,EACFA,EAAOE,kBAAkB3C,QAAS0C,EAAAA,EAAqB9B,GAEvD+B,EAAkB3C,QAAS0C,EAAAA,EAAqB9B"}
|
|
@@ -2,6 +2,24 @@ import registerComponent from '@plasmicapp/host/registerComponent';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import YouTubeImpl from 'react-youtube';
|
|
4
4
|
|
|
5
|
+
function _extends() {
|
|
6
|
+
_extends = Object.assign || function (target) {
|
|
7
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8
|
+
var source = arguments[i];
|
|
9
|
+
|
|
10
|
+
for (var key in source) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
+
target[key] = source[key];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return _extends.apply(this, arguments);
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
function _unsupportedIterableToArray(o, minLen) {
|
|
6
24
|
if (!o) return;
|
|
7
25
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -44,67 +62,74 @@ var playerParams = ["autoplay", "cc_load_policy", "color", "controls", "disablek
|
|
|
44
62
|
var booleanParams = ["autoplay", "cc_load_policy", "controls", "disablekb", "fs", "loop", "modestbranding", "playsinline", "rel"];
|
|
45
63
|
var booleanParamsSet = /*#__PURE__*/new Set(booleanParams);
|
|
46
64
|
var YouTube = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
65
|
+
var finalProps = _extends({}, props);
|
|
66
|
+
|
|
47
67
|
for (var _iterator = _createForOfIteratorHelperLoose(playerParams), _step; !(_step = _iterator()).done;) {
|
|
48
68
|
var prop = _step.value;
|
|
49
69
|
|
|
50
|
-
if (prop in
|
|
51
|
-
var value =
|
|
52
|
-
delete
|
|
70
|
+
if (prop in finalProps) {
|
|
71
|
+
var value = finalProps[prop];
|
|
72
|
+
delete finalProps[prop];
|
|
53
73
|
|
|
54
|
-
if (!
|
|
55
|
-
|
|
74
|
+
if (!finalProps.opts) {
|
|
75
|
+
finalProps.opts = {};
|
|
56
76
|
}
|
|
57
77
|
|
|
58
|
-
if (!
|
|
59
|
-
|
|
78
|
+
if (!finalProps.opts.playerVars) {
|
|
79
|
+
finalProps.opts.playerVars = {};
|
|
60
80
|
}
|
|
61
81
|
|
|
62
82
|
if (booleanParamsSet.has(prop)) {
|
|
63
83
|
if (prop === "cc_load_policy" || prop === "modestbranding") {
|
|
64
84
|
// undefined or 1
|
|
65
85
|
if (value) {
|
|
66
|
-
|
|
86
|
+
finalProps.opts.playerVars[prop] = 1;
|
|
67
87
|
} else {
|
|
68
|
-
delete
|
|
88
|
+
delete finalProps.opts.playerVars[prop];
|
|
69
89
|
}
|
|
70
90
|
} else {
|
|
71
91
|
// 0 or 1
|
|
72
|
-
|
|
92
|
+
finalProps.opts.playerVars[prop] = value ? 1 : 0;
|
|
73
93
|
}
|
|
74
94
|
} else {
|
|
75
|
-
|
|
95
|
+
finalProps.opts.playerVars[prop] = value;
|
|
76
96
|
}
|
|
77
97
|
}
|
|
78
98
|
}
|
|
79
99
|
|
|
80
100
|
return React.createElement(YouTubeImpl, Object.assign({
|
|
81
101
|
ref: ref
|
|
82
|
-
},
|
|
102
|
+
}, finalProps));
|
|
83
103
|
});
|
|
84
|
-
|
|
85
|
-
name: "
|
|
104
|
+
var youtubeMeta = {
|
|
105
|
+
name: "hostless-youtube",
|
|
106
|
+
displayName: "YouTube",
|
|
107
|
+
importName: "YouTube",
|
|
86
108
|
importPath: "@plasmicpkgs/react-youtube",
|
|
87
109
|
props: {
|
|
88
110
|
videoId: {
|
|
89
111
|
type: "string",
|
|
90
112
|
defaultValue: "R6MeLqRQzYw",
|
|
91
113
|
displayName: "Video ID",
|
|
92
|
-
description: "The ID for the YouTube video
|
|
114
|
+
description: "The ID for the YouTube video"
|
|
93
115
|
},
|
|
94
116
|
autoplay: {
|
|
95
117
|
type: "boolean",
|
|
96
118
|
displayName: "Auto Play",
|
|
97
|
-
description: "Whether the video
|
|
119
|
+
description: "Whether the video should automatically start playing when the player loads",
|
|
120
|
+
defaultValueHint: false
|
|
98
121
|
},
|
|
99
122
|
cc_load_policy: {
|
|
100
123
|
type: "boolean",
|
|
101
124
|
displayName: "Show Captions",
|
|
102
|
-
description: "Whether the captions should be shown by default, even if the user has turned captions off"
|
|
125
|
+
description: "Whether the captions should be shown by default, even if the user has turned captions off",
|
|
126
|
+
defaultValueHint: false
|
|
103
127
|
},
|
|
104
128
|
start: {
|
|
105
129
|
type: "number",
|
|
106
130
|
displayName: "Start",
|
|
107
|
-
description: "The video should begin at this amount of seconds from the start of the video"
|
|
131
|
+
description: "The video should begin at this amount of seconds from the start of the video",
|
|
132
|
+
defaultValueHint: 0
|
|
108
133
|
},
|
|
109
134
|
end: {
|
|
110
135
|
type: "number",
|
|
@@ -115,42 +140,50 @@ registerComponent(YouTube, {
|
|
|
115
140
|
type: "choice",
|
|
116
141
|
displayName: "Color",
|
|
117
142
|
options: ["red", "white"],
|
|
118
|
-
description: "The color used in the display bar to highlight how much of the video the viewer has already seen"
|
|
143
|
+
description: "The color used in the display bar to highlight how much of the video the viewer has already seen",
|
|
144
|
+
defaultValueHint: "red"
|
|
119
145
|
},
|
|
120
146
|
controls: {
|
|
121
147
|
type: "boolean",
|
|
122
148
|
displayName: "Show Controls",
|
|
123
|
-
description: "Whether the YouTube video player controls should be displayed"
|
|
149
|
+
description: "Whether the YouTube video player controls should be displayed",
|
|
150
|
+
defaultValueHint: true
|
|
124
151
|
},
|
|
125
152
|
disablekb: {
|
|
126
153
|
type: "boolean",
|
|
127
154
|
displayName: "Disable Keyboard",
|
|
128
|
-
description: "Whether the keyboard controls should be disabled"
|
|
155
|
+
description: "Whether the keyboard controls should be disabled",
|
|
156
|
+
defaultValueHint: false
|
|
129
157
|
},
|
|
130
158
|
fs: {
|
|
131
159
|
type: "boolean",
|
|
132
160
|
displayName: "FullScreen Button",
|
|
133
|
-
description: "Whether the fullscreen button should be displayed"
|
|
161
|
+
description: "Whether the fullscreen button should be displayed",
|
|
162
|
+
defaultValueHint: true
|
|
134
163
|
},
|
|
135
164
|
loop: {
|
|
136
165
|
type: "boolean",
|
|
137
166
|
displayName: "Loop",
|
|
138
|
-
description: "Whether the video should be played again after it finishes"
|
|
167
|
+
description: "Whether the video should be played again after it finishes",
|
|
168
|
+
defaultValueHint: false
|
|
139
169
|
},
|
|
140
170
|
modestbranding: {
|
|
141
171
|
type: "boolean",
|
|
142
172
|
displayName: "Hide Logo",
|
|
143
|
-
description: "Hide the YouTube logo"
|
|
173
|
+
description: "Hide the YouTube logo in the control bar",
|
|
174
|
+
defaultValueHint: false
|
|
144
175
|
},
|
|
145
176
|
playsinline: {
|
|
146
177
|
type: "boolean",
|
|
147
178
|
displayName: "Play Inline",
|
|
148
|
-
description: "Whether the video should be played inline or fullscreen on iOS"
|
|
179
|
+
description: "Whether the video should be played inline or fullscreen on iOS",
|
|
180
|
+
defaultValueHint: false
|
|
149
181
|
},
|
|
150
182
|
rel: {
|
|
151
183
|
type: "boolean",
|
|
152
184
|
displayName: "Related Videos",
|
|
153
|
-
description: "Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)"
|
|
185
|
+
description: "Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)",
|
|
186
|
+
defaultValueHint: true
|
|
154
187
|
}
|
|
155
188
|
},
|
|
156
189
|
isDefaultExport: true,
|
|
@@ -160,7 +193,15 @@ registerComponent(YouTube, {
|
|
|
160
193
|
maxHeight: "100%",
|
|
161
194
|
maxWidth: "100%"
|
|
162
195
|
}
|
|
163
|
-
}
|
|
196
|
+
};
|
|
197
|
+
function registerYouTube(loader, customYouTubeMeta) {
|
|
198
|
+
if (loader) {
|
|
199
|
+
loader.registerComponent(YouTube, customYouTubeMeta != null ? customYouTubeMeta : youtubeMeta);
|
|
200
|
+
} else {
|
|
201
|
+
registerComponent(YouTube, customYouTubeMeta != null ? customYouTubeMeta : youtubeMeta);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
164
204
|
|
|
165
205
|
export default YouTube;
|
|
206
|
+
export { registerYouTube, youtubeMeta };
|
|
166
207
|
//# sourceMappingURL=react-youtube.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-youtube.esm.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport YouTubeImpl, {\n PlayerVars,\n YouTubeProps as YouTubeImplProps,\n} from \"react-youtube\";\n\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n };\nconst playerParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"color\",\n \"controls\",\n \"disablekb\",\n \"enablejsapi\",\n \"end\",\n \"fs\",\n \"hl\",\n \"iv_load_policy\",\n \"list\",\n \"listType\",\n \"loop\",\n \"modestbranding\",\n \"origin\",\n \"playlist\",\n \"playsinline\",\n \"rel\",\n \"showinfo\",\n \"start\",\n \"mute\",\n] as const;\n\nconst booleanParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"controls\",\n \"disablekb\",\n \"fs\",\n \"loop\",\n \"modestbranding\",\n \"playsinline\",\n \"rel\",\n] as const;\n\nconst booleanParamsSet = new Set<string>(booleanParams);\n\nconst YouTube = React.forwardRef<YouTubeImpl, YouTubeProps>(\n (props: YouTubeProps, ref) => {\n for (const prop of playerParams) {\n if (prop in props) {\n const value = props[prop];\n delete props[prop];\n if (!props.opts) {\n props.opts = {};\n }\n if (!props.opts.playerVars) {\n props.opts.playerVars = {};\n }\n if (booleanParamsSet.has(prop)) {\n if (prop === \"cc_load_policy\" || prop === \"modestbranding\") {\n // undefined or 1\n if (value) {\n props.opts.playerVars[prop] = 1;\n } else {\n delete props.opts.playerVars[prop];\n }\n } else {\n // 0 or 1\n props.opts.playerVars[prop] = (value ? 1 : 0) as any;\n }\n } else {\n props.opts.playerVars[prop] = value as any;\n }\n }\n }\n return <YouTubeImpl ref={ref} {...props} />;\n }\n);\n\nregisterComponent(YouTube, {\n name: \"YouTube\",\n importPath: \"@plasmicpkgs/react-youtube\",\n props: {\n videoId: {\n type: \"string\",\n defaultValue: \"R6MeLqRQzYw\",\n displayName: \"Video ID\",\n description: \"The ID for the YouTube video.\",\n },\n autoplay: {\n type: \"boolean\",\n displayName: \"Auto Play\",\n description:\n \"Whether the video show automatically start playing when the player loads\",\n },\n cc_load_policy: {\n type: \"boolean\",\n displayName: \"Show Captions\",\n description:\n \"Whether the captions should be shown by default, even if the user has turned captions off\",\n },\n start: {\n type: \"number\",\n displayName: \"Start\",\n description:\n \"The video should begin at this amount of seconds from the start of the video\",\n },\n end: {\n type: \"number\",\n displayName: \"End\",\n description:\n \"Stop playing the video after this amount of seconds (measured from the start of the video)\",\n },\n color: {\n type: \"choice\",\n displayName: \"Color\",\n options: [\"red\", \"white\"],\n description:\n \"The color used in the display bar to highlight how much of the video the viewer has already seen\",\n },\n controls: {\n type: \"boolean\",\n displayName: \"Show Controls\",\n description:\n \"Whether the YouTube video player controls should be displayed\",\n },\n disablekb: {\n type: \"boolean\",\n displayName: \"Disable Keyboard\",\n description: \"Whether the keyboard controls should be disabled\",\n },\n fs: {\n type: \"boolean\",\n displayName: \"FullScreen Button\",\n description: \"Whether the fullscreen button should be displayed\",\n },\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description: \"Whether the video should be played again after it finishes\",\n },\n modestbranding: {\n type: \"boolean\",\n displayName: \"Hide Logo\",\n description: \"Hide the YouTube logo\",\n },\n playsinline: {\n type: \"boolean\",\n displayName: \"Play Inline\",\n description:\n \"Whether the video should be played inline or fullscreen on iOS\",\n },\n rel: {\n type: \"boolean\",\n displayName: \"Related Videos\",\n description:\n \"Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)\",\n },\n },\n isDefaultExport: true,\n defaultStyles: {\n height: \"390px\",\n width: \"640px\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n },\n});\n\nexport default YouTube;\n"],"names":["playerParams","booleanParams","booleanParamsSet","Set","YouTube","React","forwardRef","props","ref","prop","value","opts","playerVars","has","YouTubeImpl","registerComponent","name","importPath","videoId","type","defaultValue","displayName","description","autoplay","cc_load_policy","start","end","color","options","controls","disablekb","fs","loop","modestbranding","playsinline","rel","isDefaultExport","defaultStyles","height","width","maxHeight","maxWidth"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAMA,YAAY,GAAG,CACnB,UADmB,EAEnB,gBAFmB,EAGnB,OAHmB,EAInB,UAJmB,EAKnB,WALmB,EAMnB,aANmB,EAOnB,KAPmB,EAQnB,IARmB,EASnB,IATmB,EAUnB,gBAVmB,EAWnB,MAXmB,EAYnB,UAZmB,EAanB,MAbmB,EAcnB,gBAdmB,EAenB,QAfmB,EAgBnB,UAhBmB,EAiBnB,aAjBmB,EAkBnB,KAlBmB,EAmBnB,UAnBmB,EAoBnB,OApBmB,EAqBnB,MArBmB,CAArB;AAwBA,IAAMC,aAAa,GAAG,CACpB,UADoB,EAEpB,gBAFoB,EAGpB,UAHoB,EAIpB,WAJoB,EAKpB,IALoB,EAMpB,MANoB,EAOpB,gBAPoB,EAQpB,aARoB,EASpB,KAToB,CAAtB;AAYA,IAAMC,gBAAgB,gBAAG,IAAIC,GAAJ,CAAgBF,aAAhB,CAAzB;AAEA,IAAMG,OAAO,gBAAGC,KAAK,CAACC,UAAN,CACd,UAACC,KAAD,EAAsBC,GAAtB;AACE,uDAAmBR,YAAnB,wCAAiC;AAAA,QAAtBS,IAAsB;;AAC/B,QAAIA,IAAI,IAAIF,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AAAA,WAAW,EAAE;AAHT,KAtDD;AA2DLW,IAAAA,cAAc,EAAE;AACdd,MAAAA,IAAI,EAAE,SADQ;AAEdE,MAAAA,WAAW,EAAE,WAFC;AAGdC,MAAAA,WAAW,EAAE;AAHC,KA3DX;AAgELY,IAAAA,WAAW,EAAE;AACXf,MAAAA,IAAI,EAAE,SADK;AAEXE,MAAAA,WAAW,EAAE,aAFF;AAGXC,MAAAA,WAAW,EACT;AAJS,KAhER;AAsELa,IAAAA,GAAG,EAAE;AACHhB,MAAAA,IAAI,EAAE,SADH;AAEHE,MAAAA,WAAW,EAAE,gBAFV;AAGHC,MAAAA,WAAW,EACT;AAJC;AAtEA,GAHkB;AAgFzBc,EAAAA,eAAe,EAAE,IAhFQ;AAiFzBC,EAAAA,aAAa,EAAE;AACbC,IAAAA,MAAM,EAAE,OADK;AAEbC,IAAAA,KAAK,EAAE,OAFM;AAGbC,IAAAA,SAAS,EAAE,MAHE;AAIbC,IAAAA,QAAQ,EAAE;AAJG;AAjFU,CAAV,CAAjB;;;;"}
|
|
1
|
+
{"version":3,"file":"react-youtube.esm.js","sources":["../src/index.tsx"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport YouTubeImpl, {\n PlayerVars,\n YouTubeProps as YouTubeImplProps,\n} from \"react-youtube\";\n\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n };\nconst playerParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"color\",\n \"controls\",\n \"disablekb\",\n \"enablejsapi\",\n \"end\",\n \"fs\",\n \"hl\",\n \"iv_load_policy\",\n \"list\",\n \"listType\",\n \"loop\",\n \"modestbranding\",\n \"origin\",\n \"playlist\",\n \"playsinline\",\n \"rel\",\n \"showinfo\",\n \"start\",\n \"mute\",\n] as const;\n\nconst booleanParams = [\n \"autoplay\",\n \"cc_load_policy\",\n \"controls\",\n \"disablekb\",\n \"fs\",\n \"loop\",\n \"modestbranding\",\n \"playsinline\",\n \"rel\",\n] as const;\n\nconst booleanParamsSet = new Set<string>(booleanParams);\n\nconst YouTube = React.forwardRef<YouTubeImpl, YouTubeProps>(\n (props: YouTubeProps, ref) => {\n const finalProps = { ...props };\n for (const prop of playerParams) {\n if (prop in finalProps) {\n const value = finalProps[prop];\n delete finalProps[prop];\n if (!finalProps.opts) {\n finalProps.opts = {};\n }\n if (!finalProps.opts.playerVars) {\n finalProps.opts.playerVars = {};\n }\n if (booleanParamsSet.has(prop)) {\n if (prop === \"cc_load_policy\" || prop === \"modestbranding\") {\n // undefined or 1\n if (value) {\n finalProps.opts.playerVars[prop] = 1;\n } else {\n delete finalProps.opts.playerVars[prop];\n }\n } else {\n // 0 or 1\n finalProps.opts.playerVars[prop] = (value ? 1 : 0) as any;\n }\n } else {\n finalProps.opts.playerVars[prop] = value as any;\n }\n }\n }\n return <YouTubeImpl ref={ref} {...finalProps} />;\n }\n);\n\nexport const youtubeMeta: ComponentMeta<YouTubeProps> = {\n name: \"hostless-youtube\",\n displayName: \"YouTube\",\n importName: \"YouTube\",\n importPath: \"@plasmicpkgs/react-youtube\",\n props: {\n videoId: {\n type: \"string\",\n defaultValue: \"R6MeLqRQzYw\",\n displayName: \"Video ID\",\n description: \"The ID for the YouTube video\",\n },\n autoplay: {\n type: \"boolean\",\n displayName: \"Auto Play\",\n description:\n \"Whether the video should automatically start playing when the player loads\",\n defaultValueHint: false,\n },\n cc_load_policy: {\n type: \"boolean\",\n displayName: \"Show Captions\",\n description:\n \"Whether the captions should be shown by default, even if the user has turned captions off\",\n defaultValueHint: false,\n },\n start: {\n type: \"number\",\n displayName: \"Start\",\n description:\n \"The video should begin at this amount of seconds from the start of the video\",\n defaultValueHint: 0,\n },\n end: {\n type: \"number\",\n displayName: \"End\",\n description:\n \"Stop playing the video after this amount of seconds (measured from the start of the video)\",\n },\n color: {\n type: \"choice\",\n displayName: \"Color\",\n options: [\"red\", \"white\"],\n description:\n \"The color used in the display bar to highlight how much of the video the viewer has already seen\",\n defaultValueHint: \"red\",\n },\n controls: {\n type: \"boolean\",\n displayName: \"Show Controls\",\n description:\n \"Whether the YouTube video player controls should be displayed\",\n defaultValueHint: true,\n },\n disablekb: {\n type: \"boolean\",\n displayName: \"Disable Keyboard\",\n description: \"Whether the keyboard controls should be disabled\",\n defaultValueHint: false,\n },\n fs: {\n type: \"boolean\",\n displayName: \"FullScreen Button\",\n description: \"Whether the fullscreen button should be displayed\",\n defaultValueHint: true,\n },\n loop: {\n type: \"boolean\",\n displayName: \"Loop\",\n description: \"Whether the video should be played again after it finishes\",\n defaultValueHint: false,\n },\n modestbranding: {\n type: \"boolean\",\n displayName: \"Hide Logo\",\n description: \"Hide the YouTube logo in the control bar\",\n defaultValueHint: false,\n },\n playsinline: {\n type: \"boolean\",\n displayName: \"Play Inline\",\n description:\n \"Whether the video should be played inline or fullscreen on iOS\",\n defaultValueHint: false,\n },\n rel: {\n type: \"boolean\",\n displayName: \"Related Videos\",\n description:\n \"Whether it should show related videos when the video ends (if false, it shows other videos from the same channel)\",\n defaultValueHint: true,\n },\n },\n isDefaultExport: true,\n defaultStyles: {\n height: \"390px\",\n width: \"640px\",\n maxHeight: \"100%\",\n maxWidth: \"100%\",\n },\n};\n\nexport function registerYouTube(\n loader?: { registerComponent: typeof registerComponent },\n customYouTubeMeta?: ComponentMeta<YouTubeProps>\n) {\n if (loader) {\n loader.registerComponent(YouTube, customYouTubeMeta ?? youtubeMeta);\n } else {\n registerComponent(YouTube, customYouTubeMeta ?? youtubeMeta);\n }\n}\n\nexport default YouTube;\n"],"names":["playerParams","booleanParams","booleanParamsSet","Set","YouTube","React","forwardRef","props","ref","finalProps","prop","value","opts","playerVars","has","YouTubeImpl","youtubeMeta","name","displayName","importName","importPath","videoId","type","defaultValue","description","autoplay","defaultValueHint","cc_load_policy","start","end","color","options","controls","disablekb","fs","loop","modestbranding","playsinline","rel","isDefaultExport","defaultStyles","height","width","maxHeight","maxWidth","registerYouTube","loader","customYouTubeMeta","registerComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAMA,YAAY,GAAG,CACnB,UADmB,EAEnB,gBAFmB,EAGnB,OAHmB,EAInB,UAJmB,EAKnB,WALmB,EAMnB,aANmB,EAOnB,KAPmB,EAQnB,IARmB,EASnB,IATmB,EAUnB,gBAVmB,EAWnB,MAXmB,EAYnB,UAZmB,EAanB,MAbmB,EAcnB,gBAdmB,EAenB,QAfmB,EAgBnB,UAhBmB,EAiBnB,aAjBmB,EAkBnB,KAlBmB,EAmBnB,UAnBmB,EAoBnB,OApBmB,EAqBnB,MArBmB,CAArB;AAwBA,IAAMC,aAAa,GAAG,CACpB,UADoB,EAEpB,gBAFoB,EAGpB,UAHoB,EAIpB,WAJoB,EAKpB,IALoB,EAMpB,MANoB,EAOpB,gBAPoB,EAQpB,aARoB,EASpB,KAToB,CAAtB;AAYA,IAAMC,gBAAgB,gBAAG,IAAIC,GAAJ,CAAgBF,aAAhB,CAAzB;AAEA,IAAMG,OAAO,gBAAGC,KAAK,CAACC,UAAN,CACd,UAACC,KAAD,EAAsBC,GAAtB;AACE,MAAMC,UAAU,gBAAQF,KAAR,CAAhB;;AACA,uDAAmBP,YAAnB,wCAAiC;AAAA,QAAtBU,IAAsB;;AAC/B,QAAIA,IAAI,IAAID,UAAZ,EAAwB;AACtB,UAAME,KAAK,GAAGF,UAAU,CAACC,IAAD,CAAxB;AACA,aAAOD,UAAU,CAACC,IAAD,CAAjB;;AACA,UAAI,CAACD,UAAU,CAACG,IAAhB,EAAsB;AACpBH,QAAAA,UAAU,CAACG,IAAX,GAAkB,EAAlB;AACD;;AACD,UAAI,CAACH,UAAU,CAACG,IAAX,CAAgBC,UAArB,EAAiC;AAC/BJ,QAAAA,UAAU,CAACG,IAAX,CAAgBC,UAAhB,GAA6B,EAA7B;AACD;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MAAAA,WAAW,EAAE,4DAHT;AAIJE,MAAAA,gBAAgB,EAAE;AAJd,KA7DD;AAmELU,IAAAA,cAAc,EAAE;AACdd,MAAAA,IAAI,EAAE,SADQ;AAEdJ,MAAAA,WAAW,EAAE,WAFC;AAGdM,MAAAA,WAAW,EAAE,0CAHC;AAIdE,MAAAA,gBAAgB,EAAE;AAJJ,KAnEX;AAyELW,IAAAA,WAAW,EAAE;AACXf,MAAAA,IAAI,EAAE,SADK;AAEXJ,MAAAA,WAAW,EAAE,aAFF;AAGXM,MAAAA,WAAW,EACT,gEAJS;AAKXE,MAAAA,gBAAgB,EAAE;AALP,KAzER;AAgFLY,IAAAA,GAAG,EAAE;AACHhB,MAAAA,IAAI,EAAE,SADH;AAEHJ,MAAAA,WAAW,EAAE,gBAFV;AAGHM,MAAAA,WAAW,EACT,mHAJC;AAKHE,MAAAA,gBAAgB,EAAE;AALf;AAhFA,GAL+C;AA6FtDa,EAAAA,eAAe,EAAE,IA7FqC;AA8FtDC,EAAAA,aAAa,EAAE;AACbC,IAAAA,MAAM,EAAE,OADK;AAEbC,IAAAA,KAAK,EAAE,OAFM;AAGbC,IAAAA,SAAS,EAAE,MAHE;AAIbC,IAAAA,QAAQ,EAAE;AAJG;AA9FuC;SAsGxCC,gBACdC,QACAC;AAEA,MAAID,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CAAyB5C,OAAzB,EAAkC2C,iBAAlC,WAAkCA,iBAAlC,GAAuD/B,WAAvD;AACD,GAFD,MAEO;AACLgC,IAAAA,iBAAiB,CAAC5C,OAAD,EAAU2C,iBAAV,WAAUA,iBAAV,GAA+B/B,WAA/B,CAAjB;AACD;AACF;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/react-youtube",
|
|
3
|
-
"version": "7.13.
|
|
3
|
+
"version": "7.13.6",
|
|
4
4
|
"description": "Plasmic registration call for react-youtube",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"typescript": "^3.9.7"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@plasmicapp/host": "^0.0
|
|
39
|
+
"@plasmicapp/host": "^1.0.0",
|
|
40
40
|
"react-youtube": "^7.13.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|