@react-scrollytelling/video 0.2.1 → 0.3.1

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.
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
3
+
4
+ //#region src/components/Video.d.ts
5
+ interface VideoProps {
6
+ /** Source of the mp4 video */
7
+ src: string;
8
+ /** Source of the webm video */
9
+ srcWebm?: string;
10
+ /**
11
+ * Thumbnail URL of the video.
12
+ * If not specified, it will use the first frame of the video as the thumbnail.
13
+ */
14
+ thumbnail?: string;
15
+ className?: string;
16
+ width: number;
17
+ height: number;
18
+ ratio?: number;
19
+ /** Overlay content to show when the video is loading */
20
+ loadingOverlay?: React.ReactNode;
21
+ }
22
+ declare const Video: ({
23
+ src,
24
+ srcWebm,
25
+ width,
26
+ height,
27
+ thumbnail,
28
+ ratio,
29
+ className,
30
+ loadingOverlay
31
+ }: VideoProps) => react_jsx_runtime0.JSX.Element;
32
+ interface VideoRef {
33
+ setRatio: (ratio: number) => void;
34
+ }
35
+ declare const VideoWithImperativeHandle: React.NamedExoticComponent<VideoProps & React.RefAttributes<VideoRef>>;
36
+ //#endregion
37
+ export { Video, VideoProps, VideoRef, VideoWithImperativeHandle };
38
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/components/Video.tsx"],"mappings":";;;;UAUiB,UAAA;;EAEf,GAAA;EAFe;EAKf,OAAA;;;;;EAMA,SAAA;EAEA,SAAA;EACA,KAAA;EACA,MAAA;EACA,KAAA;EAGA;EAAA,cAAA,GAAiB,KAAA,CAAM,SAAA;AAAA;AAAA,cAGZ,KAAA;EAAK,GAAA;EAAA,OAAA;EAAA,KAAA;EAAA,MAAA;EAAA,SAAA;EAAA,KAAA;EAAA,SAAA;EAAA;AAAA,GASf,UAAA,KAAU,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,UAyBI,QAAA;EACf,QAAA,GAAW,KAAA;AAAA;AAAA,cAGA,yBAAA,EAAyB,KAAA,CAAA,oBAAA,CAAA,UAAA,GAAA,KAAA,CAAA,aAAA,CAAA,QAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,186 @@
1
+ import { c } from "react/compiler-runtime";
2
+ import React, { useEffect, useImperativeHandle, useRef, useState } from "react";
3
+ import { useRafThrottle } from "@react-scrollytelling/core";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+
6
+ //#region src/components/Video.tsx
7
+ const Video = (t0) => {
8
+ const $ = c(11);
9
+ const { src, srcWebm, width, height, thumbnail, ratio: t1, className, loadingOverlay } = t0;
10
+ const ratio = t1 === void 0 ? 0 : t1;
11
+ const videoRef = useRef(null);
12
+ let t2;
13
+ let t3;
14
+ if ($[0] !== ratio) {
15
+ t2 = () => {
16
+ if (!videoRef.current) return;
17
+ videoRef.current.setRatio(ratio);
18
+ };
19
+ t3 = [ratio];
20
+ $[0] = ratio;
21
+ $[1] = t2;
22
+ $[2] = t3;
23
+ } else {
24
+ t2 = $[1];
25
+ t3 = $[2];
26
+ }
27
+ useEffect(t2, t3);
28
+ let t4;
29
+ if ($[3] !== className || $[4] !== height || $[5] !== loadingOverlay || $[6] !== src || $[7] !== srcWebm || $[8] !== thumbnail || $[9] !== width) {
30
+ t4 = /* @__PURE__ */ jsx(VideoWithImperativeHandle, {
31
+ ref: videoRef,
32
+ width,
33
+ height,
34
+ src,
35
+ srcWebm,
36
+ className,
37
+ thumbnail,
38
+ loadingOverlay
39
+ });
40
+ $[3] = className;
41
+ $[4] = height;
42
+ $[5] = loadingOverlay;
43
+ $[6] = src;
44
+ $[7] = srcWebm;
45
+ $[8] = thumbnail;
46
+ $[9] = width;
47
+ $[10] = t4;
48
+ } else t4 = $[10];
49
+ return t4;
50
+ };
51
+ const VideoWithImperativeHandle = /* @__PURE__ */ React.memo(/* @__PURE__ */ React.forwardRef((t0, ref) => {
52
+ const $ = c(25);
53
+ const { src, srcWebm, width, height, thumbnail, className, loadingOverlay } = t0;
54
+ const videoRef = useRef(null);
55
+ const [isLoading, setIsLoading] = useState(true);
56
+ let t1;
57
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
58
+ t1 = (ratio) => {
59
+ const videoElement = videoRef.current;
60
+ if (!videoElement) return;
61
+ const duration = videoElement.duration;
62
+ if (!isNaN(duration)) requestAnimationFrame(() => {
63
+ videoElement.currentTime = Math.round(ratio * duration * 100) / 100;
64
+ });
65
+ };
66
+ $[0] = t1;
67
+ } else t1 = $[0];
68
+ const setVideoRatioThrottled = useRafThrottle(t1);
69
+ let t2;
70
+ let t3;
71
+ if ($[1] !== setVideoRatioThrottled) {
72
+ t2 = () => ({ setRatio: setVideoRatioThrottled });
73
+ t3 = [setVideoRatioThrottled];
74
+ $[1] = setVideoRatioThrottled;
75
+ $[2] = t2;
76
+ $[3] = t3;
77
+ } else {
78
+ t2 = $[2];
79
+ t3 = $[3];
80
+ }
81
+ useImperativeHandle(ref, t2, t3);
82
+ let t4;
83
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
84
+ t4 = () => {
85
+ setIsLoading(true);
86
+ };
87
+ $[4] = t4;
88
+ } else t4 = $[4];
89
+ const handleWaiting = t4;
90
+ let t5;
91
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
92
+ t5 = () => {
93
+ setIsLoading(false);
94
+ };
95
+ $[5] = t5;
96
+ } else t5 = $[5];
97
+ const handleCanPlay = t5;
98
+ let t6;
99
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
100
+ t6 = {
101
+ position: "relative",
102
+ width: "100%",
103
+ height: "100%"
104
+ };
105
+ $[6] = t6;
106
+ } else t6 = $[6];
107
+ let t7;
108
+ if ($[7] !== srcWebm || $[8] !== thumbnail) {
109
+ t7 = srcWebm && /* @__PURE__ */ jsx("source", {
110
+ src: thumbnail ? srcWebm : `${srcWebm}#t=0.1`,
111
+ type: "video/webm"
112
+ });
113
+ $[7] = srcWebm;
114
+ $[8] = thumbnail;
115
+ $[9] = t7;
116
+ } else t7 = $[9];
117
+ const t8 = thumbnail ? src : `${src}#t=0.1`;
118
+ let t9;
119
+ if ($[10] !== t8) {
120
+ t9 = /* @__PURE__ */ jsx("source", {
121
+ src: t8,
122
+ type: "video/mp4"
123
+ });
124
+ $[10] = t8;
125
+ $[11] = t9;
126
+ } else t9 = $[11];
127
+ let t10;
128
+ if ($[12] !== className || $[13] !== height || $[14] !== t7 || $[15] !== t9 || $[16] !== thumbnail || $[17] !== width) {
129
+ t10 = /* @__PURE__ */ jsxs("video", {
130
+ ref: videoRef,
131
+ width,
132
+ height,
133
+ className,
134
+ muted: true,
135
+ disablePictureInPicture: true,
136
+ disableRemotePlayback: true,
137
+ playsInline: true,
138
+ controls: false,
139
+ preload: "auto",
140
+ onWaiting: handleWaiting,
141
+ onCanPlay: handleCanPlay,
142
+ poster: thumbnail,
143
+ children: [t7, t9]
144
+ });
145
+ $[12] = className;
146
+ $[13] = height;
147
+ $[14] = t7;
148
+ $[15] = t9;
149
+ $[16] = thumbnail;
150
+ $[17] = width;
151
+ $[18] = t10;
152
+ } else t10 = $[18];
153
+ let t11;
154
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
155
+ t11 = {
156
+ position: "absolute",
157
+ inset: 0
158
+ };
159
+ $[19] = t11;
160
+ } else t11 = $[19];
161
+ const t12 = isLoading && loadingOverlay;
162
+ let t13;
163
+ if ($[20] !== t12) {
164
+ t13 = /* @__PURE__ */ jsx("div", {
165
+ style: t11,
166
+ children: t12
167
+ });
168
+ $[20] = t12;
169
+ $[21] = t13;
170
+ } else t13 = $[21];
171
+ let t14;
172
+ if ($[22] !== t10 || $[23] !== t13) {
173
+ t14 = /* @__PURE__ */ jsxs("div", {
174
+ style: t6,
175
+ children: [t10, t13]
176
+ });
177
+ $[22] = t10;
178
+ $[23] = t13;
179
+ $[24] = t14;
180
+ } else t14 = $[24];
181
+ return t14;
182
+ }));
183
+
184
+ //#endregion
185
+ export { Video, VideoWithImperativeHandle };
186
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["React","useEffect","useImperativeHandle","useCallback","useRef","useState","useRafThrottle","jsx","_jsx","jsxs","_jsxs","Video","t0","$","_c","src","srcWebm","width","height","thumbnail","ratio","t1","className","loadingOverlay","undefined","videoRef","t2","t3","current","setRatio","t4","VideoWithImperativeHandle","memo","forwardRef","ref","isLoading","setIsLoading","Symbol","for","videoElement","duration","isNaN","requestAnimationFrame","currentTime","Math","round","setVideoRatio","setVideoRatioThrottled","handleWaiting","t5","handleCanPlay","t6","position","t7","type","t8","t9","t10","muted","disablePictureInPicture","disableRemotePlayback","playsInline","controls","preload","children","t11","inset","t12","t13","style","t14"],"sources":["../src/components/Video.tsx"],"sourcesContent":["import React, {\n useEffect,\n useImperativeHandle,\n useCallback,\n useRef,\n useState,\n} from \"react\";\n\nimport { useRafThrottle } from \"@react-scrollytelling/core\";\n\nexport interface VideoProps {\n /** Source of the mp4 video */\n src: string;\n\n /** Source of the webm video */\n srcWebm?: string;\n\n /**\n * Thumbnail URL of the video.\n * If not specified, it will use the first frame of the video as the thumbnail.\n */\n thumbnail?: string;\n\n className?: string;\n width: number;\n height: number;\n ratio?: number;\n\n /** Overlay content to show when the video is loading */\n loadingOverlay?: React.ReactNode;\n}\n\nexport const Video = ({\n src,\n srcWebm,\n width,\n height,\n thumbnail,\n ratio = 0,\n className,\n loadingOverlay,\n}: VideoProps) => {\n const videoRef = useRef<VideoRef>(null);\n\n useEffect(() => {\n // update currentTime when the ratio prop changes\n if (!videoRef.current) {\n return;\n }\n videoRef.current.setRatio(ratio);\n }, [ratio]);\n\n return (\n <VideoWithImperativeHandle\n ref={videoRef}\n width={width}\n height={height}\n src={src}\n srcWebm={srcWebm}\n className={className}\n thumbnail={thumbnail}\n loadingOverlay={loadingOverlay}\n ></VideoWithImperativeHandle>\n );\n};\n\nexport interface VideoRef {\n setRatio: (ratio: number) => void;\n}\n\nexport const VideoWithImperativeHandle = React.memo(\n React.forwardRef<VideoRef, VideoProps>(\n (\n { src, srcWebm, width, height, thumbnail, className, loadingOverlay },\n ref\n ) => {\n const videoRef = useRef<HTMLVideoElement>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n const setVideoRatio = useCallback((ratio: number) => {\n const videoElement = videoRef.current;\n if (!videoElement) {\n return;\n }\n\n const duration = videoElement.duration;\n if (!isNaN(duration)) {\n requestAnimationFrame(() => {\n videoElement.currentTime = Math.round(ratio * duration * 100) / 100;\n });\n }\n }, []);\n const setVideoRatioThrottled = useRafThrottle(setVideoRatio);\n\n useImperativeHandle(ref, () => {\n return {\n setRatio: setVideoRatioThrottled,\n };\n }, [setVideoRatioThrottled]);\n\n const handleWaiting = useCallback(() => {\n setIsLoading(true);\n }, []);\n\n const handleCanPlay = useCallback(() => {\n setIsLoading(false);\n }, []);\n\n return (\n <div style={{ position: \"relative\", width: \"100%\", height: \"100%\" }}>\n <video\n ref={videoRef}\n width={width}\n height={height}\n className={className}\n muted\n disablePictureInPicture\n disableRemotePlayback\n playsInline\n controls={false}\n // preload the video\n preload=\"auto\"\n onWaiting={handleWaiting}\n onCanPlay={handleCanPlay}\n poster={thumbnail}\n >\n {srcWebm && (\n <source\n src={thumbnail ? srcWebm : `${srcWebm}#t=0.1`}\n type=\"video/webm\"\n />\n )}\n <source src={thumbnail ? src : `${src}#t=0.1`} type=\"video/mp4\" />\n </video>\n <div style={{ position: \"absolute\", inset: 0 }}>\n {isLoading && loadingOverlay}\n </div>\n </div>\n );\n }\n )\n);\n"],"mappings":";;;;;;AAgCA,MAAaW,SAAQC,OAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAC,MAAA,EAAAC,KAAAC,SAAAC,OAAAC,QAAAC,WAAAC,OAAAC,IAAAC,WAAAC,mBAAAX;CAMpB,MAAAQ,QAAAC,OAAAG,SAAA,IAAAH;CAIA,MAAAI,WAAiBrB,OAAiB,KAAK;CAAC,IAAA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C,OAAA5C,EAAA,QAAAuD,KAAA;AA3BRE,QAAA5D,qBAAA,OAAA;GAAY2D,OAAAlB;GAAuDa,UAAA,CACjEP,KAwBAW,IAEM;GACH,CAAC;AAAAvD,IAAA,MAAA4C;AAAA5C,IAAA,MAAAuD;AAAAvD,IAAA,MAAAyD;OAAAA,OAAAzD,EAAA;AAAA,QA5BNyD;EAgCR,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-scrollytelling/video",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "> TODO: description",
5
5
  "author": "@hsunpei",
