@plasmicpkgs/react-youtube 7.13.50 → 7.13.53

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 CHANGED
@@ -1,15 +1,20 @@
1
1
  import registerComponent, { ComponentMeta } from "@plasmicapp/host/registerComponent";
2
2
  import React from "react";
3
- import YouTubeImpl, { PlayerVars, YouTubeProps as YouTubeImplProps } from "react-youtube";
3
+ import YouTubeImpl, { YouTubeProps as YouTubeImplProps } from "react-youtube";
4
+ import type { Options } from "youtube-player/dist/types";
5
+ declare type PlayerVars = Exclude<Options["playerVars"], undefined>;
4
6
  export declare type YouTubeProps = YouTubeImplProps & {
5
7
  [prop in keyof PlayerVars]: PlayerVars[prop] | (prop extends typeof booleanParams[number] ? boolean : never);
8
+ } & {
9
+ mute?: boolean;
6
10
  };
7
11
  declare const booleanParams: readonly ["autoplay", "cc_load_policy", "controls", "disablekb", "fs", "loop", "modestbranding", "playsinline", "rel"];
8
12
  declare const YouTube: React.ForwardRefExoticComponent<YouTubeImplProps & {
9
13
  autoplay?: boolean | 0 | 1 | undefined;
14
+ cc_lang_pref?: string | undefined;
10
15
  cc_load_policy?: boolean | 1 | undefined;
11
16
  color?: "red" | "white" | undefined;
12
- controls?: boolean | 0 | 1 | 2 | undefined;
17
+ controls?: boolean | 0 | 1 | undefined;
13
18
  disablekb?: boolean | 0 | 1 | undefined;
14
19
  enablejsapi?: 0 | 1 | undefined;
15
20
  end?: number | undefined;
@@ -24,9 +29,10 @@ declare const YouTube: React.ForwardRefExoticComponent<YouTubeImplProps & {
24
29
  playlist?: string | undefined;
25
30
  playsinline?: boolean | 0 | 1 | undefined;
26
31
  rel?: boolean | 0 | 1 | undefined;
27
- showinfo?: 0 | 1 | undefined;
28
32
  start?: number | undefined;
29
- mute?: 0 | 1 | undefined;
33
+ widget_referrer?: string | undefined;
34
+ } & {
35
+ mute?: boolean | undefined;
30
36
  } & React.RefAttributes<YouTubeImpl>>;
31
37
  export declare const youtubeMeta: ComponentMeta<YouTubeProps>;
32
38
  export declare function registerYouTube(loader?: {
@@ -64,10 +64,36 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
64
64
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
65
65
  }
66
66
 
67
- var playerParams = ["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"];
67
+ var playerParams = ["autoplay", "cc_load_policy", "color", "controls", "disablekb", "enablejsapi", "end", "fs", "hl", "iv_load_policy", "list", "listType", "loop", "modestbranding", "origin", "playlist", "playsinline", "rel", "start"];
68
68
  var booleanParams = ["autoplay", "cc_load_policy", "controls", "disablekb", "fs", "loop", "modestbranding", "playsinline", "rel"];
69
69
  var booleanParamsSet = /*#__PURE__*/new Set(booleanParams);
70
70
  var YouTube = /*#__PURE__*/React.forwardRef(function (props, ref) {
71
+ var internalRef = React.useRef(null);
72
+ var onRef = React.useCallback(function (player) {
73
+ internalRef.current = player;
74
+
75
+ if (ref) {
76
+ if (typeof ref === "function") {
77
+ ref(player);
78
+ } else {
79
+ ref.current = player;
80
+ }
81
+ }
82
+ }, [ref]);
83
+ React.useEffect(function () {
84
+ if (props.mute !== undefined) {
85
+ if (props.mute) {
86
+ var _internalRef$current, _internalRef$current$;
87
+
88
+ (_internalRef$current = internalRef.current) == null ? void 0 : (_internalRef$current$ = _internalRef$current.getInternalPlayer()) == null ? void 0 : _internalRef$current$.mute();
89
+ } else {
90
+ var _internalRef$current2, _internalRef$current3;
91
+
92
+ (_internalRef$current2 = internalRef.current) == null ? void 0 : (_internalRef$current3 = _internalRef$current2.getInternalPlayer()) == null ? void 0 : _internalRef$current3.unMute();
93
+ }
94
+ }
95
+ }, [props.mute, internalRef]);
96
+
71
97
  var finalProps = _extends({}, props);
72
98
 
73
99
  for (var _iterator = _createForOfIteratorHelperLoose(playerParams), _step; !(_step = _iterator()).done;) {
@@ -104,8 +130,10 @@ var YouTube = /*#__PURE__*/React.forwardRef(function (props, ref) {
104
130
  }
105
131
 
106
132
  return React.createElement(YouTubeImpl, Object.assign({
107
- ref: ref
108
- }, finalProps));
133
+ ref: onRef
134
+ }, finalProps, {
135
+ iframeClassName: props.className
136
+ }));
109
137
  });
110
138
  var youtubeMeta = {
111
139
  name: "hostless-youtube",
@@ -123,7 +151,10 @@ var youtubeMeta = {
123
151
  type: "boolean",
124
152
  displayName: "Auto Play",
125
153
  description: "Whether the video should automatically start playing when the player loads",
126
- defaultValueHint: false
154
+ defaultValueHint: false,
155
+ hidden: function hidden(props) {
156
+ return !props.mute;
157
+ }
127
158
  },
128
159
  cc_load_policy: {
129
160
  type: "boolean",
@@ -1 +1 @@
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 mute: {\n type: \"boolean\",\n displayName: \"Mute\",\n description: \"Whether the video should be muted\",\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","mute","playsinline","rel","isDefaultExport","defaultStyles","height","width","maxHeight","maxWidth","registerYouTube","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x"],"sourcesContent":["import registerComponent, {\n ComponentMeta,\n} from \"@plasmicapp/host/registerComponent\";\nimport React from \"react\";\nimport YouTubeImpl, { YouTubeProps as YouTubeImplProps } from \"react-youtube\";\nimport type { Options } from \"youtube-player/dist/types\";\n\ntype PlayerVars = Exclude<Options[\"playerVars\"], undefined>;\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n } & { mute?: boolean };\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 \"start\",\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 internalRef = React.useRef<YouTubeImpl | null>(null);\n\n const onRef = React.useCallback(\n (player: YouTubeImpl | null) => {\n internalRef.current = player;\n if (ref) {\n if (typeof ref === \"function\") {\n ref(player);\n } else {\n ref.current = player;\n }\n }\n },\n [ref]\n );\n\n React.useEffect(() => {\n if (props.mute !== undefined) {\n if (props.mute) {\n internalRef.current?.getInternalPlayer()?.mute();\n } else {\n internalRef.current?.getInternalPlayer()?.unMute();\n }\n }\n }, [props.mute, internalRef]);\n\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 (\n <YouTubeImpl\n ref={onRef}\n {...finalProps}\n iframeClassName={props.className}\n />\n );\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 hidden: (props) => !props.mute,\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 mute: {\n type: \"boolean\",\n displayName: \"Mute\",\n description: \"Whether the video should be muted\",\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","internalRef","useRef","onRef","useCallback","player","current","useEffect","mute","undefined","getInternalPlayer","unMute","finalProps","prop","value","opts","playerVars","has","YouTubeImpl","iframeClassName","className","youtubeMeta","name","displayName","importName","importPath","videoId","type","defaultValue","description","autoplay","defaultValueHint","hidden","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAc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AAA,WAAW,EACT,gEAJS;AAKXE,MAAAA,gBAAgB,EAAE;AALP,KAhFR;AAuFLa,IAAAA,GAAG,EAAE;AACHjB,MAAAA,IAAI,EAAE,SADH;AAEHJ,MAAAA,WAAW,EAAE,gBAFV;AAGHM,MAAAA,WAAW,EACT,mHAJC;AAKHE,MAAAA,gBAAgB,EAAE;AALf;AAvFA,GAL+C;AAoGtDc,EAAAA,eAAe,EAAE,IApGqC;AAqGtDC,EAAAA,aAAa,EAAE;AACbC,IAAAA,MAAM,EAAE,OADK;AAEbC,IAAAA,KAAK,EAAE,OAFM;AAGbC,IAAAA,SAAS,EAAE,MAHE;AAIbC,IAAAA,QAAQ,EAAE;AAJG;AArGuC;SA6GxCC,gBACdC,QACAC;AAEA,MAAID,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CAAyB1D,OAAzB,EAAkCyD,iBAAlC,WAAkCA,iBAAlC,GAAuDhC,WAAvD;AACD,GAFD,MAEO;AACLiC,IAAAA,iBAAiB,CAAC1D,OAAD,EAAUyD,iBAAV,WAAUA,iBAAV,GAA+BhC,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 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},mute:{type:"boolean",displayName:"Mute",description:"Whether the video should be muted",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;
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 l(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 n=["autoplay","cc_load_policy","color","controls","disablekb","enablejsapi","end","fs","hl","iv_load_policy","list","listType","loop","modestbranding","origin","playlist","playsinline","rel","start"],i=new Set(["autoplay","cc_load_policy","controls","disablekb","fs","loop","modestbranding","playsinline","rel"]),s=o.forwardRef((function(e,t){var s=o.useRef(null),d=o.useCallback((function(e){s.current=e,t&&("function"==typeof t?t(e):t.current=e)}),[t]);o.useEffect((function(){var t,o,a,r;void 0!==e.mute&&(e.mute?null==(t=s.current)||null==(o=t.getInternalPlayer())||o.mute():null==(a=s.current)||null==(r=a.getInternalPlayer())||r.unMute())}),[e.mute,s]);for(var u,p=r({},e),h=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 l(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)?l(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.")}(n);!(u=h()).done;){var c=u.value;if(c in p){var y=p[c];delete p[c],p.opts||(p.opts={}),p.opts.playerVars||(p.opts.playerVars={}),i.has(c)?"cc_load_policy"===c||"modestbranding"===c?y?p.opts.playerVars[c]=1:delete p.opts.playerVars[c]:p.opts.playerVars[c]=y?1:0:p.opts.playerVars[c]=y}}return o.createElement(a,Object.assign({ref:d},p,{iframeClassName:e.className}))})),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,hidden:function(e){return!e.mute}},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},mute:{type:"boolean",displayName:"Mute",description:"Whether the video should be muted",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, {\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 mute: {\n type: \"boolean\",\n displayName: \"Mute\",\n description: \"Whether the video should be muted\",\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","mute","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,EAAWC,UAClBD,EAAWC,GACbD,EAAWG,OACdH,EAAWG,KAAO,IAEfH,EAAWG,KAAKC,aACnBJ,EAAWG,KAAKC,WAAa,IAE3BX,EAAiBY,IAAIJ,GACV,mBAATA,GAAsC,mBAATA,EAE3BC,EACFF,EAAWG,KAAKC,WAAWH,GAAQ,SAE5BD,EAAWG,KAAKC,WAAWH,GAIpCD,EAAWG,KAAKC,WAAWH,GAASC,EAAQ,EAAI,EAGlDF,EAAWG,KAAKC,WAAWH,GAAQC,UAIlCN,gBAACU,iBAAYP,IAAKA,GAASC,OAIzBO,EAA2C,CACtDC,KAAM,mBACNC,YAAa,UACbC,WAAY,UACZC,WAAY,6BACZb,MAAO,CACLc,QAAS,CACPC,KAAM,SACNC,aAAc,cACdL,YAAa,WACbM,YAAa,gCAEfC,SAAU,CACRH,KAAM,UACNJ,YAAa,YACbM,YACE,6EACFE,kBAAkB,GAEpBC,eAAgB,CACdL,KAAM,UACNJ,YAAa,gBACbM,YACE,4FACFE,kBAAkB,GAEpBE,MAAO,CACLN,KAAM,SACNJ,YAAa,QACbM,YACE,+EACFE,iBAAkB,GAEpBG,IAAK,CACHP,KAAM,SACNJ,YAAa,MACbM,YACE,8FAEJM,MAAO,CACLR,KAAM,SACNJ,YAAa,QACba,QAAS,CAAC,MAAO,SACjBP,YACE,mGACFE,iBAAkB,OAEpBM,SAAU,CACRV,KAAM,UACNJ,YAAa,gBACbM,YACE,gEACFE,kBAAkB,GAEpBO,UAAW,CACTX,KAAM,UACNJ,YAAa,mBACbM,YAAa,mDACbE,kBAAkB,GAEpBQ,GAAI,CACFZ,KAAM,UACNJ,YAAa,oBACbM,YAAa,oDACbE,kBAAkB,GAEpBS,KAAM,CACJb,KAAM,UACNJ,YAAa,OACbM,YAAa,6DACbE,kBAAkB,GAEpBU,eAAgB,CACdd,KAAM,UACNJ,YAAa,YACbM,YAAa,2CACbE,kBAAkB,GAEpBW,KAAM,CACJf,KAAM,UACNJ,YAAa,OACbM,YAAa,oCACbE,kBAAkB,GAEpBY,YAAa,CACXhB,KAAM,UACNJ,YAAa,cACbM,YACE,iEACFE,kBAAkB,GAEpBa,IAAK,CACHjB,KAAM,UACNJ,YAAa,iBACbM,YACE,oHACFE,kBAAkB,IAGtBc,iBAAiB,EACjBC,cAAe,CACbC,OAAQ,QACRC,MAAO,QACPC,UAAW,OACXC,SAAU,4DAKZC,EACAC,GAEID,EACFA,EAAOE,kBAAkB5C,QAAS2C,EAAAA,EAAqB/B,GAEvDgC,EAAkB5C,QAAS2C,EAAAA,EAAqB/B"}
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, { YouTubeProps as YouTubeImplProps } from \"react-youtube\";\nimport type { Options } from \"youtube-player/dist/types\";\n\ntype PlayerVars = Exclude<Options[\"playerVars\"], undefined>;\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n } & { mute?: boolean };\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 \"start\",\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 internalRef = React.useRef<YouTubeImpl | null>(null);\n\n const onRef = React.useCallback(\n (player: YouTubeImpl | null) => {\n internalRef.current = player;\n if (ref) {\n if (typeof ref === \"function\") {\n ref(player);\n } else {\n ref.current = player;\n }\n }\n },\n [ref]\n );\n\n React.useEffect(() => {\n if (props.mute !== undefined) {\n if (props.mute) {\n internalRef.current?.getInternalPlayer()?.mute();\n } else {\n internalRef.current?.getInternalPlayer()?.unMute();\n }\n }\n }, [props.mute, internalRef]);\n\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 (\n <YouTubeImpl\n ref={onRef}\n {...finalProps}\n iframeClassName={props.className}\n />\n );\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 hidden: (props) => !props.mute,\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 mute: {\n type: \"boolean\",\n displayName: \"Mute\",\n description: \"Whether the video should be muted\",\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","internalRef","useRef","onRef","useCallback","player","current","useEffect","undefined","mute","getInternalPlayer","unMute","finalProps","prop","value","opts","playerVars","has","YouTubeImpl","iframeClassName","className","youtubeMeta","name","displayName","importName","importPath","videoId","type","defaultValue","description","autoplay","defaultValueHint","hidden","cc_load_policy","start","end","color","options","controls","disablekb","fs","loop","modestbranding","playsinline","rel","isDefaultExport","defaultStyles","height","width","maxHeight","maxWidth","loader","customYouTubeMeta","registerComponent"],"mappings":"8iBAcA,IAAMA,EAAe,CACnB,WACA,iBACA,QACA,WACA,YACA,cACA,MACA,KACA,KACA,iBACA,OACA,WACA,OACA,iBACA,SACA,WACA,cACA,MACA,SAeIC,EAAmB,IAAIC,IAZP,CACpB,WACA,iBACA,WACA,YACA,KACA,OACA,iBACA,cACA,QAKIC,EAAUC,EAAMC,YACpB,SAACC,EAAqBC,OACdC,EAAcJ,EAAMK,OAA2B,MAE/CC,EAAQN,EAAMO,aAClB,SAACC,GACCJ,EAAYK,QAAUD,EAClBL,IACiB,mBAARA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EACFE,kBAAkB,GAEpBQ,UAAW,CACTZ,KAAM,UACNJ,YAAa,mBACbM,YAAa,mDACbE,kBAAkB,GAEpBS,GAAI,CACFb,KAAM,UACNJ,YAAa,oBACbM,YAAa,oDACbE,kBAAkB,GAEpBU,KAAM,CACJd,KAAM,UACNJ,YAAa,OACbM,YAAa,6DACbE,kBAAkB,GAEpBW,eAAgB,CACdf,KAAM,UACNJ,YAAa,YACbM,YAAa,2CACbE,kBAAkB,GAEpBtB,KAAM,CACJkB,KAAM,UACNJ,YAAa,OACbM,YAAa,oCACbE,kBAAkB,GAEpBY,YAAa,CACXhB,KAAM,UACNJ,YAAa,cACbM,YACE,iEACFE,kBAAkB,GAEpBa,IAAK,CACHjB,KAAM,UACNJ,YAAa,iBACbM,YACE,oHACFE,kBAAkB,IAGtBc,iBAAiB,EACjBC,cAAe,CACbC,OAAQ,QACRC,MAAO,QACPC,UAAW,OACXC,SAAU,4DAKZC,EACAC,GAEID,EACFA,EAAOE,kBAAkBzD,QAASwD,EAAAA,EAAqB/B,GAEvDgC,EAAkBzD,QAASwD,EAAAA,EAAqB/B"}
@@ -58,10 +58,36 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
58
58
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
59
59
  }
60
60
 
61
- var playerParams = ["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"];
61
+ var playerParams = ["autoplay", "cc_load_policy", "color", "controls", "disablekb", "enablejsapi", "end", "fs", "hl", "iv_load_policy", "list", "listType", "loop", "modestbranding", "origin", "playlist", "playsinline", "rel", "start"];
62
62
  var booleanParams = ["autoplay", "cc_load_policy", "controls", "disablekb", "fs", "loop", "modestbranding", "playsinline", "rel"];
63
63
  var booleanParamsSet = /*#__PURE__*/new Set(booleanParams);
64
64
  var YouTube = /*#__PURE__*/React.forwardRef(function (props, ref) {
65
+ var internalRef = React.useRef(null);
66
+ var onRef = React.useCallback(function (player) {
67
+ internalRef.current = player;
68
+
69
+ if (ref) {
70
+ if (typeof ref === "function") {
71
+ ref(player);
72
+ } else {
73
+ ref.current = player;
74
+ }
75
+ }
76
+ }, [ref]);
77
+ React.useEffect(function () {
78
+ if (props.mute !== undefined) {
79
+ if (props.mute) {
80
+ var _internalRef$current, _internalRef$current$;
81
+
82
+ (_internalRef$current = internalRef.current) == null ? void 0 : (_internalRef$current$ = _internalRef$current.getInternalPlayer()) == null ? void 0 : _internalRef$current$.mute();
83
+ } else {
84
+ var _internalRef$current2, _internalRef$current3;
85
+
86
+ (_internalRef$current2 = internalRef.current) == null ? void 0 : (_internalRef$current3 = _internalRef$current2.getInternalPlayer()) == null ? void 0 : _internalRef$current3.unMute();
87
+ }
88
+ }
89
+ }, [props.mute, internalRef]);
90
+
65
91
  var finalProps = _extends({}, props);
66
92
 
67
93
  for (var _iterator = _createForOfIteratorHelperLoose(playerParams), _step; !(_step = _iterator()).done;) {
@@ -98,8 +124,10 @@ var YouTube = /*#__PURE__*/React.forwardRef(function (props, ref) {
98
124
  }
99
125
 
100
126
  return React.createElement(YouTubeImpl, Object.assign({
101
- ref: ref
102
- }, finalProps));
127
+ ref: onRef
128
+ }, finalProps, {
129
+ iframeClassName: props.className
130
+ }));
103
131
  });
104
132
  var youtubeMeta = {
105
133
  name: "hostless-youtube",
@@ -117,7 +145,10 @@ var youtubeMeta = {
117
145
  type: "boolean",
118
146
  displayName: "Auto Play",
119
147
  description: "Whether the video should automatically start playing when the player loads",
120
- defaultValueHint: false
148
+ defaultValueHint: false,
149
+ hidden: function hidden(props) {
150
+ return !props.mute;
151
+ }
121
152
  },
122
153
  cc_load_policy: {
123
154
  type: "boolean",
@@ -1 +1 @@
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 mute: {\n type: \"boolean\",\n displayName: \"Mute\",\n description: \"Whether the video should be muted\",\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","mute","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,gBAA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V;AAGHM,MAAAA,WAAW,EACT,mHAJC;AAKHE,MAAAA,gBAAgB,EAAE;AALf;AAtFA,GAL+C;AAmGtDc,EAAAA,eAAe,EAAE,IAnGqC;AAoGtDC,EAAAA,aAAa,EAAE;AACbC,IAAAA,MAAM,EAAE,OADK;AAEbC,IAAAA,KAAK,EAAE,OAFM;AAGbC,IAAAA,SAAS,EAAE,MAHE;AAIbC,IAAAA,QAAQ,EAAE;AAJG;AApGuC;SA4GxCC,gBACdC,QACAC;AAEA,MAAID,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACE,iBAAP,CAAyB7C,OAAzB,EAAkC4C,iBAAlC,WAAkCA,iBAAlC,GAAuDhC,WAAvD;AACD,GAFD,MAEO;AACLiC,IAAAA,iBAAiB,CAAC7C,OAAD,EAAU4C,iBAAV,WAAUA,iBAAV,GAA+BhC,WAA/B,CAAjB;AACD;AACF;;;;;"}
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, { YouTubeProps as YouTubeImplProps } from \"react-youtube\";\nimport type { Options } from \"youtube-player/dist/types\";\n\ntype PlayerVars = Exclude<Options[\"playerVars\"], undefined>;\nexport type YouTubeProps = YouTubeImplProps &\n {\n [prop in keyof PlayerVars]:\n | PlayerVars[prop]\n | (prop extends typeof booleanParams[number] ? boolean : never);\n } & { mute?: boolean };\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 \"start\",\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 internalRef = React.useRef<YouTubeImpl | null>(null);\n\n const onRef = React.useCallback(\n (player: YouTubeImpl | null) => {\n internalRef.current = player;\n if (ref) {\n if (typeof ref === \"function\") {\n ref(player);\n } else {\n ref.current = player;\n }\n }\n },\n [ref]\n );\n\n React.useEffect(() => {\n if (props.mute !== undefined) {\n if (props.mute) {\n internalRef.current?.getInternalPlayer()?.mute();\n } else {\n internalRef.current?.getInternalPlayer()?.unMute();\n }\n }\n }, [props.mute, internalRef]);\n\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 (\n <YouTubeImpl\n ref={onRef}\n {...finalProps}\n iframeClassName={props.className}\n />\n );\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 hidden: (props) => !props.mute,\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 mute: {\n type: \"boolean\",\n displayName: \"Mute\",\n description: \"Whether the video should be muted\",\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","internalRef","useRef","onRef","useCallback","player","current","useEffect","mute","undefined","getInternalPlayer","unMute","finalProps","prop","value","opts","playerVars","has","YouTubeImpl","iframeClassName","className","youtubeMeta","name","displayName","importName","importPath","videoId","type","defaultValue","description","autoplay","defaultValueHint","hidden","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,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,OAnBmB,CAArB;AAsBA,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,WAAW,GAAGJ,KAA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,OAAD,EAAUyD,iBAAV,WAAUA,iBAAV,GAA+BhC,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.50",
3
+ "version": "7.13.53",
4
4
  "description": "Plasmic registration call for react-youtube",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,21 +28,22 @@
28
28
  "analyze": "size-limit --why"
29
29
  },
30
30
  "devDependencies": {
31
- "@plasmicapp/host": "1.0.49",
31
+ "@plasmicapp/host": "1.0.50",
32
32
  "@size-limit/preset-small-lib": "^4.11.0",
33
33
  "@types/node": "^14.0.26",
34
+ "@types/youtube-player": "^5.5.6",
34
35
  "size-limit": "^4.11.0",
35
36
  "tsdx": "^0.14.1",
36
37
  "tslib": "^2.2.0",
37
38
  "typescript": "^3.9.7"
38
39
  },
39
40
  "dependencies": {
40
- "react-youtube": "^7.13.0"
41
+ "react-youtube": "9.0.2"
41
42
  },
42
43
  "peerDependencies": {
43
44
  "@plasmicapp/host": "^1.0.0",
44
45
  "react": ">=16.8.0",
45
46
  "react-dom": ">=16.8.0"
46
47
  },
47
- "gitHead": "231f0fd5077a4b0eaa261128f8d7237ccd4fe826"
48
+ "gitHead": "abeca34e3880ca524d37315ed0d3aad56e00fd8e"
48
49
  }