@rendiv/core 0.1.0
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/__tests__/animated-image.test.d.ts +2 -0
- package/dist/__tests__/animated-image.test.d.ts.map +1 -0
- package/dist/__tests__/audio.test.d.ts +2 -0
- package/dist/__tests__/audio.test.d.ts.map +1 -0
- package/dist/__tests__/delay-render.test.d.ts +2 -0
- package/dist/__tests__/delay-render.test.d.ts.map +1 -0
- package/dist/__tests__/freeze.test.d.ts +2 -0
- package/dist/__tests__/freeze.test.d.ts.map +1 -0
- package/dist/__tests__/iframe.test.d.ts +2 -0
- package/dist/__tests__/iframe.test.d.ts.map +1 -0
- package/dist/__tests__/img.test.d.ts +2 -0
- package/dist/__tests__/img.test.d.ts.map +1 -0
- package/dist/__tests__/interpolate.test.d.ts +2 -0
- package/dist/__tests__/interpolate.test.d.ts.map +1 -0
- package/dist/__tests__/loop.test.d.ts +2 -0
- package/dist/__tests__/loop.test.d.ts.map +1 -0
- package/dist/__tests__/sequence.test.d.ts +2 -0
- package/dist/__tests__/sequence.test.d.ts.map +1 -0
- package/dist/__tests__/series.test.d.ts +2 -0
- package/dist/__tests__/series.test.d.ts.map +1 -0
- package/dist/__tests__/spring.test.d.ts +2 -0
- package/dist/__tests__/spring.test.d.ts.map +1 -0
- package/dist/__tests__/video.test.d.ts +2 -0
- package/dist/__tests__/video.test.d.ts.map +1 -0
- package/dist/animation/easing.d.ts +17 -0
- package/dist/animation/easing.d.ts.map +1 -0
- package/dist/animation/interpolate-colors.d.ts +3 -0
- package/dist/animation/interpolate-colors.d.ts.map +1 -0
- package/dist/animation/interpolate.d.ts +9 -0
- package/dist/animation/interpolate.d.ts.map +1 -0
- package/dist/animation/measure-spring.d.ts +10 -0
- package/dist/animation/measure-spring.d.ts.map +1 -0
- package/dist/animation/spring.d.ts +17 -0
- package/dist/animation/spring.d.ts.map +1 -0
- package/dist/components/AnimatedImage.d.ts +15 -0
- package/dist/components/AnimatedImage.d.ts.map +1 -0
- package/dist/components/Audio.d.ts +18 -0
- package/dist/components/Audio.d.ts.map +1 -0
- package/dist/components/Composition.d.ts +14 -0
- package/dist/components/Composition.d.ts.map +1 -0
- package/dist/components/Fill.d.ts +3 -0
- package/dist/components/Fill.d.ts.map +1 -0
- package/dist/components/Folder.d.ts +7 -0
- package/dist/components/Folder.d.ts.map +1 -0
- package/dist/components/Freeze.d.ts +10 -0
- package/dist/components/Freeze.d.ts.map +1 -0
- package/dist/components/IFrame.d.ts +10 -0
- package/dist/components/IFrame.d.ts.map +1 -0
- package/dist/components/Img.d.ts +10 -0
- package/dist/components/Img.d.ts.map +1 -0
- package/dist/components/Loop.d.ts +13 -0
- package/dist/components/Loop.d.ts.map +1 -0
- package/dist/components/Sequence.d.ts +11 -0
- package/dist/components/Sequence.d.ts.map +1 -0
- package/dist/components/Series.d.ts +27 -0
- package/dist/components/Series.d.ts.map +1 -0
- package/dist/components/Still.d.ts +10 -0
- package/dist/components/Still.d.ts.map +1 -0
- package/dist/components/Video.d.ts +22 -0
- package/dist/components/Video.d.ts.map +1 -0
- package/dist/context/CompositionContext.d.ts +10 -0
- package/dist/context/CompositionContext.d.ts.map +1 -0
- package/dist/context/CompositionManagerContext.d.ts +34 -0
- package/dist/context/CompositionManagerContext.d.ts.map +1 -0
- package/dist/context/FolderContext.d.ts +2 -0
- package/dist/context/FolderContext.d.ts.map +1 -0
- package/dist/context/RendivEnvironmentContext.d.ts +6 -0
- package/dist/context/RendivEnvironmentContext.d.ts.map +1 -0
- package/dist/context/SequenceContext.d.ts +10 -0
- package/dist/context/SequenceContext.d.ts.map +1 -0
- package/dist/context/TimelineContext.d.ts +8 -0
- package/dist/context/TimelineContext.d.ts.map +1 -0
- package/dist/context/TimelineRegistryContext.d.ts +17 -0
- package/dist/context/TimelineRegistryContext.d.ts.map +1 -0
- package/dist/delay-render.d.ts +11 -0
- package/dist/delay-render.d.ts.map +1 -0
- package/dist/get-input-props.d.ts +7 -0
- package/dist/get-input-props.d.ts.map +1 -0
- package/dist/get-rendiv-environment.d.ts +11 -0
- package/dist/get-rendiv-environment.d.ts.map +1 -0
- package/dist/hooks/use-composition-config.d.ts +3 -0
- package/dist/hooks/use-composition-config.d.ts.map +1 -0
- package/dist/hooks/use-frame.d.ts +2 -0
- package/dist/hooks/use-frame.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +829 -0
- package/dist/register-root.d.ts +4 -0
- package/dist/register-root.d.ts.map +1 -0
- package/dist/static-file.d.ts +2 -0
- package/dist/static-file.d.ts.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-composition-config.d.ts","sourceRoot":"","sources":["../../src/hooks/use-composition-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,wBAAgB,oBAAoB,IAAI,iBAAiB,CAQxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-frame.d.ts","sourceRoot":"","sources":["../../src/hooks/use-frame.ts"],"names":[],"mappings":"AAIA,wBAAgB,QAAQ,IAAI,MAAM,CAIjC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),I=require("react/jsx-runtime"),R=o.createContext({frame:0,playing:!1,playingRef:{current:!1}}),N=o.createContext({id:null,from:0,durationInFrames:1/0,parentOffset:0,accumulatedOffset:0,localOffset:0});function ae(){const e=o.useContext(R),t=o.useContext(N);return e.frame-t.accumulatedOffset}const V=o.createContext(null);function ce(){const e=o.useContext(V);if(!e)throw new Error("useCompositionConfig() must be called inside a <Composition>, <Player>, or during rendering.");return e}const O=()=>{},z=o.createContext({compositions:[],registerComposition:O,unregisterComposition:O,currentCompositionId:null,setCurrentCompositionId:O,inputProps:{}}),j=o.createContext(null);function le(e){const{registerComposition:t,unregisterComposition:n}=o.useContext(z),i=o.useContext(j);return o.useEffect(()=>(t({id:e.id,component:e.component,durationInFrames:e.durationInFrames,fps:e.fps,width:e.width,height:e.height,defaultProps:e.defaultProps??{},group:i,resolveConfig:e.resolveConfig,type:"composition"}),()=>n(e.id)),[e.id]),null}const ue={position:"absolute",top:0,left:0,right:0,bottom:0,width:"100%",height:"100%",display:"flex",flexDirection:"column"},L=o.forwardRef(({style:e,...t},n)=>I.jsx("div",{ref:n,style:{...ue,...e},...t}));L.displayName="Fill";const X=({from:e=0,durationInFrames:t=1/0,name:n,layout:i="absolute-fill",style:r,children:s})=>{const a=o.useContext(N),c=o.useContext(R),u=o.useId(),m=a.accumulatedOffset+e,p=c.frame;o.useEffect(()=>{if(typeof window>"u")return;const C=window;C.__RENDIV_TIMELINE_ENTRIES__||(C.__RENDIV_TIMELINE_ENTRIES__=new Map);const f=C.__RENDIV_TIMELINE_ENTRIES__,l=a.id,d={id:u,name:n??"Sequence",from:m,durationInFrames:t,parentId:l};return f.set(u,d),document.dispatchEvent(new CustomEvent("rendiv:timeline-sync")),()=>{f.delete(u),document.dispatchEvent(new CustomEvent("rendiv:timeline-sync"))}},[u,n,m,t]);const h=o.useMemo(()=>({id:u,from:m,durationInFrames:t,parentOffset:a.accumulatedOffset,accumulatedOffset:m,localOffset:e}),[u,m,t,a.accumulatedOffset,e]);if(p<m||p>=m+t)return null;const x=I.jsx(N.Provider,{value:h,children:s});return i==="none"?x:I.jsx(L,{style:r,children:x})};X.displayName="Sequence";function fe(e){const{registerComposition:t,unregisterComposition:n}=o.useContext(z),i=o.useContext(j);return o.useEffect(()=>(t({id:e.id,component:e.component,durationInFrames:1,fps:30,width:e.width,height:e.height,defaultProps:e.defaultProps??{},group:i,type:"still"}),()=>n(e.id)),[e.id]),null}const G=({name:e,children:t})=>{const n=o.useContext(j),i=n?`${n}/${e}`:e;return I.jsx(j.Provider,{value:i,children:t})};G.displayName="Folder";function B(e){throw new Error("<Series.Sequence> can only be used as a direct child of <Series>.")}B.displayName="Series.Sequence";function J({children:e}){const t=o.Children.toArray(e);let n=0;const i=[];for(const r of t){if(!o.isValidElement(r))continue;if(r.type!==B)throw new Error("Only <Series.Sequence> elements are allowed as children of <Series>.");const{durationInFrames:s,offset:a=0,name:c,layout:u,style:m,children:p}=r.props,h=n+a;let x=c;if(!x){const C=o.Children.toArray(p);if(C.length>0){const f=C[0];if(o.isValidElement(f)&&typeof f.type!="string"){const l=f.type;x=l.displayName||l.name}}}i.push(I.jsx(X,{from:h,durationInFrames:s,name:x,layout:u,style:m,children:p},r.key??i.length)),n=h+s}return I.jsx(I.Fragment,{children:i})}J.displayName="Series";const de=Object.assign(J,{Sequence:B});function K({durationInFrames:e,times:t=1/0,layout:n="absolute-fill",style:i,children:r}){const s=o.useContext(R),a=o.useContext(N),c=s.frame-a.accumulatedOffset;if(c<0||t!==1/0&&c>=e*t)return null;const u=c%e,m=o.useMemo(()=>({frame:u+a.accumulatedOffset,playing:s.playing,playingRef:s.playingRef}),[u,a.accumulatedOffset,s.playing,s.playingRef]),p=o.useMemo(()=>({id:null,from:a.accumulatedOffset,durationInFrames:e,parentOffset:a.accumulatedOffset,accumulatedOffset:a.accumulatedOffset,localOffset:0}),[a.accumulatedOffset,e]),h=I.jsx(R.Provider,{value:m,children:I.jsx(N.Provider,{value:p,children:r})});return n==="none"?h:I.jsx(L,{style:i,children:h})}K.displayName="Loop";function Q({frame:e,children:t}){const n=o.useContext(R),i=o.useMemo(()=>({frame:e,playing:n.playing,playingRef:n.playingRef}),[e,n.playing,n.playingRef]);return I.jsx(R.Provider,{value:i,children:t})}Q.displayName="Freeze";let me=0;const _=new Map;function $(e,t){const n=++me,i=e??`Handle ${n}`,{timeoutInMilliseconds:r}=t??{};let s=null;return r!==void 0&&r>0&&(s=setTimeout(()=>{if(_.has(n))throw _.delete(n),new Error(`holdRender() timed out after ${r}ms (label: "${i}"). You can increase the timeout by passing a larger timeoutInMilliseconds to holdRender().`)},r)),_.set(n,{label:i,timeoutId:s}),n}function S(e){const t=_.get(e);if(!t)throw new Error(`releaseRender() was called with handle ${e}, but no corresponding holdRender() exists.`);t.timeoutId!==null&&clearTimeout(t.timeoutId),_.delete(e)}function he(e){throw new Error(`Render cancelled: ${e}`)}function ge(){return _.size}function pe(){return Array.from(_.values()).map(e=>e.label)}function Z({holdRenderTimeout:e=3e4,onLoad:t,onError:n,...i}){const r=o.useRef(null);o.useEffect(()=>{const c=$(`Loading <Img> with src="${i.src}"`,{timeoutInMilliseconds:e});return r.current=c,()=>{r.current!==null&&(S(r.current),r.current=null)}},[i.src,e]);const s=o.useCallback(c=>{r.current!==null&&(S(r.current),r.current=null),t==null||t(c)},[t]),a=o.useCallback(c=>{r.current!==null&&(S(r.current),r.current=null),n==null||n(c)},[n]);return I.jsx("img",{...i,onLoad:s,onError:a})}Z.displayName="Img";const D=o.createContext({environment:"studio"});function ee({src:e,startFrom:t=0,endAt:n,volume:i=1,playbackRate:r=1,muted:s=!1,style:a,className:c,holdRenderTimeout:u=3e4,...m}){const p=o.useRef(null),h=o.useContext(R),x=o.useContext(N),C=o.useContext(V),{environment:f}=o.useContext(D),l=o.useRef(null),d=o.useRef(null),y=f==="rendering",w=(C==null?void 0:C.fps)??30,E=h.frame-x.accumulatedOffset,b=E+t,v=b/w;o.useEffect(()=>{const g=$(`Loading <Video> metadata for src="${e}"`,{timeoutInMilliseconds:u});return l.current=g,()=>{l.current!==null&&(S(l.current),l.current=null)}},[e,u]);const F=o.useCallback(()=>{l.current!==null&&(S(l.current),l.current=null)},[]),P=o.useCallback(()=>{l.current!==null&&(S(l.current),l.current=null)},[]);return o.useEffect(()=>{const g=p.current;g&&(g.volume=i,g.muted=s)},[i,s]),o.useEffect(()=>{const g=p.current;g&&(g.playbackRate=r)},[r]),o.useEffect(()=>{const g=p.current;if(g){if(n!==void 0&&b>=n){g.pause();return}if(y){if(g.pause(),d.current!==v){d.current=v;const M=$(`Seeking <Video> to ${v.toFixed(3)}s`,{timeoutInMilliseconds:u}),T=()=>{S(M),g.removeEventListener("seeked",T)};g.addEventListener("seeked",T),g.currentTime=v}}else Math.abs(g.currentTime-v)>.1&&(g.currentTime=v),h.playing&&g.paused?g.play().catch(()=>{}):!h.playing&&!g.paused&&g.pause()}},[E,y,v,h.playing,n,b,u]),I.jsx("video",{ref:p,src:e,preload:"auto",playsInline:!0,style:a,className:c,onLoadedMetadata:F,onError:P,...m})}ee.displayName="Video";function te({src:e,startFrom:t=0,endAt:n,volume:i=1,playbackRate:r=1,muted:s=!1}){const a=o.useRef(null),c=o.useContext(R),u=o.useContext(N),m=o.useContext(V),{environment:p}=o.useContext(D),h=p==="rendering",x=(m==null?void 0:m.fps)??30,C=c.frame-u.accumulatedOffset,f=C+t,l=f/x;return o.useEffect(()=>{if(h)return;const d=a.current;if(!d)return;if(d.volume=i,d.muted=s,d.playbackRate=r,n!==void 0&&f>=n){d.pause();return}Math.abs(d.currentTime-l)>.1&&(d.currentTime=l),c.playing&&d.paused?d.play().catch(()=>{}):!c.playing&&!d.paused&&d.pause()},[C,h,l,c.playing,i,s,r,n,f]),h?null:I.jsx("audio",{ref:a,src:e,preload:"auto"})}te.displayName="Audio";function ne({src:e,width:t,height:n,style:i,className:r,holdRenderTimeout:s=3e4}){const a=o.useRef(null),c=o.useContext(R),u=o.useContext(N),m=o.useContext(V),p=o.useRef([]),h=o.useRef(null),[x,C]=o.useState(!1),f=(m==null?void 0:m.fps)??30,l=c.frame-u.accumulatedOffset;return o.useEffect(()=>{const d=$(`Loading <AnimatedImage> frames from "${e}"`,{timeoutInMilliseconds:s});h.current=d;let y=!1;async function w(){try{const b=await(await fetch(e)).blob();if(typeof ImageDecoder<"u"){const v=new ImageDecoder({data:await b.arrayBuffer(),type:b.type});await v.tracks.ready;const F=v.tracks.selectedTrack;if(!F)throw new Error("No image track found");const P=F.frameCount,g=[];for(let M=0;M<P;M++){const T=await v.decode({frameIndex:M}),ie=await createImageBitmap(T.image),se=(T.image.duration??1e5)/1e3;g.push({image:ie,duration:se}),T.image.close()}v.close(),y||(p.current=g,C(!0))}else{const v=await createImageBitmap(b);y||(p.current=[{image:v,duration:1/0}],C(!0))}}catch(E){console.error("AnimatedImage: failed to decode frames",E)}finally{h.current!==null&&(S(h.current),h.current=null)}}return w(),()=>{y=!0,h.current!==null&&(S(h.current),h.current=null)}},[e,s]),o.useEffect(()=>{if(!x||p.current.length===0)return;const d=a.current;if(!d)return;const y=d.getContext("2d");if(!y)return;const w=p.current,E=l/f*1e3;let b=0;for(const M of w)b+=M.duration;if(b<=0)return;const v=(E%b+b)%b;let F=0,P=0;for(let M=0;M<w.length;M++)if(F+=w[M].duration,v<F){P=M;break}const g=w[P];g&&(d.width=t??g.image.width,d.height=n??g.image.height,y.clearRect(0,0,d.width,d.height),y.drawImage(g.image,0,0,d.width,d.height))},[l,f,x,t,n]),I.jsx("canvas",{ref:a,width:t,height:n,style:i,className:r})}ne.displayName="AnimatedImage";function re({holdRenderTimeout:e=3e4,onLoad:t,onError:n,...i}){const r=o.useRef(null);o.useEffect(()=>{const c=$(`Loading <IFrame> with src="${i.src}"`,{timeoutInMilliseconds:e});return r.current=c,()=>{r.current!==null&&(S(r.current),r.current=null)}},[i.src,e]);const s=o.useCallback(c=>{r.current!==null&&(S(r.current),r.current=null),t==null||t(c)},[t]),a=o.useCallback(c=>{r.current!==null&&(S(r.current),r.current=null),n==null||n(c)},[n]);return I.jsx("iframe",{...i,onLoad:s,onError:a})}re.displayName="IFrame";function Ce(e,t){for(let n=1;n<t.length;n++)if(e<=t[n])return n-1;return t.length-2}function H(e,t,n,i,r,s){let a;return t===n?a=0:a=(e-t)/(n-t),s&&(a=s(a)),i+a*(r-i)}function k(e,t,n,i){if(t.length!==n.length)throw new Error(`inputRange (${t.length}) and outputRange (${n.length}) must have the same length.`);if(t.length<2)throw new Error("inputRange and outputRange must have at least 2 elements.");for(let u=1;u<t.length;u++)if(t[u]<t[u-1])throw new Error("inputRange must be monotonically non-decreasing.");const{easing:r,extrapolateLeft:s="extend",extrapolateRight:a="extend"}=i??{};if(e<t[0])return s==="clamp"?n[0]:s==="identity"?e:H(e,t[0],t[1],n[0],n[1],r);if(e>t[t.length-1]){if(a==="clamp")return n[n.length-1];if(a==="identity")return e;const u=t.length-1;return H(e,t[u-1],t[u],n[u-1],n[u],r)}const c=Ce(e,t);return H(e,t[c],t[c+1],n[c],n[c+1],r)}function ye(e,t,n,i,r,s,a){const c=-i*(e-n),u=-r*t,m=(c+u)/s,p=t+m*a;return{position:e+p*a,velocity:p}}function oe(e){const{frame:t,fps:n,config:i={},from:r=0,to:s=1,durationInFrames:a,durationRestThreshold:c=.005}=e,{damping:u=10,mass:m=1,stiffness:p=100,clampOvershoot:h=!1}=i;if(t<0)return r;if(a!==void 0&&t>=a)return s;const x=1/n,C=4,f=x/C;let l=r,d=0;for(let y=0;y<t;y++){for(let w=0;w<C;w++){const E=ye(l,d,s,p,u,m,f);l=E.position,d=E.velocity}if(h&&(r<s?l=Math.min(l,s):l=Math.max(l,s),l===s&&(d=0)),Math.abs(l-s)<c&&Math.abs(d)<c)return s}return l}function xe(e){const{fps:t,config:n,from:i=0,to:r=1,threshold:s=.005}=e,a=t*60;for(let c=0;c<a;c++){const u=oe({frame:c,fps:t,config:n,from:i,to:r,durationRestThreshold:s});if(Math.abs(u-r)<s)return c}return a}function q(e,t,n,i){const r=3*e,s=3*(n-e)-r,a=1-r-s,c=3*t,u=3*(i-t)-c,m=1-c-u;function p(f){return((a*f+s)*f+r)*f}function h(f){return((m*f+u)*f+c)*f}function x(f){return(3*a*f+2*s)*f+r}function C(f){let l=f;for(let w=0;w<8;w++){const E=p(l)-f;if(Math.abs(E)<1e-7)return l;const b=x(l);if(Math.abs(b)<1e-7)break;l-=E/b}let d=0,y=1;for(l=f;d<y;){const w=p(l);if(Math.abs(w-f)<1e-7)return l;f>w?d=l:y=l,l=(d+y)/2}return l}return f=>f<=0?0:f>=1?1:h(C(f))}const we={linear:(e=>e),ease:q(.25,.1,.25,1),easeIn:q(.42,0,1,1),easeOut:q(0,0,.58,1),easeInOut:q(.42,0,.58,1),bezier:q,bounce:(e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375),elastic:(e=1)=>{const t=.3/Math.max(e,.001);return n=>n<=0?0:n>=1?1:Math.pow(2,-10*n)*Math.sin((n-t/4)*(2*Math.PI)/t)+1},in:e=>e,out:e=>t=>1-e(1-t),inOut:e=>t=>t<.5?e(t*2)/2:1-e((1-t)*2)/2};function W(e){let t=e.replace("#","");t.length===3&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),t.length===6&&(t+="ff");const n=parseInt(t,16);return[n>>24&255,n>>16&255,n>>8&255,(n&255)/255]}function U(e){const t=e.match(/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)/);if(t)return[Number(t[1]),Number(t[2]),Number(t[3]),t[4]!==void 0?Number(t[4]):1];throw new Error(`Cannot parse color: ${e}`)}const Y={black:"#000000",white:"#ffffff",red:"#ff0000",green:"#008000",blue:"#0000ff",yellow:"#ffff00",cyan:"#00ffff",magenta:"#ff00ff",orange:"#ffa500",purple:"#800080",pink:"#ffc0cb",gray:"#808080",grey:"#808080",transparent:"rgba(0,0,0,0)"};function be(e){const t=e.trim().toLowerCase();if(Y[t]){const n=Y[t];return n.startsWith("#")?W(n):U(n)}if(t.startsWith("#"))return W(t);if(t.startsWith("rgb"))return U(t);throw new Error(`Unsupported color format: ${e}`)}function ve(e){const[t,n,i,r]=e;return r===1?`rgb(${Math.round(t)}, ${Math.round(n)}, ${Math.round(i)})`:`rgba(${Math.round(t)}, ${Math.round(n)}, ${Math.round(i)}, ${Number(r.toFixed(3))})`}function Ie(e,t,n,i){if(t.length!==n.length)throw new Error("inputRange and outputRange must have the same length.");const r=n.map(be),s=k(e,t,r.map(m=>m[0]),i),a=k(e,t,r.map(m=>m[1]),i),c=k(e,t,r.map(m=>m[2]),i),u=k(e,t,r.map(m=>m[3]),i);return ve([Math.max(0,Math.min(255,s)),Math.max(0,Math.min(255,a)),Math.max(0,Math.min(255,c)),Math.max(0,Math.min(1,u))])}let A=null;function Ee(e){if(A!==null)throw new Error("setRootComponent() can only be called once.");A=e}function Me(){return A}function Se(e){return`/${e.startsWith("/")?e.slice(1):e}`}function Re(){return typeof window<"u"&&window.__RENDIV_INPUT_PROPS__?window.__RENDIV_INPUT_PROPS__:{}}function Ne(){const{environment:e}=o.useContext(D);return{isStudio:e==="studio",isRendering:e==="rendering",isPlayer:e==="player"}}function Fe(){if(typeof window<"u"){const e=window.__RENDIV_ENVIRONMENT__;return{isStudio:e==="studio",isRendering:e==="rendering",isPlayer:e==="player"}}return{isStudio:!1,isRendering:!1,isPlayer:!1}}const _e=o.createContext(null);exports.AnimatedImage=ne;exports.Audio=te;exports.Composition=le;exports.CompositionContext=V;exports.CompositionManagerContext=z;exports.Easing=we;exports.Fill=L;exports.Folder=G;exports.FolderContext=j;exports.Freeze=Q;exports.IFrame=re;exports.Img=Z;exports.Loop=K;exports.RendivEnvironmentContext=D;exports.Sequence=X;exports.SequenceContext=N;exports.Series=de;exports.Still=fe;exports.TimelineContext=R;exports.TimelineRegistryContext=_e;exports.Video=ee;exports.abortRender=he;exports.blendColors=Ie;exports.getInputProps=Re;exports.getPendingHoldCount=ge;exports.getPendingHoldLabels=pe;exports.getRendivEnvironment=Fe;exports.getRootComponent=Me;exports.getSpringDuration=xe;exports.holdRender=$;exports.interpolate=k;exports.releaseRender=S;exports.setRootComponent=Ee;exports.spring=oe;exports.staticFile=Se;exports.useCompositionConfig=ce;exports.useFrame=ae;exports.useRendivEnvironment=Ne;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { useFrame } from './hooks/use-frame';
|
|
2
|
+
export { useCompositionConfig } from './hooks/use-composition-config';
|
|
3
|
+
export { Composition, type CompositionProps } from './components/Composition';
|
|
4
|
+
export { Sequence, type SequenceProps } from './components/Sequence';
|
|
5
|
+
export { Fill } from './components/Fill';
|
|
6
|
+
export { Still, type StillProps } from './components/Still';
|
|
7
|
+
export { Folder, type FolderProps } from './components/Folder';
|
|
8
|
+
export { Series, type SeriesProps, type SeriesSequenceProps } from './components/Series';
|
|
9
|
+
export { Loop, type LoopProps } from './components/Loop';
|
|
10
|
+
export { Freeze, type FreezeProps } from './components/Freeze';
|
|
11
|
+
export { Img, type ImgProps } from './components/Img';
|
|
12
|
+
export { Video, type VideoProps } from './components/Video';
|
|
13
|
+
export { Audio, type AudioProps } from './components/Audio';
|
|
14
|
+
export { AnimatedImage, type AnimatedImageProps } from './components/AnimatedImage';
|
|
15
|
+
export { IFrame, type IFrameProps } from './components/IFrame';
|
|
16
|
+
export { interpolate, type InterpolateOptions, type ExtrapolationType } from './animation/interpolate';
|
|
17
|
+
export { spring, type SpringConfig, type SpringOptions } from './animation/spring';
|
|
18
|
+
export { getSpringDuration, type GetSpringDurationOptions } from './animation/measure-spring';
|
|
19
|
+
export { Easing, type EasingFunction } from './animation/easing';
|
|
20
|
+
export { blendColors } from './animation/interpolate-colors';
|
|
21
|
+
export { setRootComponent, getRootComponent } from './register-root';
|
|
22
|
+
export { staticFile } from './static-file';
|
|
23
|
+
export { getInputProps } from './get-input-props';
|
|
24
|
+
export { getRendivEnvironment, useRendivEnvironment } from './get-rendiv-environment';
|
|
25
|
+
export { holdRender, releaseRender, abortRender, getPendingHoldCount, getPendingHoldLabels, type HoldRenderOptions, } from './delay-render';
|
|
26
|
+
export { TimelineContext, type TimelineContextValue } from './context/TimelineContext';
|
|
27
|
+
export { CompositionContext, type CompositionConfig } from './context/CompositionContext';
|
|
28
|
+
export { SequenceContext, type SequenceContextValue } from './context/SequenceContext';
|
|
29
|
+
export { RendivEnvironmentContext, type RendivEnvironment, type RendivEnvironmentContextValue, } from './context/RendivEnvironmentContext';
|
|
30
|
+
export { CompositionManagerContext, type CompositionManagerContextValue, type CompositionEntry, type ResolveConfigFunction, } from './context/CompositionManagerContext';
|
|
31
|
+
export { FolderContext } from './context/FolderContext';
|
|
32
|
+
export { TimelineRegistryContext, type TimelineRegistryContextValue, type TimelineEntry, } from './context/TimelineRegistryContext';
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAGtE,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACvG,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACtF,OAAO,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EACL,wBAAwB,EACxB,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,GACnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,yBAAyB,EACzB,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,uBAAuB,EACvB,KAAK,4BAA4B,EACjC,KAAK,aAAa,GACnB,MAAM,mCAAmC,CAAC"}
|