New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@samvera/bloom-iiif

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@samvera/bloom-iiif - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/index.cjs.js

@@ -1,2 +0,2 @@

var Pe=Object.create;var k=Object.defineProperty,Fe=Object.defineProperties,ze=Object.getOwnPropertyDescriptor,ke=Object.getOwnPropertyDescriptors,Ae=Object.getOwnPropertyNames,Y=Object.getOwnPropertySymbols,He=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var Z=(e,t,o)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,$=(e,t)=>{for(var o in t||(t={}))_.call(t,o)&&Z(e,o,t[o]);if(Y)for(var o of Y(t))Me.call(t,o)&&Z(e,o,t[o]);return e},T=(e,t)=>Fe(e,ke(t));var De=(e,t)=>{for(var o in t)k(e,o,{get:t[o],enumerable:!0})},ee=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ae(t))!_.call(e,n)&&n!==o&&k(e,n,{get:()=>t[n],enumerable:!(r=ze(t,n))||r.enumerable});return e};var f=(e,t,o)=>(o=e!=null?Pe(He(e)):{},ee(t||!e||!e.__esModule?k(o,"default",{value:e,enumerable:!0}):o,e)),Le=e=>ee(k({},"__esModule",{value:!0}),e);var Ke={};De(Ke,{default:()=>Je});module.exports=Le(Ke);var d=f(require("react"));var C=f(require("react")),te=require("@iiif/vault"),j={isLoaded:!1,itemHeight:void 0,vault:new te.Vault},oe=C.default.createContext(j),re=C.default.createContext(j);function Ne(e,t){switch(t.type){case"updateIsLoaded":return T($({},e),{isLoaded:t.isLoaded});case"updateItemHeight":return T($({},e),{itemHeight:t.itemHeight});default:throw new Error(`Unhandled action type: ${t.type}`)}}var ne=({initialState:e=j,children:t})=>{let[o,r]=(0,C.useReducer)(Ne,e);return C.default.createElement(oe.Provider,{value:o},C.default.createElement(re.Provider,{value:r},t))};function F(){let e=C.default.useContext(oe);if(e===void 0)throw new Error("useViewerState must be used within a ViewerProvider");return e}function ie(){let e=C.default.useContext(re);if(e===void 0)throw new Error("useViewerDispatch must be used within a ViewerProvider");return e}var c=f(require("react"));var l=f(require("react"));var m=f(require("react"));var ae=require("@stitches/react"),h=e=>1.618**e;var se={1:"0.382rem",2:"0.618rem",3:"1rem",4:"1.618rem",5:`calc(1rem * ${h(2)})`,6:`calc(1rem * ${h(3)})`,7:`calc(1rem * ${h(4)})`,8:`calc(1rem * ${h(5)})`,9:`calc(1rem * ${h(6)})`,10:`calc(1rem * ${h(7)})`,11:`calc(1rem * ${h(8)})`,12:`calc(1rem * ${h(9)})`},Be={colors:{primary:"#1a1d1e",primaryMuted:"#26292b",primaryAlt:"#151718",accent:"#006adc",accentMuted:"#5eb0ef",accentAlt:"#00254d",secondary:"#FFFFFF",secondaryMuted:"#e6e8eb",secondaryAlt:"#c1c8cd"},fonts:{sans:"'Inter', Arial, sans-serif",display:"'Calistoga', 'Inter', Arial, sans-serif"},fontSizes:{1:"0.611rem",2:"0.722rem",3:"0.833rem",4:"1rem",5:"1.177rem",6:"1.318rem",7:`calc(1rem * ${h(1)})`,8:`calc(1rem * ${h(2)})`,9:`calc(1rem * ${h(3)})`},sizes:$({},se),space:$({},se),transitions:{all:"all 250ms cubic-bezier(0.16, 1, 0.3, 1)",load:"all 1.25s cubic-bezier(0.16, 1, 0.3, 1)"}},Ee={xxs:"(max-width: 349px)",xs:"(max-width: 575px)",sm:"(max-width: 767px)",md:"(max-width: 991px)",xl:"(max-width: 1199px)",lg:"(min-width: 1200px)"},{styled:i,css:Ye,keyframes:Ze,createTheme:_e}=(0,ae.createStitches)({theme:Be,media:Ee});var O=i("div",{position:"absolute",width:"100%",backgroundColor:"green"}),H=i("figure",{display:"flex",flexDirection:"column",margin:"0 0 $2",flexGrow:"0",flexShrink:"0",borderRadius:"3px",img:{position:"absolute",display:"flex",flexDirection:"column",objectFit:"cover",zIndex:"0",width:"100%",height:"100%",color:"transparent"},video:{position:"absolute",display:"flex",flexDirection:"column",objectFit:"cover",zIndex:"1",width:"100%",height:"100%",color:"transparent",opacity:"0",transition:"$load",borderRadius:"3px"},figcaption:{display:"flex",flexDirection:"column",padding:"$2 0",color:"$primary",transition:"$load"},variants:{isFocused:{true:{margin:"-$2 -$2 0",video:{opacity:"1"},figcaption:{padding:"$2",color:"$accent"},[`& ${O}`]:{width:"calc(100% - ($2 * 2))"}}}}}),M=i("span",{display:"flex",position:"relative",backgroundColor:"$secondaryAlt",width:"100%",height:"100%",overflow:"hidden",borderRadius:"3px",boxShadow:"none",transition:"$all"}),ot=i("span",{fontSize:"$3",fontWeight:"700"}),rt=i("span",{fontSize:"$1",marginTop:"$1",color:"$primary"});var le=f(require("@radix-ui/react-aspect-ratio"));var D=require("@samvera/nectar-iiif"),Re=({label:e,thumbnail:t,index:o,isFocused:r})=>{let n=ie(),s=(0,m.useRef)(null);return(0,m.useEffect)(()=>{let x=new ResizeObserver(v=>{for(let u of v)if(u.contentBoxSize){let g=Array.isArray(u.contentBoxSize)?u.contentBoxSize[0]:u.contentBoxSize;n({type:"updateItemHeight",itemHeight:g.inlineSize})}});o===0&&s.current&&x.observe(s.current)},[o]),t[0].type==="ContentResource"?m.default.createElement(m.default.Fragment,null):m.default.createElement(H,{isFocused:r},m.default.createElement(le.Root,{ratio:1/1},m.default.createElement(O,{ref:s}),m.default.createElement(M,null,m.default.createElement(D.Thumbnail,{altAsLabel:e,css:{objectFit:"cover",width:"100%",height:"100%"},thumbnail:t}))),m.default.createElement("figcaption",null,m.default.createElement(D.Label,{label:e,css:{fontWeight:"700",fontSize:"$2"}})))},ce=Re;var V=i("a",{color:"black",textDecoration:"none"}),L=i("div",{position:"relative",width:"calc(100% / 4)",zIndex:"0",borderRadius:"3px",[`> ${V}:hover`]:{[`${H}`]:{boxShadow:"3px 3px 11px #0003"},[`${M}`]:{borderBottomLeftRadius:"0",borderBottomRightRadius:"0"}}});var a=f(require("react"));var me=i("div",{position:"absolute",zIndex:"2",left:"-$2",top:"-$2",width:"calc(100% + (0.618rem * 2))",opacity:"0",variants:{isFocused:{true:{opacity:"1"}}}}),de=i("div",{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end",zIndex:"1"}),ue=i("div",{display:"flex",justifyContent:"center",padding:"$2 $2 0",background:"linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%)",cursor:"default",button:{width:"$4",height:"$4",display:"flex",flexDirection:"column",textAlign:"center",justifyContent:"center",alignItems:"center",borderRadious:"100%",backgroundColor:"transparent",border:"none",cursor:"pointer","&:disabled":{opacity:"0.2"},svg:{width:"100%",fill:"$secondary",stroke:"$secondary",color:"$secondary"}}}),pe=i("div",{display:"flex",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.7)",color:"$secondaryAlt",fontSize:"$1",padding:"$1",cursor:"default"});var fe=f(require("@radix-ui/react-aspect-ratio"));var N=f(require("react")),B=()=>N.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},N.default.createElement("title",null,"Next"),N.default.createElement("path",{fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"70",d:"M268 112l144 144-144 144M392 256H100"}));var E=f(require("react")),R=()=>E.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},E.default.createElement("title",null,"Previous"),E.default.createElement("path",{fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"70",d:"M244 400L100 256l144-144M120 256h292"}));var Te=({activeCanvas:e,handleActiveCanvas:t,isFocused:o,manifest:r})=>{let[n,s]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),u=e+1,g=0;return r&&(g=r.items.length),(0,a.useEffect)(()=>{u<=1?s(!1):s(!0),u>=g?v(!1):v(!0)},[e,r]),a.default.createElement(me,{isFocused:o},a.default.createElement(fe.Root,{ratio:1/1},r&&a.default.createElement(de,null,a.default.createElement(ue,{onClick:p=>p.preventDefault()},a.default.createElement("button",{onClick:()=>t(-1),disabled:!n},a.default.createElement(R,null)),a.default.createElement("button",{onClick:()=>t(1),disabled:!x},a.default.createElement(B,null))),a.default.createElement(pe,{onClick:p=>p.preventDefault()},u," of ",g))))},he=Te;var ge=(e,t)=>{if(e.thumbnail.length!==0)return e.thumbnail;let o=t.get(e.items[0]);return t.get(o.items[0]).body};var je=({index:e,item:t})=>{var K;let o=F(),{vault:r}=o,[n,s]=(0,l.useState)(!1),[x,v]=(0,l.useState)(0),[u,g]=(0,l.useState)(t.thumbnail),[p,y]=(0,l.useState)(),[S,Se]=(0,l.useState)(t.id);(0,l.useEffect)(()=>{n&&setTimeout(()=>{p||r.loadManifest(t.id).then(w=>y(w)).catch(w=>{console.error(`Manifest failed to load: ${w}`)})},1e3)},[n]),(0,l.useEffect)(()=>{let w=r.get(t.thumbnail);g(w)},[]);let G=()=>s(!0),U=()=>s(!1),q=w=>{if(!p)return;let Q=x+w,X=r.get(p.items[Q]),we=ge(X,r),Ie=r.get(we);Se(X.id),g(Ie),v(Q)};(0,l.useEffect)(()=>{p&&q(0)},[p]);let J;return((K=t.homepage)==null?void 0:K.length)>0&&(J=t.homepage[0].id),l.default.createElement(L,null,l.default.createElement(V,{href:J,tabIndex:0,onFocus:G,onBlur:U,onMouseEnter:G,onMouseLeave:U},l.default.createElement(ce,{key:S,label:t.label,thumbnail:u,index:e,isFocused:n}),l.default.createElement(he,{manifest:p,activeCanvas:x,handleActiveCanvas:q,isFocused:n})))},be=je;var xe=i("div",{position:"relative",display:"flex",flexDirection:"row",[`> ${L}`]:{marginRight:"$4","&:last-child":{marginRight:"0"}}});var z=f(require("react"));var A=i("div",{position:"absolute",background:"black",borderRadius:"3px",opacity:"0",transition:"$all"}),I=i("div",{position:"absolute",display:"flex",flexDirection:"column",width:"$4",height:"$4",borderRadius:"100%",backgroundColor:"white",justifyContent:"center",textAlign:"center",alignItems:"center",boxShadow:"none",transform:"none",transition:"$all",svg:{display:"flex",width:"$3",height:"$3",fill:"$primary",stroke:"$primary",color:"$primary",transition:"$all"}}),Ce=i("button",{position:"absolute",height:"100%",zIndex:"1",border:"none",cursor:"pointer",background:"transparent",["&:disabled"]:{opacity:"0",transform:"scale(0)"},["&:hover"]:{[`> ${A}`]:{opacity:1},[`> ${I}`]:{boxShadow:"3px 3px 11px #0003",svg:{fill:"$accent",stroke:"$accent",color:"$accent"}}},variants:{value:{next:{left:"unset",right:"0",[`> ${A}`]:{left:"unset",right:"0",top:"0",background:"linear-gradient(270deg, rgba(0,0,0,0.7) 38.2%, rgba(0,0,0,0) 98%)"},[`> ${I}`]:{right:"calc(-$4 / 2)",marginTop:"calc(-$4 / 2)"},[`&:hover > ${I}`]:{marginRight:"$1"}},previous:{left:"0",right:"unset",[`> ${A}`]:{left:"0",right:"unset",top:"0",background:"linear-gradient(90deg, rgba(0,0,0,0.7) 38.2%, rgba(0,0,0,0) 98%)"},[`> ${I}`]:{left:"calc(-$4 / 2)",marginTop:"calc(-$4 / 2)"},[`&:hover > ${I}`]:{marginLeft:"$1"}}}}});var Oe=({disabled:e,handleControl:t,height:o,increment:r,label:n})=>{let s=o*.382;return z.default.createElement(Ce,{"aria-label":n,direction:n,onClick:()=>t(r),style:{height:`${o}px`,width:`${s}px`},disabled:e,value:n},z.default.createElement(A,{style:{height:`${o}px`,width:`${s}px`}}),z.default.createElement(I,null,n==="next"&&z.default.createElement(B,null),n==="previous"&&z.default.createElement(R,null)))},W=Oe;var Ve=({items:e})=>{let t=F(),{itemHeight:o}=t,[r,n]=(0,c.useState)([0,1,2,3,4]),[s,x]=(0,c.useState)(!1),[v,u]=(0,c.useState)(!1),g=(0,c.useRef)(null);(0,c.useEffect)(()=>{!e||(r.includes(0)?x(!1):x(!0),r.includes(e.length-1)?u(!1):u(!0))},[r]);let p=y=>{n(r.map(S=>S+y))};return c.default.createElement(xe,{ref:g},o&&c.default.createElement(c.default.Fragment,null,c.default.createElement(W,{increment:-1,label:"previous",handleControl:p,height:o,disabled:!s}),c.default.createElement(W,{increment:1,label:"next",handleControl:p,height:o,disabled:!v})),e.filter((y,S)=>{if(r.includes(S))return y}).map((y,S)=>c.default.createElement(be,{index:S,item:y,key:y.id})))},ve=Ve;var b=f(require("react"));var ye=i("div",{display:"flex",flexDirection:"column",paddingBottom:"$4",margin:"0",color:"$primary",lineHeight:"1.4em",".bloom-header-homepage":{color:"$accent",textDecoration:"none"},".bloom-header-label":{fontSize:"$6",fontWeight:"400",fontFamily:"$display"},".bloom-header-summary":{fontSize:"$4",marginTop:"$2"}});var P=require("@samvera/nectar-iiif"),We=({label:e,summary:t,homepage:o})=>{let[r,n]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{o.length>0&&n(!0)},[o]),b.default.createElement(ye,null,r?b.default.createElement(P.Homepage,{homepage:o,className:"bloom-header-homepage"},b.default.createElement(P.Label,{label:e,as:"span",className:"bloom-header-label"})):b.default.createElement(P.Label,{label:e,as:"span",className:"bloom-header-label"}),t&&b.default.createElement(P.Summary,{summary:t,as:"span",className:"bloom-header-summary"}))},$e=We;var Ge=e=>d.default.createElement(ne,null,d.default.createElement(Ue,$({},e))),Ue=({collectionId:e})=>{let t=F(),{vault:o}=t,[r,n]=(0,d.useState)();return(0,d.useEffect)(()=>{o.loadCollection(e).then(s=>n(s)).catch(s=>{console.error(`Collection failed to load: ${s}`)}).finally(()=>{})},[]),!r||!r.items?(console.log(`The IIIF Collection ${e} failed to load.`),d.default.createElement(d.default.Fragment,null)):r.items.length===0?(console.log(`The IIIF collection ${e} does not contain items.`),d.default.createElement(d.default.Fragment,null)):d.default.createElement(qe,null,d.default.createElement($e,{label:r.label,summary:r.summary,homepage:r.homepage}),d.default.createElement(ve,{items:r.items}))},qe=i("div",{padding:"$4 0"}),Je=Ge;
var Pe=Object.create;var z=Object.defineProperty,Fe=Object.defineProperties,ze=Object.getOwnPropertyDescriptor,ke=Object.getOwnPropertyDescriptors,Ae=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,He=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable;var Y=(e,t,o)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,$=(e,t)=>{for(var o in t||(t={}))Z.call(t,o)&&Y(e,o,t[o]);if(X)for(var o of X(t))Me.call(t,o)&&Y(e,o,t[o]);return e},R=(e,t)=>Fe(e,ke(t));var Le=(e,t)=>{for(var o in t)z(e,o,{get:t[o],enumerable:!0})},_=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ae(t))!Z.call(e,n)&&n!==o&&z(e,n,{get:()=>t[n],enumerable:!(r=ze(t,n))||r.enumerable});return e};var p=(e,t,o)=>(o=e!=null?Pe(He(e)):{},_(t||!e||!e.__esModule?z(o,"default",{value:e,enumerable:!0}):o,e)),De=e=>_(z({},"__esModule",{value:!0}),e);var Ke={};Le(Ke,{default:()=>Je});module.exports=De(Ke);var u=p(require("react"));var v=p(require("react")),ee=require("@iiif/vault"),T={isLoaded:!1,itemHeight:void 0,vault:new ee.Vault},te=v.default.createContext(T),oe=v.default.createContext(T);function Ne(e,t){switch(t.type){case"updateIsLoaded":return R($({},e),{isLoaded:t.isLoaded});case"updateItemHeight":return R($({},e),{itemHeight:t.itemHeight});default:throw new Error(`Unhandled action type: ${t.type}`)}}var re=({initialState:e=T,children:t})=>{let[o,r]=(0,v.useReducer)(Ne,e);return v.default.createElement(te.Provider,{value:o},v.default.createElement(oe.Provider,{value:r},t))};function F(){let e=v.default.useContext(te);if(e===void 0)throw new Error("useViewerState must be used within a ViewerProvider");return e}function ne(){let e=v.default.useContext(oe);if(e===void 0)throw new Error("useViewerDispatch must be used within a ViewerProvider");return e}var m=p(require("react"));var d=p(require("react"));var l=p(require("react"));var se=require("@stitches/react"),g=e=>1.618**e;var ie={1:"0.382rem",2:"0.618rem",3:"1rem",4:"1.618rem",5:`calc(1rem * ${g(2)})`,6:`calc(1rem * ${g(3)})`,7:`calc(1rem * ${g(4)})`,8:`calc(1rem * ${g(5)})`,9:`calc(1rem * ${g(6)})`,10:`calc(1rem * ${g(7)})`,11:`calc(1rem * ${g(8)})`,12:`calc(1rem * ${g(9)})`},Be={colors:{primary:"#1a1d1e",primaryMuted:"#26292b",primaryAlt:"#151718",accent:"#006adc",accentMuted:"#5eb0ef",accentAlt:"#00254d",secondary:"#FFFFFF",secondaryMuted:"#e6e8eb",secondaryAlt:"#c1c8cd"},fonts:{sans:"'Inter', Arial, sans-serif",display:"'Calistoga', 'Inter', Arial, sans-serif"},fontSizes:{1:"0.611rem",2:"0.722rem",3:"0.833rem",4:"1rem",5:"1.177rem",6:"1.318rem",7:`calc(1rem * ${g(1)})`,8:`calc(1rem * ${g(2)})`,9:`calc(1rem * ${g(3)})`},sizes:$({},ie),space:$({},ie),transitions:{all:"all 250ms cubic-bezier(0.16, 1, 0.3, 1)",load:"all 1.25s cubic-bezier(0.16, 1, 0.3, 1)"}},Ee={xxs:"(max-width: 349px)",xs:"(max-width: 575px)",sm:"(max-width: 767px)",md:"(max-width: 991px)",xl:"(max-width: 1199px)",lg:"(min-width: 1200px)"},{styled:i,css:Ye,keyframes:Ze,createTheme:_e}=(0,se.createStitches)({theme:Be,media:Ee});var j=i("div",{position:"absolute",width:"100%",backgroundColor:"green"}),A=i("figure",{display:"flex",flexDirection:"column",margin:"0 0 $2",flexGrow:"0",flexShrink:"0",borderRadius:"3px",img:{position:"absolute",display:"flex",flexDirection:"column",objectFit:"cover",zIndex:"0",width:"100%",height:"100%",color:"transparent"},video:{position:"absolute",display:"flex",flexDirection:"column",objectFit:"cover",zIndex:"1",width:"100%",height:"100%",color:"transparent",opacity:"0",transition:"$load",borderRadius:"3px"},figcaption:{display:"flex",flexDirection:"column",padding:"$2 0",color:"$primary",transition:"$load"},variants:{isFocused:{true:{margin:"-$2 -$2 0",video:{opacity:"1"},figcaption:{padding:"$2",color:"$accent"},[`& ${j}`]:{width:"calc(100% - ($2 * 2))"}}}}}),H=i("span",{display:"flex",position:"relative",backgroundColor:"$secondaryAlt",width:"100%",height:"100%",overflow:"hidden",borderRadius:"3px",boxShadow:"none",transition:"$all"}),ot=i("span",{fontSize:"$3",fontWeight:"700"}),rt=i("span",{fontSize:"$1",marginTop:"$1",color:"$primary"});var ae=p(require("@radix-ui/react-aspect-ratio"));var M=require("@samvera/nectar-iiif"),Re=({label:e,thumbnail:t,index:o,isFocused:r})=>{let n=ne(),[a,y]=(0,l.useState)(!1),f=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let x=new ResizeObserver(h=>{for(let s of h)if(s.contentBoxSize){let C=Array.isArray(s.contentBoxSize)?s.contentBoxSize[0]:s.contentBoxSize;n({type:"updateItemHeight",itemHeight:C.inlineSize})}});o===0&&f.current&&x.observe(f.current)},[o,a]),t[0].type==="ContentResource"?l.default.createElement(l.default.Fragment,null):l.default.createElement(A,{isFocused:r},l.default.createElement(ae.Root,{ratio:1/1},l.default.createElement(j,{ref:f}),l.default.createElement(H,null,l.default.createElement(M.Thumbnail,{altAsLabel:e,css:{objectFit:"cover",width:"100%",height:"100%"},onLoad:()=>y(!0),thumbnail:t}))),l.default.createElement("figcaption",null,l.default.createElement(M.Label,{label:e,css:{fontWeight:"700",fontSize:"$2"}})))},le=Re;var O=i("a",{color:"black",textDecoration:"none"}),L=i("div",{position:"relative",width:"calc(100% / 4)",zIndex:"0",borderRadius:"3px",[`> ${O}:hover`]:{[`${A}`]:{boxShadow:"3px 3px 11px #0003"},[`${H}`]:{borderBottomLeftRadius:"0",borderBottomRightRadius:"0"}}});var c=p(require("react"));var ce=i("div",{position:"absolute",zIndex:"2",left:"-$2",top:"-$2",width:"calc(100% + (0.618rem * 2))",opacity:"0",variants:{isFocused:{true:{opacity:"1"}}}}),de=i("div",{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end",zIndex:"1"}),me=i("div",{display:"flex",justifyContent:"center",padding:"$2 $2 0",background:"linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%)",cursor:"default",button:{width:"$4",height:"$4",display:"flex",flexDirection:"column",textAlign:"center",justifyContent:"center",alignItems:"center",borderRadious:"100%",backgroundColor:"transparent",border:"none",cursor:"pointer","&:disabled":{opacity:"0.2"},svg:{width:"100%",fill:"$secondary",stroke:"$secondary",color:"$secondary"}}}),ue=i("div",{display:"flex",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.7)",color:"$secondaryAlt",fontSize:"$1",padding:"$1",cursor:"default"});var pe=p(require("@radix-ui/react-aspect-ratio"));var D=p(require("react")),N=()=>D.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},D.default.createElement("title",null,"Next"),D.default.createElement("path",{fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"70",d:"M268 112l144 144-144 144M392 256H100"}));var B=p(require("react")),E=()=>B.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},B.default.createElement("title",null,"Previous"),B.default.createElement("path",{fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"70",d:"M244 400L100 256l144-144M120 256h292"}));var Te=({activeCanvas:e,handleActiveCanvas:t,isFocused:o,manifest:r})=>{let[n,a]=(0,c.useState)(!1),[y,f]=(0,c.useState)(!1),x=e+1,h=0;return r&&(h=r.items.length),(0,c.useEffect)(()=>{x<=1?a(!1):a(!0),x>=h?f(!1):f(!0)},[e,r]),c.default.createElement(ce,{isFocused:o},c.default.createElement(pe.Root,{ratio:1/1},r&&c.default.createElement(de,null,c.default.createElement(me,{onClick:s=>s.preventDefault()},c.default.createElement("button",{onClick:()=>t(-1),disabled:!n},c.default.createElement(E,null)),c.default.createElement("button",{onClick:()=>t(1),disabled:!y},c.default.createElement(N,null))),c.default.createElement(ue,{onClick:s=>s.preventDefault()},x," of ",h))))},fe=Te;var he=(e,t)=>{if(e.thumbnail.length!==0)return e.thumbnail;let o=t.get(e.items[0]);return t.get(o.items[0]).body};var je=({index:e,item:t})=>{var J;let o=F(),{vault:r}=o,[n,a]=(0,d.useState)(!1),[y,f]=(0,d.useState)(0),[x,h]=(0,d.useState)(t.thumbnail),[s,C]=(0,d.useState)(),[$e,Se]=(0,d.useState)(t.id);(0,d.useEffect)(()=>{n&&setTimeout(()=>{s||r.loadManifest(t.id).then(w=>C(w)).catch(w=>{console.error(`Manifest failed to load: ${w}`)})},1e3)},[n]),(0,d.useEffect)(()=>{let w=r.get(t.thumbnail);h(w)},[]);let V=()=>a(!0),G=()=>a(!1),U=w=>{if(!s)return;let K=y+w,Q=r.get(s.items[K]),we=he(Q,r),Ie=r.get(we);Se(Q.id),h(Ie),f(K)};(0,d.useEffect)(()=>{s&&U(0)},[s]);let q;return((J=t.homepage)==null?void 0:J.length)>0&&(q=t.homepage[0].id),d.default.createElement(L,null,d.default.createElement(O,{href:q,tabIndex:0,onFocus:V,onBlur:G,onMouseEnter:V,onMouseLeave:G},d.default.createElement(le,{key:$e,label:t.label,thumbnail:x,index:e,isFocused:n}),d.default.createElement(fe,{manifest:s,activeCanvas:y,handleActiveCanvas:U,isFocused:n})))},ge=je;var be=i("div",{position:"relative",display:"flex",flexDirection:"row",[`> ${L}`]:{marginRight:"$4","&:last-child":{marginRight:"0"}}});var S=p(require("react"));var k=i("div",{position:"absolute",background:"black",borderRadius:"3px",opacity:"0",transition:"$all"}),I=i("div",{position:"absolute",display:"flex",flexDirection:"column",width:"$4",height:"$4",borderRadius:"100%",backgroundColor:"white",justifyContent:"center",textAlign:"center",alignItems:"center",boxShadow:"none",transform:"none",transition:"$all",svg:{display:"flex",width:"$3",height:"$3",fill:"$primary",stroke:"$primary",color:"$primary",transition:"$all"}}),xe=i("button",{position:"absolute",height:"100%",zIndex:"1",border:"none",cursor:"pointer",background:"transparent",["&:disabled"]:{opacity:"0",transform:"scale(0)"},["&:hover"]:{[`> ${k}`]:{opacity:1},[`> ${I}`]:{boxShadow:"3px 3px 11px #0003",svg:{fill:"$accent",stroke:"$accent",color:"$accent"}}},variants:{value:{next:{left:"unset",right:"0",[`> ${k}`]:{left:"unset",right:"0",top:"0",background:"linear-gradient(270deg, rgba(0,0,0,0.7) 38.2%, rgba(0,0,0,0) 98%)"},[`> ${I}`]:{right:"calc(-$4 / 2)",marginTop:"calc(-$4 / 2)"},[`&:hover > ${I}`]:{marginRight:"$1"}},previous:{left:"0",right:"unset",[`> ${k}`]:{left:"0",right:"unset",top:"0",background:"linear-gradient(90deg, rgba(0,0,0,0.7) 38.2%, rgba(0,0,0,0) 98%)"},[`> ${I}`]:{left:"calc(-$4 / 2)",marginTop:"calc(-$4 / 2)"},[`&:hover > ${I}`]:{marginLeft:"$1"}}}}});var Oe=({disabled:e,handleControl:t,height:o,increment:r,label:n})=>{let a=o*.382;return S.default.createElement(S.default.Fragment,null,S.default.createElement(xe,{"aria-label":n,direction:n,onClick:()=>t(r),style:{height:`${o}px`,width:`${a}px`},disabled:e,value:n},S.default.createElement(k,{style:{height:`${o}px`,width:`${a}px`}}),S.default.createElement(I,null,n==="next"&&S.default.createElement(N,null),n==="previous"&&S.default.createElement(E,null))))},W=Oe;var We=({items:e})=>{let{itemHeight:t}=F(),[o,r]=(0,m.useState)([0,1,2,3,4]),[n,a]=(0,m.useState)(!1),[y,f]=(0,m.useState)(!1),x=(0,m.useRef)(null);(0,m.useEffect)(()=>{!e||(o.includes(0)?a(!1):a(!0),o.includes(e.length-1)?f(!1):f(!0))},[o]);let h=s=>{r(o.map(C=>C+s))};return m.default.createElement(be,{ref:x},t&&m.default.createElement(m.default.Fragment,null,m.default.createElement(W,{increment:-1,label:"previous",handleControl:h,height:t,disabled:!n}),m.default.createElement(W,{increment:1,label:"next",handleControl:h,height:t,disabled:!y})),e.filter((s,C)=>{if(o.includes(C))return s}).map((s,C)=>m.default.createElement(ge,{index:C,item:s,key:s.id})))},Ce=We;var b=p(require("react"));var ve=i("div",{display:"flex",flexDirection:"column",paddingBottom:"$4",margin:"0",color:"$primary",lineHeight:"1.4em",".bloom-header-homepage":{color:"$accent",textDecoration:"none"},".bloom-header-label":{fontSize:"$6",fontWeight:"400",fontFamily:"$display"},".bloom-header-summary":{fontSize:"$4",marginTop:"$2"}});var P=require("@samvera/nectar-iiif"),Ve=({label:e,summary:t,homepage:o})=>{let[r,n]=(0,b.useState)(!1);return(0,b.useEffect)(()=>{o.length>0&&n(!0)},[o]),b.default.createElement(ve,null,r?b.default.createElement(P.Homepage,{homepage:o,className:"bloom-header-homepage"},b.default.createElement(P.Label,{label:e,as:"span",className:"bloom-header-label"})):b.default.createElement(P.Label,{label:e,as:"span",className:"bloom-header-label"}),t&&b.default.createElement(P.Summary,{summary:t,as:"span",className:"bloom-header-summary"}))},ye=Ve;var Ge=e=>u.default.createElement(re,null,u.default.createElement(Ue,$({},e))),Ue=({collectionId:e})=>{let t=F(),{vault:o}=t,[r,n]=(0,u.useState)();return(0,u.useEffect)(()=>{o.loadCollection(e).then(a=>n(a)).catch(a=>{console.error(`Collection failed to load: ${a}`)}).finally(()=>{})},[]),!r||!r.items?(console.log(`The IIIF Collection ${e} failed to load.`),u.default.createElement(u.default.Fragment,null)):r.items.length===0?(console.log(`The IIIF collection ${e} does not contain items.`),u.default.createElement(u.default.Fragment,null)):u.default.createElement(qe,null,u.default.createElement(ye,{label:r.label,summary:r.summary,homepage:r.homepage}),u.default.createElement(Ce,{items:r.items}))},qe=i("div",{padding:"$4 0"}),Je=Ge;
//# sourceMappingURL=index.cjs.js.map

