@collective-intelligence/ui-react 0.1.8 → 0.1.9
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/README.md +52 -0
- package/THIRD-PARTY-NOTICES.md +104 -0
- package/dist/components/icons/index.js +1 -1
- package/dist/components/illustrations/index.js +1 -1
- package/dist/components/ui/index.js +2 -2
- package/dist/components/ui-extensions/atoms/ThemeToggle/index.js +1 -1
- package/dist/components/ui-extensions/hooks/use-mobile.js +1 -1
- package/dist/components/ui-extensions/index.js +5 -5
- package/dist/components/ui-extensions/molecules/VideoPlayer/index.d.ts +31 -0
- package/dist/components/ui-extensions/molecules/VideoPlayer/index.js +3 -0
- package/dist/hls.light-dtzc3f2q.js +27 -0
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/operations.js +1 -1
- package/dist/hooks/use-debounced-callback.js +1 -1
- package/dist/hooks/use-mount-action.js +1 -1
- package/dist/index-05xbt37f.js +6 -0
- package/dist/{index-1hg2mydq.js → index-1ckm293n.js} +2 -2
- package/dist/index-38vag578.js +2 -0
- package/dist/{index-k79cbjh7.js → index-38vsn5nv.js} +2 -2
- package/dist/index-3me0m2fg.js +2 -0
- package/dist/index-7z26q7c0.js +42 -0
- package/dist/index-c5j7wr0c.js +2 -0
- package/dist/{index-vs10z2rc.js → index-cxjzg167.js} +2 -2
- package/dist/{index-42q094m7.js → index-dhysnhdt.js} +2 -2
- package/dist/{index-9nkdbb33.js → index-dt6f1hvx.js} +2 -2
- package/dist/index-er3rvnn2.js +2 -0
- package/dist/{index-x6g6brsv.js → index-fwsd4nes.js} +2 -2
- package/dist/index-gzn19hjr.js +2 -0
- package/dist/index-jqw3cf33.js +2 -0
- package/dist/index-k2h122pf.js +2 -0
- package/dist/{index-24awe3d6.js → index-r4k327de.js} +2 -2
- package/dist/index-t67ch826.js +2 -0
- package/dist/{index-q2bgrvjz.js → index-vrj20h57.js} +2 -2
- package/dist/{index-ycc4mvy6.js → index-y2h3pwvb.js} +2 -2
- package/dist/index-zk28jg41.js +2 -0
- package/dist/index.js +1 -1
- package/dist/resources.js +1 -1
- package/dist/tokens/theme.js +1 -1
- package/dist/utils/cn.js +1 -1
- package/package.json +10 -2
- package/dist/index-1kd3e9cz.js +0 -2
- package/dist/index-75cf149h.js +0 -2
- package/dist/index-87bxrmfq.js +0 -42
- package/dist/index-ckt9z566.js +0 -2
- package/dist/index-db7hx21g.js +0 -2
- package/dist/index-prdzy412.js +0 -6
- package/dist/index-rgye3pe5.js +0 -2
- package/dist/index-s7dyqth2.js +0 -2
- package/dist/index-whabarfn.js +0 -2
- package/dist/index-z3yjnfyn.js +0 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
import { VideoHTMLAttributes } from 'react';
|
|
4
|
+
|
|
5
|
+
/** Returns the headers that authenticate one request to the API media route. */
|
|
6
|
+
export type RequestHeaders = () => Record<string, string> | Promise<Record<string, string>>;
|
|
7
|
+
export interface VideoPlayerProps extends Omit<VideoHTMLAttributes<HTMLVideoElement>, "className" | "src"> {
|
|
8
|
+
/** The Stable Media URL of a stored video. */
|
|
9
|
+
src: string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the headers that authenticate API media requests, for example a
|
|
12
|
+
* bearer token. They are sent only to URLs on the origin of `src` under its
|
|
13
|
+
* `/media/` path. Omit it to rely on the browser session cookie.
|
|
14
|
+
*/
|
|
15
|
+
requestHeaders?: RequestHeaders;
|
|
16
|
+
className?: string;
|
|
17
|
+
classes?: {
|
|
18
|
+
root?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Plays a Stable Media URL: adaptive HLS when the video's Renditions are
|
|
23
|
+
* ready, otherwise the stored file. The consumer supplies the credentials.
|
|
24
|
+
*/
|
|
25
|
+
declare const VideoPlayer: ({ src, requestHeaders, className, classes, ...videoProps }: VideoPlayerProps) => import("react").JSX.Element;
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
VideoPlayer as default,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{Nr,Jr}from"../../../../index-er3rvnn2.js";import{e}from"../../../../index-fwsd4nes.js";Jr(import.meta.url,["sdxweff1","dtzc3f2q","er3rvnn2","fwsd4nes"],[["./index.js",2,3],["../../../../hls.light-dtzc3f2q.js"],["../../../../index-er3rvnn2.js"],["../../../../index-fwsd4nes.js"]],0);
|
|
3
|
+
import{useEffect as h,useRef as H}from"react";var E=["application/vnd.apple.mpegurl","application/x-mpegurl"];var w={fetch:async(t,n)=>await globalThis.fetch(t,n),loadHls:async()=>{let{default:t}=await (Nr("dtzc3f2q"),import("../../../../hls.light-dtzc3f2q.js"));return t}},b=(t)=>{let n=new URL(t,document.baseURI),r=n.pathname.indexOf("/media/");if(r===-1)return;return{origin:n.origin,pathPrefix:n.pathname.slice(0,r+7),url:n}},f=(t,n)=>{let r=new URL(n,t.url);return r.origin===t.origin&&r.pathname.startsWith(t.pathPrefix)},u=(t)=>{let n=new URL(t.url);return n.searchParams.set("stream","hls"),n.href},m=(t)=>{let n=t.headers.get("content-type")?.toLowerCase()??"";return t.ok&&E.some((r)=>n.startsWith(r))},y=async(t)=>{try{await t.body?.cancel()}catch{}},L=async(t)=>{try{await t.play()}catch{}},g=(t,n,r,s)=>{let{signal:i,video:o}=n,a=!1,l,c=(d)=>{l=new t(d),l.on(t.Events.ERROR,(D,p)=>{if(a||p.details!==t.ErrorDetails.FRAG_LOAD_ERROR||p.response?.code!==403)return;a=!0;let S=!o.paused,v=o.currentTime;if(l.destroy(),c({startPosition:v,xhrSetup:s}),S)L(o)}),l.loadSource(r),l.attachMedia(o)};c({xhrSetup:s}),i.addEventListener("abort",()=>l.destroy(),{once:!0})},M=(t,n)=>async(r,s)=>{if(!f(t,s))return;let i=await n();if(r.readyState===r.UNSENT)r.open("GET",s,!0);for(let[o,a]of Object.entries(i))r.setRequestHeader(o,a)},P=(t)=>(n,r)=>{n.withCredentials=f(t,r)},T=async(t,n,r,s)=>{let i=async(l)=>{let c=await s.fetch(l,{credentials:"omit",headers:await n(),signal:t.signal});return y(c),t.signal.throwIfAborted(),c},o=u(r),a=await i(o);if(m(a)){let l=await s.loadHls();if(t.signal.throwIfAborted(),l.isSupported()){g(l,t,o,M(r,n));return}a=await i(t.src)}t.video.src=a.ok?a.url:t.src},x=async(t,n,r)=>{let s=u(n),i=await r.fetch(s,{credentials:"include",redirect:"manual",signal:t.signal});if(y(i),t.signal.throwIfAborted(),m(i)){let o=await r.loadHls();if(t.signal.throwIfAborted(),o.isSupported()){g(o,t,s,P(n));return}if(t.video.canPlayType("application/vnd.apple.mpegurl")!==""){t.video.src=s;return}}t.video.src=t.src},R=async(t,n=w)=>{let{requestHeaders:r,signal:s,src:i,video:o}=t;try{let a=b(i);if(a===void 0){o.src=i;return}await(r===void 0?x(t,a,n):T(t,r,a,n))}catch{if(!s.aborted)o.src=i}};import{jsx as A}from"react/jsx-runtime";var O=({src:t,requestHeaders:n,className:r,classes:s,...i})=>{let o=H(null),a=H(n),l=n!==void 0;return h(()=>{a.current=n},[n]),h(()=>{let c=o.current;if(c===null)return;let d=new AbortController;return R({requestHeaders:l?async()=>await a.current?.()??{}:void 0,signal:d.signal,src:t,video:c}),()=>d.abort()},[t,l]),A("video",{ref:o,className:e("block w-full",s?.root,r),...i})},C=O;export{C as default};
|