6
6
  "license": "MIT",
@@ -8,24 +8,27 @@
8
8
  "access": "public"
9
9
  },
10
10
  "homepage": "https://github.com/hsunpei/react-scrollytelling#readme",
11
- "main": "dist/index.cjs.js",
12
- "module": "dist/index.es.js",
13
- "types": "./dist/src/index.d.ts",
11
+ "type": "module",
12
+ "main": "dist/index.mjs",
13
+ "types": "dist/index.d.mts",
14
14
  "sideEffects": false,
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.mts",
21
+ "import": "./dist/index.mjs"
22
+ }
23
+ },
18
24
  "repository": {
19
25
  "type": "git",
20
- "url": "git+https://github.com/hsunpei/react-scrollytelling.git"
26
+ "url": "git+https://github.com/hsunpei/react-scrollytelling.git",
27
+ "directory": "packages/video"
21
28
  },
22
29
  "scripts": {
23
- "dev": "BUILD_MODE=dev yarn dev:dist",
24
- "dev:dist": "yarn build:dist --watch",
25
- "dev:declarations": "tsc -p . --emitDeclarationOnly --watch --outDir dist_types",
26
- "build": "run-s build:dist build:declarations",
27
- "build:dist": "vite build",
28
- "build:declarations": "tsc -p . --emitDeclarationOnly --outDir dist_types",
30
+ "dev": "tsdown --watch",
31
+ "build": "tsdown",
29
32
  "clean": "rimraf -rf ./dist && rimraf -rf ./dist_types",
30
33
  "test": "jest",
31
34
  "test:watch": "jest --watch"
@@ -34,18 +37,16 @@
34
37
  "url": "https://github.com/hsunpei/react-scrollytelling/issues"
35
38
  },