@@ -1,2 +0,2 @@

var Se=Object.defineProperty,we=Object.defineProperties;var Ie=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable;var Y=(e,t,o)=>t in e?Se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,b=(e,t)=>{for(var o in t||(t={}))Pe.call(t,o)&&Y(e,o,t[o]);if(X)for(var o of X(t))Fe.call(t,o)&&Y(e,o,t[o]);return e},L=(e,t)=>we(e,Ie(t));import f,{useEffect as Ye,useState as Ze}from"react";import y,{useReducer as ze}from"react";import{Vault as ke}from"@iiif/vault";var N={isLoaded:!1,itemHeight:void 0,vault:new ke},Z=y.createContext(N),_=y.createContext(N);function Ae(e,t){switch(t.type){case"updateIsLoaded":return L(b({},e),{isLoaded:t.isLoaded});case"updateItemHeight":return L(b({},e),{itemHeight:t.itemHeight});default:throw new Error(`Unhandled action type: ${t.type}`)}}var ee=({initialState:e=N,children:t})=>{let[o,r]=ze(Ae,e);return y.createElement(Z.Provider,{value:o},y.createElement(_.Provider,{value:r},t))};function $(){let e=y.useContext(Z);if(e===void 0)throw new Error("useViewerState must be used within a ViewerProvider");return e}function te(){let e=y.useContext(_);if(e===void 0)throw new Error("useViewerDispatch must be used within a ViewerProvider");return e}import S,{useEffect as We,useState as V,useRef as Ge}from"react";import D,{useEffect as j,useState as w}from"react";import u,{useEffect as Le,useRef as Ne}from"react";import{createStitches as He}from"@stitches/react";var c=e=>1.618**e;var oe={1:"0.382rem",2:"0.618rem",3:"1rem",4:"1.618rem",5:`calc(1rem * ${c(2)})`,6:`calc(1rem * ${c(3)})`,7:`calc(1rem * ${c(4)})`,8:`calc(1rem * ${c(5)})`,9:`calc(1rem * ${c(6)})`,10:`calc(1rem * ${c(7)})`,11:`calc(1rem * ${c(8)})`,12:`calc(1rem * ${c(9)})`},Me={colors:{primary:"#1a1d1e",primaryMuted:"#26292b",primaryAlt:"#151718",accent:"#006adc",accentMuted:"#5eb0ef",accentAlt:"#00254d",secondary:"#FFFFFF",secondaryMuted:"#e6e8eb",secondaryAlt:"#c1c8cd"},fonts:{sans:"'Inter', Arial, sans-serif",display:"'Calistoga', 'Inter', Arial, sans-serif"},fontSizes:{1:"0.611rem",2:"0.722rem",3:"0.833rem",4:"1rem",5:"1.177rem",6:"1.318rem",7:`calc(1rem * ${c(1)})`,8:`calc(1rem * ${c(2)})`,9:`calc(1rem * ${c(3)})`},sizes:b({},oe),space:b({},oe),transitions:{all:"all 250ms cubic-bezier(0.16, 1, 0.3, 1)",load:"all 1.25s cubic-bezier(0.16, 1, 0.3, 1)"}},De={xxs:"(max-width: 349px)",xs:"(max-width: 575px)",sm:"(max-width: 767px)",md:"(max-width: 991px)",xl:"(max-width: 1199px)",lg:"(min-width: 1200px)"},{styled:n,css:at,keyframes:lt,createTheme:ct}=He({theme:Me,media:De});var B=n("div",{position:"absolute",width:"100%",backgroundColor:"green"}),z=n("figure",{display:"flex",flexDirection:"column",margin:"0 0 $2",flexGrow:"0",flexShrink:"0",borderRadius:"3px",img:{position:"absolute",display:"flex",flexDirection:"column",objectFit:"cover",zIndex:"0",width:"100%",height:"100%",color:"transparent"},video:{position:"absolute",display:"flex",flexDirection:"column",objectFit:"cover",zIndex:"1",width:"100%",height:"100%",color:"transparent",opacity:"0",transition:"$load",borderRadius:"3px"},figcaption:{display:"flex",flexDirection:"column",padding:"$2 0",color:"$primary",transition:"$load"},variants:{isFocused:{true:{margin:"-$2 -$2 0",video:{opacity:"1"},figcaption:{padding:"$2",color:"$accent"},[`& ${B}`]:{width:"calc(100% - ($2 * 2))"}}}}}),k=n("span",{display:"flex",position:"relative",backgroundColor:"$secondaryAlt",width:"100%",height:"100%",overflow:"hidden",borderRadius:"3px",boxShadow:"none",transition:"$all"}),ut=n("span",{fontSize:"$3",fontWeight:"700"}),pt=n("span",{fontSize:"$1",marginTop:"$1",color:"$primary"});import*as re from"@radix-ui/react-aspect-ratio";import{Label as Be,Thumbnail as Ee}from"@samvera/nectar-iiif";var Re=({label:e,thumbnail:t,index:o,isFocused:r})=>{let i=te(),s=Ne(null);return Le(()=>{let d=new ResizeObserver(h=>{for(let a of h)if(a.contentBoxSize){let m=Array.isArray(a.contentBoxSize)?a.contentBoxSize[0]:a.contentBoxSize;i({type:"updateItemHeight",itemHeight:m.inlineSize})}});o===0&&s.current&&d.observe(s.current)},[o]),t[0].type==="ContentResource"?u.createElement(u.Fragment,null):u.createElement(z,{isFocused:r},u.createElement(re.Root,{ratio:1/1},u.createElement(B,{ref:s}),u.createElement(k,null,u.createElement(Ee,{altAsLabel:e,css:{objectFit:"cover",width:"100%",height:"100%"},thumbnail:t}))),u.createElement("figcaption",null,u.createElement(Be,{label:e,css:{fontWeight:"700",fontSize:"$2"}})))},ne=Re;var E=n("a",{color:"black",textDecoration:"none"}),A=n("div",{position:"relative",width:"calc(100% / 4)",zIndex:"0",borderRadius:"3px",[`> ${E}:hover`]:{[`${z}`]:{boxShadow:"3px 3px 11px #0003"},[`${k}`]:{borderBottomLeftRadius:"0",borderBottomRightRadius:"0"}}});import p,{useEffect as Te,useState as ce}from"react";var ie=n("div",{position:"absolute",zIndex:"2",left:"-$2",top:"-$2",width:"calc(100% + (0.618rem * 2))",opacity:"0",variants:{isFocused:{true:{opacity:"1"}}}}),se=n("div",{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end",zIndex:"1"}),ae=n("div",{display:"flex",justifyContent:"center",padding:"$2 $2 0",background:"linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%)",cursor:"default",button:{width:"$4",height:"$4",display:"flex",flexDirection:"column",textAlign:"center",justifyContent:"center",alignItems:"center",borderRadious:"100%",backgroundColor:"transparent",border:"none",cursor:"pointer","&:disabled":{opacity:"0.2"},svg:{width:"100%",fill:"$secondary",stroke:"$secondary",color:"$secondary"}}}),le=n("div",{display:"flex",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.7)",color:"$secondaryAlt",fontSize:"$1",padding:"$1",cursor:"default"});import*as me from"@radix-ui/react-aspect-ratio";import R from"react";var H=()=>R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},R.createElement("title",null,"Next"),R.createElement("path",{fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"70",d:"M268 112l144 144-144 144M392 256H100"}));import T from"react";var M=()=>T.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},T.createElement("title",null,"Previous"),T.createElement("path",{fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"70",d:"M244 400L100 256l144-144M120 256h292"}));var je=({activeCanvas:e,handleActiveCanvas:t,isFocused:o,manifest:r})=>{let[i,s]=ce(!1),[d,h]=ce(!1),a=e+1,m=0;return r&&(m=r.items.length),Te(()=>{a<=1?s(!1):s(!0),a>=m?h(!1):h(!0)},[e,r]),p.createElement(ie,{isFocused:o},p.createElement(me.Root,{ratio:1/1},r&&p.createElement(se,null,p.createElement(ae,{onClick:l=>l.preventDefault()},p.createElement("button",{onClick:()=>t(-1),disabled:!i},p.createElement(M,null)),p.createElement("button",{onClick:()=>t(1),disabled:!d},p.createElement(H,null))),p.createElement(le,{onClick:l=>l.preventDefault()},a," of ",m))))},de=je;var ue=(e,t)=>{if(e.thumbnail.length!==0)return e.thumbnail;let o=t.get(e.items[0]);return t.get(o.items[0]).body};var Oe=({index:e,item:t})=>{var J;let o=$(),{vault:r}=o,[i,s]=w(!1),[d,h]=w(0),[a,m]=w(t.thumbnail),[l,g]=w(),[x,ve]=w(t.id);j(()=>{i&&setTimeout(()=>{l||r.loadManifest(t.id).then(C=>g(C)).catch(C=>{console.error(`Manifest failed to load: ${C}`)})},1e3)},[i]),j(()=>{let C=r.get(t.thumbnail);m(C)},[]);let W=()=>s(!0),G=()=>s(!1),U=C=>{if(!l)return;let K=d+C,Q=r.get(l.items[K]),ye=ue(Q,r),$e=r.get(ye);ve(Q.id),m($e),h(K)};j(()=>{l&&U(0)},[l]);let q;return((J=t.homepage)==null?void 0:J.length)>0&&(q=t.homepage[0].id),D.createElement(A,null,D.createElement(E,{href:q,tabIndex:0,onFocus:W,onBlur:G,onMouseEnter:W,onMouseLeave:G},D.createElement(ne,{key:x,label:t.label,thumbnail:a,index:e,isFocused:i}),D.createElement(de,{manifest:l,activeCanvas:d,handleActiveCanvas:U,isFocused:i})))},pe=Oe;var fe=n("div",{position:"relative",display:"flex",flexDirection:"row",[`> ${A}`]:{marginRight:"$4","&:last-child":{marginRight:"0"}}});import P from"react";var I=n("div",{position:"absolute",background:"black",borderRadius:"3px",opacity:"0",transition:"$all"}),v=n("div",{position:"absolute",display:"flex",flexDirection:"column",width:"$4",height:"$4",borderRadius:"100%",backgroundColor:"white",justifyContent:"center",textAlign:"center",alignItems:"center",boxShadow:"none",transform:"none",transition:"$all",svg:{display:"flex",width:"$3",height:"$3",fill:"$primary",stroke:"$primary",color:"$primary",transition:"$all"}}),he=n("button",{position:"absolute",height:"100%",zIndex:"1",border:"none",cursor:"pointer",background:"transparent",["&:disabled"]:{opacity:"0",transform:"scale(0)"},["&:hover"]:{[`> ${I}`]:{opacity:1},[`> ${v}`]:{boxShadow:"3px 3px 11px #0003",svg:{fill:"$accent",stroke:"$accent",color:"$accent"}}},variants:{value:{next:{left:"unset",right:"0",[`> ${I}`]:{left:"unset",right:"0",top:"0",background:"linear-gradient(270deg, rgba(0,0,0,0.7) 38.2%, rgba(0,0,0,0) 98%)"},[`> ${v}`]:{right:"calc(-$4 / 2)",marginTop:"calc(-$4 / 2)"},[`&:hover > ${v}`]:{marginRight:"$1"}},previous:{left:"0",right:"unset",[`> ${I}`]:{left:"0",right:"unset",top:"0",background:"linear-gradient(90deg, rgba(0,0,0,0.7) 38.2%, rgba(0,0,0,0) 98%)"},[`> ${v}`]:{left:"calc(-$4 / 2)",marginTop:"calc(-$4 / 2)"},[`&:hover > ${v}`]:{marginLeft:"$1"}}}}});var Ve=({disabled:e,handleControl:t,height:o,increment:r,label:i})=>{let s=o*.382;return P.createElement(he,{"aria-label":i,direction:i,onClick:()=>t(r),style:{height:`${o}px`,width:`${s}px`},disabled:e,value:i},P.createElement(I,{style:{height:`${o}px`,width:`${s}px`}}),P.createElement(v,null,i==="next"&&P.createElement(H,null),i==="previous"&&P.createElement(M,null)))},O=Ve;var Ue=({items:e})=>{let t=$(),{itemHeight:o}=t,[r,i]=V([0,1,2,3,4]),[s,d]=V(!1),[h,a]=V(!1),m=Ge(null);We(()=>{!e||(r.includes(0)?d(!1):d(!0),r.includes(e.length-1)?a(!1):a(!0))},[r]);let l=g=>{i(r.map(x=>x+g))};return S.createElement(fe,{ref:m},o&&S.createElement(S.Fragment,null,S.createElement(O,{increment:-1,label:"previous",handleControl:l,height:o,disabled:!s}),S.createElement(O,{increment:1,label:"next",handleControl:l,height:o,disabled:!h})),e.filter((g,x)=>{if(r.includes(x))return g}).map((g,x)=>S.createElement(pe,{index:x,item:g,key:g.id})))},ge=Ue;import F,{useEffect as qe,useState as Je}from"react";var be=n("div",{display:"flex",flexDirection:"column",paddingBottom:"$4",margin:"0",color:"$primary",lineHeight:"1.4em",".bloom-header-homepage":{color:"$accent",textDecoration:"none"},".bloom-header-label":{fontSize:"$6",fontWeight:"400",fontFamily:"$display"},".bloom-header-summary":{fontSize:"$4",marginTop:"$2"}});import{Homepage as Ke,Label as xe,Summary as Qe}from"@samvera/nectar-iiif";var Xe=({label:e,summary:t,homepage:o})=>{let[r,i]=Je(!1);return qe(()=>{o.length>0&&i(!0)},[o]),F.createElement(be,null,r?F.createElement(Ke,{homepage:o,className:"bloom-header-homepage"},F.createElement(xe,{label:e,as:"span",className:"bloom-header-label"})):F.createElement(xe,{label:e,as:"span",className:"bloom-header-label"}),t&&F.createElement(Qe,{summary:t,as:"span",className:"bloom-header-summary"}))},Ce=Xe;var _e=e=>f.createElement(ee,null,f.createElement(et,b({},e))),et=({collectionId:e})=>{let t=$(),{vault:o}=t,[r,i]=Ze();return Ye(()=>{o.loadCollection(e).then(s=>i(s)).catch(s=>{console.error(`Collection failed to load: ${s}`)}).finally(()=>{})},[]),!r||!r.items?(console.log(`The IIIF Collection ${e} failed to load.`),f.createElement(f.Fragment,null)):r.items.length===0?(console.log(`The IIIF collection ${e} does not contain items.`),f.createElement(f.Fragment,null)):f.createElement(tt,null,f.createElement(Ce,{label:r.label,summary:r.summary,homepage:r.homepage}),f.createElement(ge,{items:r.items}))},tt=n("div",{padding:"$4 0"}),xo=_e;export{xo as default};
var Se=Object.defineProperty,we=Object.defineProperties;var Ie=Object.getOwnPropertyDescriptors;var Q=Object.getOwnPropertySymbols;var Pe=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable;var X=(e,t,o)=>t in e?Se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,b=(e,t)=>{for(var o in t||(t={}))Pe.call(t,o)&&X(e,o,t[o]);if(Q)for(var o of Q(t))Fe.call(t,o)&&X(e,o,t[o]);return e},L=(e,t)=>we(e,Ie(t));import h,{useEffect as Ze,useState as _e}from"react";import y,{useReducer as ze}from"react";import{Vault as ke}from"@iiif/vault";var D={isLoaded:!1,itemHeight:void 0,vault:new ke},Y=y.createContext(D),Z=y.createContext(D);function Ae(e,t){switch(t.type){case"updateIsLoaded":return L(b({},e),{isLoaded:t.isLoaded});case"updateItemHeight":return L(b({},e),{itemHeight:t.itemHeight});default:throw new Error(`Unhandled action type: ${t.type}`)}}var _=({initialState:e=D,children:t})=>{let[o,r]=ze(Ae,e);return y.createElement(Y.Provider,{value:o},y.createElement(Z.Provider,{value:r},t))};function $(){let e=y.useContext(Y);if(e===void 0)throw new Error("useViewerState must be used within a ViewerProvider");return e}function ee(){let e=y.useContext(Z);if(e===void 0)throw new Error("useViewerDispatch must be used within a ViewerProvider");return e}import S,{useEffect as Ge,useState as O,useRef as Ue}from"react";import M,{useEffect as T,useState as w}from"react";import p,{useEffect as De,useRef as Ne,useState as Be}from"react";import{createStitches as He}from"@stitches/react";var d=e=>1.618**e;var te={1:"0.382rem",2:"0.618rem",3:"1rem",4:"1.618rem",5:`calc(1rem * ${d(2)})`,6:`calc(1rem * ${d(3)})`,7:`calc(1rem * ${d(4)})`,8:`calc(1rem * ${d(5)})`,9:`calc(1rem * ${d(6)})`,10:`calc(1rem * ${d(7)})`,11:`calc(1rem * ${d(8)})`,12:`calc(1rem * ${d(9)})`},Me={colors:{primary:"#1a1d1e",primaryMuted:"#26292b",primaryAlt:"#151718",accent:"#006adc",accentMuted:"#5eb0ef",accentAlt:"#00254d",secondary:"#FFFFFF",secondaryMuted:"#e6e8eb",secondaryAlt:"#c1c8cd"},fonts:{sans:"'Inter', Arial, sans-serif",display:"'Calistoga', 'Inter', Arial, sans-serif"},fontSizes:{1:"0.611rem",2:"0.722rem",3:"0.833rem",4:"1rem",5:"1.177rem",6:"1.318rem",7:`calc(1rem * ${d(1)})`,8:`calc(1rem * ${d(2)})`,9:`calc(1rem * ${d(3)})`},sizes:b({},te),space:b({},te),transitions:{all:"all 250ms cubic-bezier(0.16, 1, 0.3, 1)",load:"all 1.25s cubic-bezier(0.16, 1, 0.3, 1)"}},Le={xxs:"(max-width: 349px)",xs:"(max-width: 575px)",sm:"(max-width: 767px)",md:"(max-width: 991px)",xl:"(max-width: 1199px)",lg:"(min-width: 1200px)"},{styled:n,css:lt,keyframes:ct,createTheme:dt}=He({theme:Me,media:Le});var N=n("div",{position:"absolute",width:"100%",backgroundColor:"green"}),F=n("figure",{display:"flex",flexDirection:"column",margin:"0 0 $2",flexGrow:"0",flexShrink:"0",borderRadius:"3px",img:{position:"absolute",display:"flex",flexDirection:"column",objectFit:"cover",zIndex:"0",width:"100%",height:"100%",color:"transparent"},video:{position:"absolute",display:"flex",flexDirection:"column",objectFit:"cover",zIndex:"1",width:"100%",height:"100%",color:"transparent",opacity:"0",transition:"$load",borderRadius:"3px"},figcaption:{display:"flex",flexDirection:"column",padding:"$2 0",color:"$primary",transition:"$load"},variants:{isFocused:{true:{margin:"-$2 -$2 0",video:{opacity:"1"},figcaption:{padding:"$2",color:"$accent"},[`& ${N}`]:{width:"calc(100% - ($2 * 2))"}}}}}),z=n("span",{display:"flex",position:"relative",backgroundColor:"$secondaryAlt",width:"100%",height:"100%",overflow:"hidden",borderRadius:"3px",boxShadow:"none",transition:"$all"}),pt=n("span",{fontSize:"$3",fontWeight:"700"}),ft=n("span",{fontSize:"$1",marginTop:"$1",color:"$primary"});import*as oe from"@radix-ui/react-aspect-ratio";import{Label as Ee,Thumbnail as Re}from"@samvera/nectar-iiif";var Te=({label:e,thumbnail:t,index:o,isFocused:r})=>{let s=ee(),[a,g]=Be(!1),l=Ne(null);return De(()=>{let m=new ResizeObserver(c=>{for(let i of c)if(i.contentBoxSize){let u=Array.isArray(i.contentBoxSize)?i.contentBoxSize[0]:i.contentBoxSize;s({type:"updateItemHeight",itemHeight:u.inlineSize})}});o===0&&l.current&&m.observe(l.current)},[o,a]),t[0].type==="ContentResource"?p.createElement(p.Fragment,null):p.createElement(F,{isFocused:r},p.createElement(oe.Root,{ratio:1/1},p.createElement(N,{ref:l}),p.createElement(z,null,p.createElement(Re,{altAsLabel:e,css:{objectFit:"cover",width:"100%",height:"100%"},onLoad:()=>g(!0),thumbnail:t}))),p.createElement("figcaption",null,p.createElement(Ee,{label:e,css:{fontWeight:"700",fontSize:"$2"}})))},re=Te;var B=n("a",{color:"black",textDecoration:"none"}),k=n("div",{position:"relative",width:"calc(100% / 4)",zIndex:"0",borderRadius:"3px",[`> ${B}:hover`]:{[`${F}`]:{boxShadow:"3px 3px 11px #0003"},[`${z}`]:{borderBottomLeftRadius:"0",borderBottomRightRadius:"0"}}});import f,{useEffect as je,useState as le}from"react";var ne=n("div",{position:"absolute",zIndex:"2",left:"-$2",top:"-$2",width:"calc(100% + (0.618rem * 2))",opacity:"0",variants:{isFocused:{true:{opacity:"1"}}}}),ie=n("div",{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end",zIndex:"1"}),se=n("div",{display:"flex",justifyContent:"center",padding:"$2 $2 0",background:"linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%)",cursor:"default",button:{width:"$4",height:"$4",display:"flex",flexDirection:"column",textAlign:"center",justifyContent:"center",alignItems:"center",borderRadious:"100%",backgroundColor:"transparent",border:"none",cursor:"pointer","&:disabled":{opacity:"0.2"},svg:{width:"100%",fill:"$secondary",stroke:"$secondary",color:"$secondary"}}}),ae=n("div",{display:"flex",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.7)",color:"$secondaryAlt",fontSize:"$1",padding:"$1",cursor:"default"});import*as ce from"@radix-ui/react-aspect-ratio";import E from"react";var A=()=>E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},E.createElement("title",null,"Next"),E.createElement("path",{fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"70",d:"M268 112l144 144-144 144M392 256H100"}));import R from"react";var H=()=>R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},R.createElement("title",null,"Previous"),R.createElement("path",{fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"70",d:"M244 400L100 256l144-144M120 256h292"}));var Oe=({activeCanvas:e,handleActiveCanvas:t,isFocused:o,manifest:r})=>{let[s,a]=le(!1),[g,l]=le(!1),m=e+1,c=0;return r&&(c=r.items.length),je(()=>{m<=1?a(!1):a(!0),m>=c?l(!1):l(!0)},[e,r]),f.createElement(ne,{isFocused:o},f.createElement(ce.Root,{ratio:1/1},r&&f.createElement(ie,null,f.createElement(se,{onClick:i=>i.preventDefault()},f.createElement("button",{onClick:()=>t(-1),disabled:!s},f.createElement(H,null)),f.createElement("button",{onClick:()=>t(1),disabled:!g},f.createElement(A,null))),f.createElement(ae,{onClick:i=>i.preventDefault()},m," of ",c))))},de=Oe;var me=(e,t)=>{if(e.thumbnail.length!==0)return e.thumbnail;let o=t.get(e.items[0]);return t.get(o.items[0]).body};var We=({index:e,item:t})=>{var q;let o=$(),{vault:r}=o,[s,a]=w(!1),[g,l]=w(0),[m,c]=w(t.thumbnail),[i,u]=w(),[Ce,ve]=w(t.id);T(()=>{s&&setTimeout(()=>{i||r.loadManifest(t.id).then(x=>u(x)).catch(x=>{console.error(`Manifest failed to load: ${x}`)})},1e3)},[s]),T(()=>{let x=r.get(t.thumbnail);c(x)},[]);let W=()=>a(!0),V=()=>a(!1),G=x=>{if(!i)return;let J=g+x,K=r.get(i.items[J]),ye=me(K,r),$e=r.get(ye);ve(K.id),c($e),l(J)};T(()=>{i&&G(0)},[i]);let U;return((q=t.homepage)==null?void 0:q.length)>0&&(U=t.homepage[0].id),M.createElement(k,null,M.createElement(B,{href:U,tabIndex:0,onFocus:W,onBlur:V,onMouseEnter:W,onMouseLeave:V},M.createElement(re,{key:Ce,label:t.label,thumbnail:m,index:e,isFocused:s}),M.createElement(de,{manifest:i,activeCanvas:g,handleActiveCanvas:G,isFocused:s})))},ue=We;var pe=n("div",{position:"relative",display:"flex",flexDirection:"row",[`> ${k}`]:{marginRight:"$4","&:last-child":{marginRight:"0"}}});import v from"react";var I=n("div",{position:"absolute",background:"black",borderRadius:"3px",opacity:"0",transition:"$all"}),C=n("div",{position:"absolute",display:"flex",flexDirection:"column",width:"$4",height:"$4",borderRadius:"100%",backgroundColor:"white",justifyContent:"center",textAlign:"center",alignItems:"center",boxShadow:"none",transform:"none",transition:"$all",svg:{display:"flex",width:"$3",height:"$3",fill:"$primary",stroke:"$primary",color:"$primary",transition:"$all"}}),fe=n("button",{position:"absolute",height:"100%",zIndex:"1",border:"none",cursor:"pointer",background:"transparent",["&:disabled"]:{opacity:"0",transform:"scale(0)"},["&:hover"]:{[`> ${I}`]:{opacity:1},[`> ${C}`]:{boxShadow:"3px 3px 11px #0003",svg:{fill:"$accent",stroke:"$accent",color:"$accent"}}},variants:{value:{next:{left:"unset",right:"0",[`> ${I}`]:{left:"unset",right:"0",top:"0",background:"linear-gradient(270deg, rgba(0,0,0,0.7) 38.2%, rgba(0,0,0,0) 98%)"},[`> ${C}`]:{right:"calc(-$4 / 2)",marginTop:"calc(-$4 / 2)"},[`&:hover > ${C}`]:{marginRight:"$1"}},previous:{left:"0",right:"unset",[`> ${I}`]:{left:"0",right:"unset",top:"0",background:"linear-gradient(90deg, rgba(0,0,0,0.7) 38.2%, rgba(0,0,0,0) 98%)"},[`> ${C}`]:{left:"calc(-$4 / 2)",marginTop:"calc(-$4 / 2)"},[`&:hover > ${C}`]:{marginLeft:"$1"}}}}});var Ve=({disabled:e,handleControl:t,height:o,increment:r,label:s})=>{let a=o*.382;return v.createElement(v.Fragment,null,v.createElement(fe,{"aria-label":s,direction:s,onClick:()=>t(r),style:{height:`${o}px`,width:`${a}px`},disabled:e,value:s},v.createElement(I,{style:{height:`${o}px`,width:`${a}px`}}),v.createElement(C,null,s==="next"&&v.createElement(A,null),s==="previous"&&v.createElement(H,null))))},j=Ve;var qe=({items:e})=>{let{itemHeight:t}=$(),[o,r]=O([0,1,2,3,4]),[s,a]=O(!1),[g,l]=O(!1),m=Ue(null);Ge(()=>{!e||(o.includes(0)?a(!1):a(!0),o.includes(e.length-1)?l(!1):l(!0))},[o]);let c=i=>{r(o.map(u=>u+i))};return S.createElement(pe,{ref:m},t&&S.createElement(S.Fragment,null,S.createElement(j,{increment:-1,label:"previous",handleControl:c,height:t,disabled:!s}),S.createElement(j,{increment:1,label:"next",handleControl:c,height:t,disabled:!g})),e.filter((i,u)=>{if(o.includes(u))return i}).map((i,u)=>S.createElement(ue,{index:u,item:i,key:i.id})))},he=qe;import P,{useEffect as Je,useState as Ke}from"react";var ge=n("div",{display:"flex",flexDirection:"column",paddingBottom:"$4",margin:"0",color:"$primary",lineHeight:"1.4em",".bloom-header-homepage":{color:"$accent",textDecoration:"none"},".bloom-header-label":{fontSize:"$6",fontWeight:"400",fontFamily:"$display"},".bloom-header-summary":{fontSize:"$4",marginTop:"$2"}});import{Homepage as Qe,Label as be,Summary as Xe}from"@samvera/nectar-iiif";var Ye=({label:e,summary:t,homepage:o})=>{let[r,s]=Ke(!1);return Je(()=>{o.length>0&&s(!0)},[o]),P.createElement(ge,null,r?P.createElement(Qe,{homepage:o,className:"bloom-header-homepage"},P.createElement(be,{label:e,as:"span",className:"bloom-header-label"})):P.createElement(be,{label:e,as:"span",className:"bloom-header-label"}),t&&P.createElement(Xe,{summary:t,as:"span",className:"bloom-header-summary"}))},xe=Ye;var et=e=>h.createElement(_,null,h.createElement(tt,b({},e))),tt=({collectionId:e})=>{let t=$(),{vault:o}=t,[r,s]=_e();return Ze(()=>{o.loadCollection(e).then(a=>s(a)).catch(a=>{console.error(`Collection failed to load: ${a}`)}).finally(()=>{})},[]),!r||!r.items?(console.log(`The IIIF Collection ${e} failed to load.`),h.createElement(h.Fragment,null)):r.items.length===0?(console.log(`The IIIF collection ${e} does not contain items.`),h.createElement(h.Fragment,null)):h.createElement(ot,null,h.createElement(xe,{label:r.label,summary:r.summary,homepage:r.homepage}),h.createElement(he,{items:r.items}))},ot=n("div",{padding:"$4 0"}),Co=et;export{Co as default};
//# sourceMappingURL=index.esm.js.map
{
"name": "@samvera/bloom-iiif",
"version": "0.1.0",
"version": "0.1.1",
"description": "<img src=\"https://user-images.githubusercontent.com/7376450/160845852-39bf8942-1db4-41ee-881f-889ba2a4f61e.png\" class=\"bloom-screenshot\" alt=\"Bloom screenshot\"/>",

@@ -55,3 +55,3 @@ "main": "dist/index.cjs.js",

"@radix-ui/react-aspect-ratio": "^0.1.4",
"@samvera/nectar-iiif": "^0.0.9",
"@samvera/nectar-iiif": "^0.0.10",
"@stitches/react": "^1.2.7",

@@ -58,0 +58,0 @@ "react": "^16.13.1 || ^17.0 || ^18.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc