@plasmicpkgs/react-youtube 7.13.3 → 7.13.7
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 +37 -15
- 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 +36 -15
- 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;
|
|
@@ -107,30 +107,35 @@ var YouTube = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
107
107
|
ref: ref
|
|
108
108
|
}, finalProps));
|
|
109
109
|
});
|
|
110
|
-
|
|
111
|
-
name: "
|
|
110
|
+
var youtubeMeta = {
|
|
111
|
+
name: "hostless-youtube",
|
|
112
|
+
displayName: "YouTube",
|
|
113
|
+
importName: "YouTube",
|
|
112
114
|
importPath: "@plasmicpkgs/react-youtube",
|
|
113
115
|
props: {
|
|
114
116
|
videoId: {
|
|
115
117
|
type: "string",
|
|
116
118
|
defaultValue: "R6MeLqRQzYw",
|
|
117
119
|
displayName: "Video ID",
|
|
118
|
-
description: "The ID for the YouTube video
|
|
120
|
+
description: "The ID for the YouTube video"
|
|
119
121
|
},
|
|
120
122
|
autoplay: {
|
|
121
123
|
type: "boolean",
|
|
122
124
|
displayName: "Auto Play",
|
|
123
|
-
description: "Whether the video
|
|
125
|
+
description: "Whether the video should automatically start playing when the player loads",
|
|
126
|
+
defaultValueHint: false
|
|
124
127
|
},
|
|
125
128
|
cc_load_policy: {
|
|
126
129
|
type: "boolean",
|
|
127
130
|
displayName: "Show Captions",
|
|
128
|
-
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
|
|
129
133
|
},
|
|
130
134
|
start: {
|
|
131
135
|
type: "number",
|
|
132
136
|
displayName: "Start",
|
|
133
|
-
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
|
|
134
139
|
},
|
|
135
140
|
end: {
|
|
136
141
|
type: "number",
|
|
@@ -141,42 +146,50 @@ registerComponent(YouTube, {
|
|
|
141
146
|
type: "choice",
|
|
142
147
|
displayName: "Color",
|
|
143
148
|
options: ["red", "white"],
|
|
144
|
-
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"
|
|
145
151
|
},
|
|
146
152
|
controls: {
|
|
147
153
|
type: "boolean",
|
|
148
154
|
displayName: "Show Controls",
|
|
149
|
-
description: "Whether the YouTube video player controls should be displayed"
|
|
155
|
+
description: "Whether the YouTube video player controls should be displayed",
|
|
156
|
+
defaultValueHint: true
|
|
150
157
|
},
|
|
151
158
|
disablekb: {
|
|
152
159
|
type: "boolean",
|
|
153
160
|
displayName: "Disable Keyboard",
|
|
154
|
-
description: "Whether the keyboard controls should be disabled"
|
|
161
|
+
description: "Whether the keyboard controls should be disabled",
|
|
162
|
+
defaultValueHint: false
|
|
155
163
|
},
|
|
156
164
|
fs: {
|
|
157
165
|
type: "boolean",
|
|
158
166
|
displayName: "FullScreen Button",
|
|
159
|
-
description: "Whether the fullscreen button should be displayed"
|
|
167
|
+
description: "Whether the fullscreen button should be displayed",
|
|
168
|
+
defaultValueHint: true
|
|
160
169
|
},
|
|
161
170
|
loop: {
|
|
162
171
|
type: "boolean",
|
|
163
172
|
displayName: "Loop",
|
|
164
|
-
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
|
|
165
175
|
},
|
|
166
176
|
modestbranding: {
|
|
167
177
|
type: "boolean",
|
|
168
178
|
displayName: "Hide Logo",
|
|
169
|
-
description: "Hide the YouTube logo"
|
|
179
|
+
description: "Hide the YouTube logo in the control bar",
|
|
180
|
+
defaultValueHint: false
|
|
170
181
|
},
|
|
171
182
|
playsinline: {
|
|
172
183
|
type: "boolean",
|
|
173
184
|
displayName: "Play Inline",
|
|
174
|
-
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
|
|
175
187
|
},
|
|
176
188
|
rel: {
|
|
177
189
|
type: "boolean",
|
|
178
190
|
displayName: "Related Videos",
|
|
179
|
-
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
|
|
180
193
|
}
|
|
181
194
|
},
|
|
182
195
|
isDefaultExport: true,
|
|
@@ -186,7 +199,16 @@ registerComponent(YouTube, {
|
|
|
186
199
|
maxHeight: "100%",
|
|
187
200
|
maxWidth: "100%"
|
|
188
201
|
}
|
|
189
|
-
}
|
|
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
|
+
}
|
|
190
210
|
|
|
191
211
|
exports.default = YouTube;
|
|
212
|
+
exports.registerYouTube = registerYouTube;
|
|
213
|
+
exports.youtubeMeta = youtubeMeta;
|
|
192
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 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\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","finalProps","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,aAA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AAAA,EAAE,EAAE;AACFZ,MAAAA,IAAI,EAAE,SADJ;AAEFE,MAAAA,WAAW,EAAE,mBAFX;AAGFC,MAAAA,WAAW,EAAE;AAHX,KAjDC;AAsDLU,IAAAA,IAAI,EAAE;AACJb,MAAAA,IAAI,EAAE,SADF;AAEJE,MAAAA,WAAW,EAAE,MAFT;AAGJC,MAAAA,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.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,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,IAA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AUA,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(){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
|
|
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 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\
|
|
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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Aa,CACXf,KAAM,UACNJ,YAAa,cACbM,YACE,iEACFE,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"}
|
|
@@ -101,30 +101,35 @@ var YouTube = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
101
101
|
ref: ref
|
|
102
102
|
}, finalProps));
|
|
103
103
|
});
|
|
104
|
-
|
|
105
|
-
name: "
|
|
104
|
+
var youtubeMeta = {
|
|
105
|
+
name: "hostless-youtube",
|
|
106
|
+
displayName: "YouTube",
|
|
107
|
+
importName: "YouTube",
|
|
106
108
|
importPath: "@plasmicpkgs/react-youtube",
|
|
107
109
|
props: {
|
|
108
110
|
videoId: {
|
|
109
111
|
type: "string",
|
|
110
112
|
defaultValue: "R6MeLqRQzYw",
|
|
111
113
|
displayName: "Video ID",
|
|
112
|
-
description: "The ID for the YouTube video
|
|
114
|
+
description: "The ID for the YouTube video"
|
|
113
115
|
},
|
|
114
116
|
autoplay: {
|
|
115
117
|
type: "boolean",
|
|
116
118
|
displayName: "Auto Play",
|
|
117
|
-
description: "Whether the video
|
|
119
|
+
description: "Whether the video should automatically start playing when the player loads",
|
|
120
|
+
defaultValueHint: false
|
|
118
121
|
},
|
|
119
122
|
cc_load_policy: {
|
|
120
123
|
type: "boolean",
|
|
121
124
|
displayName: "Show Captions",
|
|
122
|
-
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
|
|
123
127
|
},
|
|
124
128
|
start: {
|
|
125
129
|
type: "number",
|
|
126
130
|
displayName: "Start",
|
|
127
|
-
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
|
|
128
133
|
},
|
|
129
134
|
end: {
|
|
130
135
|
type: "number",
|
|
@@ -135,42 +140,50 @@ registerComponent(YouTube, {
|
|
|
135
140
|
type: "choice",
|
|
136
141
|
displayName: "Color",
|
|
137
142
|
options: ["red", "white"],
|
|
138
|
-
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"
|
|
139
145
|
},
|
|
140
146
|
controls: {
|
|
141
147
|
type: "boolean",
|
|
142
148
|
displayName: "Show Controls",
|
|
143
|
-
description: "Whether the YouTube video player controls should be displayed"
|
|
149
|
+
description: "Whether the YouTube video player controls should be displayed",
|
|
150
|
+
defaultValueHint: true
|
|
144
151
|
},
|
|
145
152
|
disablekb: {
|
|
146
153
|
type: "boolean",
|
|
147
154
|
displayName: "Disable Keyboard",
|
|
148
|
-
description: "Whether the keyboard controls should be disabled"
|
|
155
|
+
description: "Whether the keyboard controls should be disabled",
|
|
156
|
+
defaultValueHint: false
|
|
149
157
|
},
|
|
150
158
|
fs: {
|
|
151
159
|
type: "boolean",
|
|
152
160
|
displayName: "FullScreen Button",
|
|
153
|
-
description: "Whether the fullscreen button should be displayed"
|
|
161
|
+
description: "Whether the fullscreen button should be displayed",
|
|
162
|
+
defaultValueHint: true
|
|
154
163
|
},
|
|
155
164
|
loop: {
|
|
156
165
|
type: "boolean",
|
|
157
166
|
displayName: "Loop",
|
|
158
|
-
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
|
|
159
169
|
},
|
|
160
170
|
modestbranding: {
|
|
161
171
|
type: "boolean",
|
|
162
172
|
displayName: "Hide Logo",
|
|
163
|
-
description: "Hide the YouTube logo"
|
|
173
|
+
description: "Hide the YouTube logo in the control bar",
|
|
174
|
+
defaultValueHint: false
|
|
164
175
|
},
|
|
165
176
|
playsinline: {
|
|
166
177
|
type: "boolean",
|
|
167
178
|
displayName: "Play Inline",
|
|
168
|
-
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
|
|
169
181
|
},
|
|
170
182
|
rel: {
|
|
171
183
|
type: "boolean",
|
|
172
184
|
displayName: "Related Videos",
|
|
173
|
-
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
|
|
174
187
|
}
|
|
175
188
|
},
|
|
176
189
|
isDefaultExport: true,
|
|
@@ -180,7 +193,15 @@ registerComponent(YouTube, {
|
|
|
180
193
|
maxHeight: "100%",
|
|
181
194
|
maxWidth: "100%"
|
|
182
195
|
}
|
|
183
|
-
}
|
|
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
|
+
}
|
|
184
204
|
|
|
185
205
|
export default YouTube;
|
|
206
|
+
export { registerYouTube, youtubeMeta };
|
|
186
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 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\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","finalProps","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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FzBc,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,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HhB,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.7",
|
|
4
4
|
"description": "Plasmic registration call for react-youtube",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"typescript": "^3.9.7"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@plasmicapp/host": "^0.0.32",
|
|
40
39
|
"react-youtube": "^7.13.0"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
42
|
+
"@plasmicapp/host": "^1.0.0",
|
|
43
43
|
"react": ">=16.8.0",
|
|
44
44
|
"react-dom": ">=16.8.0"
|
|
45
45
|
}
|