36
39
  "devDependencies": {
37
- "@testing-library/dom": "^10.4.0",
38
- "@testing-library/jest-dom": "^6.4.8",
39
- "@testing-library/react": "^16.0.0",
40
- "jest": "^29.7.0",
41
- "jest-environment-jsdom": "^29.7.0",
42
- "ts-jest": "^29.2.4",
43
- "vite": "^5.2.11"
40
+ "@testing-library/dom": "catalog:",
41
+ "@testing-library/jest-dom": "catalog:",
42
+ "@testing-library/react": "catalog:",
43
+ "jest": "catalog:",
44
+ "jest-environment-jsdom": "catalog:",
45
+ "ts-jest": "catalog:"
44
46
  },
45
47
  "peerDependencies": {
46
- "@react-scrollytelling/core": "workspace:^",
47
- "react": "^19.1.1",
48
- "react-dom": "^19.1.1"
49
- },
50
- "gitHead": "e68bd6fc3cb9fe9b8b65c176166189339d25c4a1"
48
+ "@react-scrollytelling/core": "workspace:*",
49
+ "react": "catalog:",
50
+ "react-dom": "catalog:"
51
+ }
51
52
  }
package/dist/index.cjs.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),te=require("@react-scrollytelling/core");var Y={exports:{}},O={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var U;function ne(){if(U)return O;U=1;var i=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function f(d,n,s){var m=null;if(s!==void 0&&(m=""+s),n.key!==void 0&&(m=""+n.key),"key"in n){s={};for(var E in n)E!=="key"&&(s[E]=n[E])}else s=n;return n=s.ref,{$$typeof:i,type:d,key:m,ref:n!==void 0?n:null,props:s}}return O.Fragment=u,O.jsx=f,O.jsxs=f,O}var h={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var q;function oe(){return q||(q=1,process.env.NODE_ENV!=="production"&&function(){function i(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===K?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case A:return"Profiler";case P:return"StrictMode";case X:return"Suspense";case B:return"SuspenseList";case Q:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case y:return"Portal";case J:return(e.displayName||"Context")+".Provider";case G:return(e._context.displayName||"Context")+".Consumer";case H:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Z:return r=e.displayName||null,r!==null?r:i(e.type)||"Memo";case $:r=e._payload,e=e._init;try{return i(e(r))}catch(t){}}return null}function u(e){return""+e}function f(e){try{u(e);var r=!1}catch(v){r=!0}if(r){r=console;var t=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),u(e)}}function d(e){if(e===k)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===$)return"<...>";try{var r=i(e);return r?"<"+r+">":"<...>"}catch(t){return"<...>"}}function n(){var e=w.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function m(e){if(F.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function E(e,r){function t(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function R(){var e=i(this.type);return L[e]||(L[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function g(e,r,t,o,v,l,N,C){return t=l.ref,e={$$typeof:S,type:e,key:r,props:l,_owner:v},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:R}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:N}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function T(e,r,t,o,v,l,N,C){var a=r.children;if(a!==void 0)if(o)if(ee(a)){for(o=0;o<a.length;o++)j(a[o]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(a);if(F.call(r,"key")){a=i(e);var _=Object.keys(r).filter(function(re){return re!=="key"});o=0<_.length?"{key: someKey, "+_.join(": ..., ")+": ...}":"{key: someKey}",W[a+o]||(_=0<_.length?"{"+_.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
- let props = %s;
19
- <%s {...props} />
20
- React keys must be passed directly to JSX without using spread:
21
- let props = %s;
22
- <%s key={someKey} {...props} />`,o,a,_,a),W[a+o]=!0)}if(a=null,t!==void 0&&(f(t),a=""+t),m(r)&&(f(r.key),a=""+r.key),"key"in r){t={};for(var I in r)I!=="key"&&(t[I]=r[I])}else t=r;return a&&E(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),g(e,a,l,v,n(),t,N,C)}function j(e){typeof e=="object"&&e!==null&&e.$$typeof===S&&e._store&&(e._store.validated=1)}var b=c,S=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),J=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),w=b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,ee=Array.isArray,x=console.createTask?console.createTask:function(){return null};b={react_stack_bottom_frame:function(e){return e()}};var D,L={},M=b.react_stack_bottom_frame.bind(b,s)(),V=x(d(s)),W={};h.Fragment=k,h.jsx=function(e,r,t,o,v){var l=1e4>w.recentlyCreatedOwnerStacks++;return T(e,r,t,!1,o,v,l?Error("react-stack-top-frame"):M,l?x(d(e)):V)},h.jsxs=function(e,r,t,o,v){var l=1e4>w.recentlyCreatedOwnerStacks++;return T(e,r,t,!0,o,v,l?Error("react-stack-top-frame"):M,l?x(d(e)):V)}}()),h}process.env.NODE_ENV==="production"?Y.exports=ne():Y.exports=oe();var p=Y.exports;const ae=({src:i,srcWebm:u,width:f,height:d,thumbnail:n,ratio:s=0,className:m,loadingOverlay:E})=>{const R=c.useRef(null);return c.useEffect(()=>{R.current&&R.current.setRatio(s)},[s]),p.jsx(z,{ref:R,width:f,height:d,src:i,srcWebm:u,className:m,thumbnail:n,loadingOverlay:E})},z=c.memo(c.forwardRef(({src:i,srcWebm:u,width:f,height:d,thumbnail:n,className:s,loadingOverlay:m},E)=>{const R=c.useRef(null),[g,T]=c.useState(!0),j=c.useCallback(k=>{const P=R.current;if(!P)return;const A=P.duration;isNaN(A)||requestAnimationFrame(()=>{P.currentTime=Math.round(k*A*100)/100})},[]),b=te.useRafThrottle(j);c.useImperativeHandle(E,()=>({setRatio:b}),[b]);const S=c.useCallback(()=>{T(!0)},[]),y=c.useCallback(()=>{T(!1)},[]);return p.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[p.jsxs("video",{ref:R,width:f,height:d,className:s,muted:!0,disablePictureInPicture:!0,disableRemotePlayback:!0,playsInline:!0,controls:!1,preload:"auto",onWaiting:S,onCanPlay:y,poster:n,children:[u&&p.jsx("source",{src:n?u:`${u}#t=0.1`,type:"video/webm"}),p.jsx("source",{src:n?i:`${i}#t=0.1`,type:"video/mp4"})]}),p.jsx("div",{style:{position:"absolute",inset:0},children:g&&m})]})}));exports.Video=ae;exports.VideoWithImperativeHandle=z;
23
- //# sourceMappingURL=index.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../node_modules/react/cjs/react-jsx-runtime.production.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/jsx-runtime.js","../src/components/Video.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return (type.displayName || \"Context\") + \".Provider\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(\n type,\n key,\n self,\n source,\n owner,\n props,\n debugStack,\n debugTask\n ) {\n self = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== self ? self : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n source,\n self,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n self,\n source,\n getOwner(),\n maybeKey,\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_ELEMENT_TYPE &&\n node._store &&\n (node._store.validated = 1);\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\");\n Symbol.for(\"react.provider\");\n var REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey, source, self) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n source,\n self,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey, source, self) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n source,\n self,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","import React, { useEffect, useImperativeHandle, useCallback, useRef, useState } from 'react';\n\nimport { useRafThrottle } from '@react-scrollytelling/core';\n\nexport interface VideoProps {\n /** Source of the mp4 video */\n src: string;\n\n /** Source of the webm video */\n srcWebm?: string;\n\n /**\n * Thumbnail URL of the video.\n * If not specified, it will use the first frame of the video as the thumbnail.\n */\n thumbnail?: string;\n\n className?: string;\n width: number;\n height: number;\n ratio?: number;\n\n /** Overlay content to show when the video is loading */\n loadingOverlay?: React.ReactNode;\n}\n\nexport const Video = ({\n src,\n srcWebm,\n width,\n height,\n thumbnail,\n ratio = 0,\n className,\n loadingOverlay,\n}: VideoProps) => {\n const videoRef = useRef<VideoRef>(null);\n\n useEffect(() => {\n // update currentTime when the ratio prop changes\n if (!videoRef.current) {\n return;\n }\n videoRef.current.setRatio(ratio);\n }, [ratio]);\n\n return (\n <VideoWithImperativeHandle\n ref={videoRef}\n width={width}\n height={height}\n src={src}\n srcWebm={srcWebm}\n className={className}\n thumbnail={thumbnail}\n loadingOverlay={loadingOverlay}\n ></VideoWithImperativeHandle>\n );\n};\n\nexport interface VideoRef {\n setRatio: (ratio: number) => void;\n}\n\nexport const VideoWithImperativeHandle = React.memo(\n React.forwardRef<VideoRef, VideoProps>(\n ({ src, srcWebm, width, height, thumbnail, className, loadingOverlay }, ref) => {\n const videoRef = useRef<HTMLVideoElement>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n const setVideoRatio = useCallback((ratio: number) => {\n const videoElement = videoRef.current;\n if (!videoElement) {\n return;\n }\n\n const duration = videoElement.duration;\n if (!isNaN(duration)) {\n requestAnimationFrame(() => {\n videoElement.currentTime = Math.round(ratio * duration * 100) / 100;\n });\n }\n }, []);\n const setVideoRatioThrottled = useRafThrottle(setVideoRatio);\n\n useImperativeHandle(\n ref,\n () => {\n return {\n setRatio: setVideoRatioThrottled,\n };\n },\n [setVideoRatioThrottled]\n );\n\n const handleWaiting = useCallback(() => {\n setIsLoading(true);\n }, []);\n\n const handleCanPlay = useCallback(() => {\n setIsLoading(false);\n }, []);\n\n return (\n <div style={{ position: 'relative', width: '100%', height: '100%' }}>\n <video\n ref={videoRef}\n width={width}\n height={height}\n className={className}\n muted\n disablePictureInPicture\n disableRemotePlayback\n playsInline\n controls={false}\n // preload the video\n preload=\"auto\"\n onWaiting={handleWaiting}\n onCanPlay={handleCanPlay}\n poster={thumbnail}\n >\n {srcWebm && <source src={thumbnail ? srcWebm : `${srcWebm}#t=0.1`} type=\"video/webm\" />}\n <source src={thumbnail ? src : `${src}#t=0.1`} type=\"video/mp4\" />\n </video>\n <div style={{ position: 'absolute', inset: 0 }}>{isLoading && loadingOverlay}</div>\n </div>\n );\n }\n )\n);\n"],"names":["REACT_ELEMENT_TYPE","REACT_FRAGMENT_TYPE","jsxProd","type","config","maybeKey","key","propName","reactJsxRuntime_production","getComponentNameFromType","REACT_CLIENT_REFERENCE","REACT_PROFILER_TYPE","REACT_STRICT_MODE_TYPE","REACT_SUSPENSE_TYPE","REACT_SUSPENSE_LIST_TYPE","REACT_ACTIVITY_TYPE","REACT_PORTAL_TYPE","REACT_CONTEXT_TYPE","REACT_CONSUMER_TYPE","REACT_FORWARD_REF_TYPE","innerType","REACT_MEMO_TYPE","REACT_LAZY_TYPE","x","testStringCoercion","value","checkKeyStringCoercion","JSCompiler_inline_result","e","JSCompiler_temp_const","JSCompiler_inline_result$jscomp$0","getTaskName","name","getOwner","dispatcher","ReactSharedInternals","UnknownOwner","hasValidKey","hasOwnProperty","getter","defineKeyPropWarningGetter","props","displayName","warnAboutAccessingKey","specialPropKeyWarningShown","elementRefGetterWithDeprecationWarning","componentName","didWarnAboutElementRef","ReactElement","self","source","owner","debugStack","debugTask","jsxDEVImpl","isStaticChildren","children","isArrayImpl","validateChildKeys","keys","k","didWarnAboutKeySpread","node","React","require$$0","createTask","callStackForError","unknownOwnerDebugStack","unknownOwnerDebugTask","reactJsxRuntime_development","trackActualOwner","jsxRuntimeModule","require$$1","Video","src","srcWebm","width","height","thumbnail","ratio","className","loadingOverlay","videoRef","useRef","useEffect","jsx","VideoWithImperativeHandle","ref","isLoading","setIsLoading","useState","setVideoRatio","useCallback","videoElement","duration","setVideoRatioThrottled","useRafThrottle","useImperativeHandle","handleWaiting","handleCanPlay","jsxs"],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AS,QAC9B,GAAI,CAACW,EACH,OAGF,MAAMC,EAAWD,EAAa,SACzB,MAAMC,CAAQ,GACjB,sBAAsB,IAAM,CAC1BD,EAAa,YAAc,KAAK,MAAMd,EAAQe,EAAW,GAAG,EAAI,GAAA,CACjE,CAEL,EAAG,CAAE,CAAA,EACCC,EAAyBC,kBAAeL,CAAa,EAE3DM,EAAA,oBACEV,EACA,KACS,CACL,SAAUQ,CAAA,GAGd,CAACA,CAAsB,CAAA,EAGnB,MAAAG,EAAgBN,EAAAA,YAAY,IAAM,CACtCH,EAAa,EAAI,CACnB,EAAG,CAAE,CAAA,EAECU,EAAgBP,EAAAA,YAAY,IAAM,CACtCH,EAAa,EAAK,CACpB,EAAG,CAAE,CAAA,EAGH,OAAAW,OAAC,MAAI,CAAA,MAAO,CAAE,SAAU,WAAY,MAAO,OAAQ,OAAQ,MAAA,EACzD,SAAA,CAAAA,EAAA,KAAC,QAAA,CACC,IAAKlB,EACL,MAAAN,EACA,OAAAC,EACA,UAAAG,EACA,MAAK,GACL,wBAAuB,GACvB,sBAAqB,GACrB,YAAW,GACX,SAAU,GAEV,QAAQ,OACR,UAAWkB,EACX,UAAWC,EACX,OAAQrB,EAEP,SAAA,CAAWH,GAAAU,EAAAA,IAAC,UAAO,IAAKP,EAAYH,EAAU,GAAGA,CAAO,SAAU,KAAK,YAAa,CAAA,EACrFU,EAAAA,IAAC,UAAO,IAAKP,EAAYJ,EAAM,GAAGA,CAAG,SAAU,KAAK,WAAY,CAAA,CAAA,CAAA,CAClE,EACAW,EAAAA,IAAC,MAAI,CAAA,MAAO,CAAE,SAAU,WAAY,MAAO,CAAA,EAAM,SAAAG,GAAaP,CAAe,CAAA,CAC/E,CAAA,CAAA,CAEJ,CACF,CACF","x_google_ignoreList":[0,1,2]}
package/dist/index.es.js DELETED
@@ -1,370 +0,0 @@
1
- import Y, { useRef as G, useEffect as ne, useState as oe, useCallback as I, useImperativeHandle as ae } from "react";
2
- import { useRafThrottle as se } from "@react-scrollytelling/core";
3
- var $ = { exports: {} }, P = {};
4
- /**
5
- * @license React
6
- * react-jsx-runtime.production.js
7
- *
8
- * Copyright (c) Meta Platforms, Inc. and affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- var z;
14
- function ie() {
15
- if (z)
16
- return P;
17
- z = 1;
18
- var i = Symbol.for("react.transitional.element"), c = Symbol.for("react.fragment");
19
- function l(f, n, s) {
20
- var d = null;
21
- if (s !== void 0 && (d = "" + s), n.key !== void 0 && (d = "" + n.key), "key" in n) {
22
- s = {};
23
- for (var m in n)
24
- m !== "key" && (s[m] = n[m]);
25
- } else
26
- s = n;
27
- return n = s.ref, {
28
- $$typeof: i,
29
- type: f,
30
- key: d,
31
- ref: n !== void 0 ? n : null,
32
- props: s
33
- };
34
- }
35
- return P.Fragment = c, P.jsx = l, P.jsxs = l, P;
36
- }
37
- var O = {};
38
- /**
39
- * @license React
40
- * react-jsx-runtime.development.js
41
- *
42
- * Copyright (c) Meta Platforms, Inc. and affiliates.
43
- *
44
- * This source code is licensed under the MIT license found in the
45
- * LICENSE file in the root directory of this source tree.
46
- */
47
- var q;
48
- function ce() {
49
- return q || (q = 1, process.env.NODE_ENV !== "production" && function() {
50
- function i(e) {
51
- if (e == null)
52
- return null;
53
- if (typeof e == "function")
54
- return e.$$typeof === ee ? null : e.displayName || e.name || null;
55
- if (typeof e == "string")
56
- return e;
57
- switch (e) {
58
- case T:
59
- return "Fragment";
60
- case A:
61
- return "Profiler";
62
- case k:
63
- return "StrictMode";
64
- case B:
65
- return "Suspense";
66
- case Z:
67
- return "SuspenseList";
68
- case K:
69
- return "Activity";
70
- }
71
- if (typeof e == "object")
72
- switch (typeof e.tag == "number" && console.error(
73
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
74
- ), e.$$typeof) {
75
- case w:
76
- return "Portal";
77
- case X:
78
- return (e.displayName || "Context") + ".Provider";
79
- case J:
80
- return (e._context.displayName || "Context") + ".Consumer";
81
- case H:
82
- var r = e.render;
83
- return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
84
- case Q:
85
- return r = e.displayName || null, r !== null ? r : i(e.type) || "Memo";
86
- case F:
87
- r = e._payload, e = e._init;
88
- try {
89
- return i(e(r));
90
- } catch (t) {
91
- }
92
- }
93
- return null;
94
- }
95
- function c(e) {
96
- return "" + e;
97
- }
98
- function l(e) {
99
- try {
100
- c(e);
101
- var r = !1;
102
- } catch (R) {
103
- r = !0;
104
- }
105
- if (r) {
106
- r = console;
107
- var t = r.error, o = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
108
- return t.call(
109
- r,
110
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
111
- o
112
- ), c(e);
113
- }
114
- }
115
- function f(e) {
116
- if (e === T)
117
- return "<>";
118
- if (typeof e == "object" && e !== null && e.$$typeof === F)
119
- return "<...>";
120
- try {
121
- var r = i(e);
122
- return r ? "<" + r + ">" : "<...>";
123
- } catch (t) {
124
- return "<...>";
125
- }
126
- }
127
- function n() {
128
- var e = g.A;
129
- return e === null ? null : e.getOwner();
130
- }
131
- function s() {
132
- return Error("react-stack-top-frame");
133
- }
134
- function d(e) {
135
- if (D.call(e, "key")) {
136
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
137
- if (r && r.isReactWarning)
138
- return !1;
139
- }
140
- return e.key !== void 0;
141
- }
142
- function m(e, r) {
143
- function t() {
144
- L || (L = !0, console.error(
145
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
146
- r
147
- ));
148
- }
149
- t.isReactWarning = !0, Object.defineProperty(e, "key", {
150
- get: t,
151
- configurable: !0
152
- });
153
- }
154
- function E() {
155
- var e = i(this.type);
156
- return M[e] || (M[e] = !0, console.error(
157
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
158
- )), e = this.props.ref, e !== void 0 ? e : null;
159
- }
160
- function S(e, r, t, o, R, u, y, N) {
161
- return t = u.ref, e = {
162
- $$typeof: j,
163
- type: e,
164
- key: r,
165
- props: u,
166
- _owner: R
167
- }, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
168
- enumerable: !1,
169
- get: E
170
- }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
171
- configurable: !1,
172
- enumerable: !1,
173
- writable: !0,
174
- value: 0
175
- }), Object.defineProperty(e, "_debugInfo", {
176
- configurable: !1,
177
- enumerable: !1,
178
- writable: !0,
179
- value: null
180
- }), Object.defineProperty(e, "_debugStack", {
181
- configurable: !1,
182
- enumerable: !1,
183
- writable: !0,
184
- value: y
185
- }), Object.defineProperty(e, "_debugTask", {
186
- configurable: !1,
187
- enumerable: !1,
188
- writable: !0,
189
- value: N
190
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
191
- }
192
- function p(e, r, t, o, R, u, y, N) {
193
- var a = r.children;
194
- if (a !== void 0)
195
- if (o)
196
- if (re(a)) {
197
- for (o = 0; o < a.length; o++)
198
- h(a[o]);
199
- Object.freeze && Object.freeze(a);
200
- } else
201
- console.error(
202
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
203
- );
204
- else
205
- h(a);
206
- if (D.call(r, "key")) {
207
- a = i(e);
208
- var _ = Object.keys(r).filter(function(te) {
209
- return te !== "key";
210
- });
211
- o = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", U[a + o] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
212
- `A props object containing a "key" prop is being spread into JSX:
213
- let props = %s;
214
- <%s {...props} />
215
- React keys must be passed directly to JSX without using spread:
216
- let props = %s;
217
- <%s key={someKey} {...props} />`,
218
- o,
219
- a,
220
- _,
221
- a
222
- ), U[a + o] = !0);
223
- }
224
- if (a = null, t !== void 0 && (l(t), a = "" + t), d(r) && (l(r.key), a = "" + r.key), "key" in r) {
225
- t = {};
226
- for (var C in r)
227
- C !== "key" && (t[C] = r[C]);
228
- } else
229
- t = r;
230
- return a && m(
231
- t,
232
- typeof e == "function" ? e.displayName || e.name || "Unknown" : e
233
- ), S(
234
- e,
235
- a,
236
- u,
237
- R,
238
- n(),
239
- t,
240
- y,
241
- N
242
- );
243
- }
244
- function h(e) {
245
- typeof e == "object" && e !== null && e.$$typeof === j && e._store && (e._store.validated = 1);
246
- }
247
- var v = Y, j = Symbol.for("react.transitional.element"), w = Symbol.for("react.portal"), T = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), J = Symbol.for("react.consumer"), X = Symbol.for("react.context"), H = Symbol.for("react.forward_ref"), B = Symbol.for("react.suspense"), Z = Symbol.for("react.suspense_list"), Q = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), g = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, re = Array.isArray, x = console.createTask ? console.createTask : function() {
248
- return null;
249
- };
250
- v = {
251
- react_stack_bottom_frame: function(e) {
252
- return e();
253
- }
254
- };
255
- var L, M = {}, W = v.react_stack_bottom_frame.bind(
256
- v,
257
- s
258
- )(), V = x(f(s)), U = {};
259
- O.Fragment = T, O.jsx = function(e, r, t, o, R) {
260
- var u = 1e4 > g.recentlyCreatedOwnerStacks++;
261
- return p(
262
- e,
263
- r,
264
- t,
265
- !1,
266
- o,
267
- R,
268
- u ? Error("react-stack-top-frame") : W,
269
- u ? x(f(e)) : V
270
- );
271
- }, O.jsxs = function(e, r, t, o, R) {
272
- var u = 1e4 > g.recentlyCreatedOwnerStacks++;
273
- return p(
274
- e,
275
- r,
276
- t,
277
- !0,
278
- o,
279
- R,
280
- u ? Error("react-stack-top-frame") : W,
281
- u ? x(f(e)) : V
282
- );
283
- };
284
- }()), O;
285
- }
286
- process.env.NODE_ENV === "production" ? $.exports = ie() : $.exports = ce();
287
- var b = $.exports;
288
- const de = ({
289
- src: i,
290
- srcWebm: c,
291
- width: l,
292
- height: f,
293
- thumbnail: n,
294
- ratio: s = 0,
295
- className: d,
296
- loadingOverlay: m
297
- }) => {
298
- const E = G(null);
299
- return ne(() => {
300
- E.current && E.current.setRatio(s);
301
- }, [s]), /* @__PURE__ */ b.jsx(
302
- ue,
303
- {
304
- ref: E,
305
- width: l,
306
- height: f,
307
- src: i,
308
- srcWebm: c,
309
- className: d,
310
- thumbnail: n,
311
- loadingOverlay: m
312
- }
313
- );
314
- }, ue = Y.memo(
315
- Y.forwardRef(
316
- ({ src: i, srcWebm: c, width: l, height: f, thumbnail: n, className: s, loadingOverlay: d }, m) => {
317
- const E = G(null), [S, p] = oe(!0), h = I((T) => {
318
- const k = E.current;
319
- if (!k)
320
- return;
321
- const A = k.duration;
322
- isNaN(A) || requestAnimationFrame(() => {
323
- k.currentTime = Math.round(T * A * 100) / 100;
324
- });
325
- }, []), v = se(h);
326
- ae(
327
- m,
328
- () => ({
329
- setRatio: v
330
- }),
331
- [v]
332
- );
333
- const j = I(() => {
334
- p(!0);
335
- }, []), w = I(() => {
336
- p(!1);
337
- }, []);
338
- return /* @__PURE__ */ b.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
339
- /* @__PURE__ */ b.jsxs(
340
- "video",
341
- {
342
- ref: E,
343
- width: l,
344
- height: f,
345
- className: s,
346
- muted: !0,
347
- disablePictureInPicture: !0,
348
- disableRemotePlayback: !0,
349
- playsInline: !0,
350
- controls: !1,
351
- preload: "auto",
352
- onWaiting: j,
353
- onCanPlay: w,
354
- poster: n,
355
- children: [
356
- c && /* @__PURE__ */ b.jsx("source", { src: n ? c : `${c}#t=0.1`, type: "video/webm" }),
357
- /* @__PURE__ */ b.jsx("source", { src: n ? i : `${i}#t=0.1`, type: "video/mp4" })
358
- ]
359
- }
360
- ),
361
- /* @__PURE__ */ b.jsx("div", { style: { position: "absolute", inset: 0 }, children: S && d })
362
- ] });
363
- }
364
- )
365
- );
366
- export {
367
- de as Video,
368
- ue as VideoWithImperativeHandle
369
- };
370
- //# sourceMappingURL=index.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../node_modules/react/cjs/react-jsx-runtime.production.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/jsx-runtime.js","../src/components/Video.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return (type.displayName || \"Context\") + \".Provider\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(\n type,\n key,\n self,\n source,\n owner,\n props,\n debugStack,\n debugTask\n ) {\n self = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== self ? self : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n source,\n self,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n self,\n source,\n getOwner(),\n maybeKey,\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_ELEMENT_TYPE &&\n node._store &&\n (node._store.validated = 1);\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\");\n Symbol.for(\"react.provider\");\n var REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey, source, self) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n source,\n self,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey, source, self) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n source,\n self,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","import React, { useEffect, useImperativeHandle, useCallback, useRef, useState } from 'react';\n\nimport { useRafThrottle } from '@react-scrollytelling/core';\n\nexport interface VideoProps {\n /** Source of the mp4 video */\n src: string;\n\n /** Source of the webm video */\n srcWebm?: string;\n\n /**\n * Thumbnail URL of the video.\n * If not specified, it will use the first frame of the video as the thumbnail.\n */\n thumbnail?: string;\n\n className?: string;\n width: number;\n height: number;\n ratio?: number;\n\n /** Overlay content to show when the video is loading */\n loadingOverlay?: React.ReactNode;\n}\n\nexport const Video = ({\n src,\n srcWebm,\n width,\n height,\n thumbnail,\n ratio = 0,\n className,\n loadingOverlay,\n}: VideoProps) => {\n const videoRef = useRef<VideoRef>(null);\n\n useEffect(() => {\n // update currentTime when the ratio prop changes\n if (!videoRef.current) {\n return;\n }\n videoRef.current.setRatio(ratio);\n }, [ratio]);\n\n return (\n <VideoWithImperativeHandle\n ref={videoRef}\n width={width}\n height={height}\n src={src}\n srcWebm={srcWebm}\n className={className}\n thumbnail={thumbnail}\n loadingOverlay={loadingOverlay}\n ></VideoWithImperativeHandle>\n );\n};\n\nexport interface VideoRef {\n setRatio: (ratio: number) => void;\n}\n\nexport const VideoWithImperativeHandle = React.memo(\n React.forwardRef<VideoRef, VideoProps>(\n ({ src, srcWebm, width, height, thumbnail, className, loadingOverlay }, ref) => {\n const videoRef = useRef<HTMLVideoElement>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n const setVideoRatio = useCallback((ratio: number) => {\n const videoElement = videoRef.current;\n if (!videoElement) {\n return;\n }\n\n const duration = videoElement.duration;\n if (!isNaN(duration)) {\n requestAnimationFrame(() => {\n videoElement.currentTime = Math.round(ratio * duration * 100) / 100;\n });\n }\n }, []);\n const setVideoRatioThrottled = useRafThrottle(setVideoRatio);\n\n useImperativeHandle(\n ref,\n () => {\n return {\n setRatio: setVideoRatioThrottled,\n };\n },\n [setVideoRatioThrottled]\n );\n\n const handleWaiting = useCallback(() => {\n setIsLoading(true);\n }, []);\n\n const handleCanPlay = useCallback(() => {\n setIsLoading(false);\n }, []);\n\n return (\n <div style={{ position: 'relative', width: '100%', height: '100%' }}>\n <video\n ref={videoRef}\n width={width}\n height={height}\n className={className}\n muted\n disablePictureInPicture\n disableRemotePlayback\n playsInline\n controls={false}\n // preload the video\n preload=\"auto\"\n onWaiting={handleWaiting}\n onCanPlay={handleCanPlay}\n poster={thumbnail}\n >\n {srcWebm && <source src={thumbnail ? srcWebm : `${srcWebm}#t=0.1`} type=\"video/webm\" />}\n <source src={thumbnail ? src : `${src}#t=0.1`} type=\"video/mp4\" />\n </video>\n <div style={{ position: 'absolute', inset: 0 }}>{isLoading && loadingOverlay}</div>\n </div>\n );\n }\n )\n);\n"],"names":["REACT_ELEMENT_TYPE","REACT_FRAGMENT_TYPE","jsxProd","type","config","maybeKey","key","propName","reactJsxRuntime_production","getComponentNameFromType","REACT_CLIENT_REFERENCE","REACT_PROFILER_TYPE","REACT_STRICT_MODE_TYPE","REACT_SUSPENSE_TYPE","REACT_SUSPENSE_LIST_TYPE","REACT_ACTIVITY_TYPE","REACT_PORTAL_TYPE","REACT_CONTEXT_TYPE","REACT_CONSUMER_TYPE","REACT_FORWARD_REF_TYPE","innerType","REACT_MEMO_TYPE","REACT_LAZY_TYPE","x","testStringCoercion","value","checkKeyStringCoercion","JSCompiler_inline_result","e","JSCompiler_temp_const","JSCompiler_inline_result$jscomp$0","getTaskName","name","getOwner","dispatcher","ReactSharedInternals","UnknownOwner","hasValidKey","hasOwnProperty","getter","defineKeyPropWarningGetter","props","displayName","warnAboutAccessingKey","specialPropKeyWarningShown","elementRefGetterWithDeprecationWarning","componentName","didWarnAboutElementRef","ReactElement","self","source","owner","debugStack","debugTask","jsxDEVImpl","isStaticChildren","children","isArrayImpl","validateChildKeys","keys","k","didWarnAboutKeySpread","node","React","require$$0","createTask","callStackForError","unknownOwnerDebugStack","unknownOwnerDebugTask","reactJsxRuntime_development","trackActualOwner","jsxRuntimeModule","require$$1","Video","src","srcWebm","width","height","thumbnail","ratio","className","loadingOverlay","videoRef","useRef","useEffect","jsx","VideoWithImperativeHandle","ref","isLoading","setIsLoading","useState","setVideoRatio","useCallback","videoElement","duration","setVideoRatioThrottled","useRafThrottle","useImperativeHandle","handleWaiting","handleCanPlay","jsxs"],"mappings":";;;;;;;;;;;;;;;;;AAWA,MAAIA,IAAqB,OAAO,IAAI,4BAA4B,GAC9DC,IAAsB,OAAO,IAAI,gBAAgB;AACnD,WAASC,EAAQC,GAAMC,GAAQC,GAAU;AACvC,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AAeL,CAAa;AAE3D,MAAAM;AAAA,QACEV;AAAA,QACA,OACS;AAAA,UACL,UAAUQ;AAAA,QAAA;AAAA,QAGd,CAACA,CAAsB;AAAA,MAAA;AAGnB,YAAAG,IAAgBN,EAAY,MAAM;AACtC,QAAAH,EAAa,EAAI;AAAA,MACnB,GAAG,CAAE,CAAA,GAECU,IAAgBP,EAAY,MAAM;AACtC,QAAAH,EAAa,EAAK;AAAA,MACpB,GAAG,CAAE,CAAA;AAGH,aAAAW,gBAAAA,OAAC,OAAI,EAAA,OAAO,EAAE,UAAU,YAAY,OAAO,QAAQ,QAAQ,OAAA,GACzD,UAAA;AAAA,QAAAA,gBAAAA,EAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,KAAKlB;AAAA,YACL,OAAAN;AAAA,YACA,QAAAC;AAAA,YACA,WAAAG;AAAA,YACA,OAAK;AAAA,YACL,yBAAuB;AAAA,YACvB,uBAAqB;AAAA,YACrB,aAAW;AAAA,YACX,UAAU;AAAA,YAEV,SAAQ;AAAA,YACR,WAAWkB;AAAA,YACX,WAAWC;AAAA,YACX,QAAQrB;AAAA,YAEP,UAAA;AAAA,cAAWH,KAAAU,gBAAAA,EAAAA,IAAC,YAAO,KAAKP,IAAYH,IAAU,GAAGA,CAAO,UAAU,MAAK,aAAa,CAAA;AAAA,cACrFU,gBAAAA,EAAAA,IAAC,YAAO,KAAKP,IAAYJ,IAAM,GAAGA,CAAG,UAAU,MAAK,YAAY,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAClE;AAAA,QACAW,gBAAAA,EAAAA,IAAC,OAAI,EAAA,OAAO,EAAE,UAAU,YAAY,OAAO,EAAA,GAAM,UAAAG,KAAaP,EAAe,CAAA;AAAA,MAC/E,EAAA,CAAA;AAAA,IAEJ;AAAA,EACF;AACF;","x_google_ignoreList":[0,1,2]}
@@ -1,25 +0,0 @@
1
- import { default as React } from 'react';
2
-
3
- export interface VideoProps {
4
- /** Source of the mp4 video */
5
- src: string;
6
- /** Source of the webm video */
7
- srcWebm?: string;
8
- /**
9
- * Thumbnail URL of the video.
10
- * If not specified, it will use the first frame of the video as the thumbnail.
11
- */
12
- thumbnail?: string;
13
- className?: string;
14
- width: number;
15
- height: number;
16
- ratio?: number;
17
- /** Overlay content to show when the video is loading */
18
- loadingOverlay?: React.ReactNode;
19
- }
20
- export declare const Video: ({ src, srcWebm, width, height, thumbnail, ratio, className, loadingOverlay, }: VideoProps) => import("react/jsx-runtime").JSX.Element;
21
- export interface VideoRef {
22
- setRatio: (ratio: number) => void;
23
- }
24
- export declare const VideoWithImperativeHandle: React.NamedExoticComponent<VideoProps & React.RefAttributes<VideoRef>>;
25
- //# sourceMappingURL=Video.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../../src/components/Video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAI7F,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IAEZ,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wDAAwD;IACxD,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAED,eAAO,MAAM,KAAK,kFASf,UAAU,4CAuBZ,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,yBAAyB,wEAiErC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Video';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './components';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}