react-iiif-vault 1.0.10 → 1.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/bundle.d.ts +1058 -0
- package/dist/bundle.global.js +227 -0
- package/dist/canvas-panel.cjs +46 -0
- package/dist/canvas-panel.d.cts +11 -0
- package/dist/canvas-panel.d.ts +11 -0
- package/dist/canvas-panel.js +1 -0
- package/dist/chunk-HEVA2EDS.js +47 -0
- package/dist/chunk-YSH2CIKG.js +1 -0
- package/dist/index-BZirmhnp.d.cts +188 -0
- package/dist/index-Cxs6aAuK.d.ts +188 -0
- package/dist/index.cjs +47 -0
- package/dist/index.d.cts +721 -0
- package/dist/index.d.ts +721 -0
- package/dist/index.js +1 -0
- package/dist/useRenderingStrategy-Xj9yQm4y.d.cts +145 -0
- package/dist/useRenderingStrategy-Xj9yQm4y.d.ts +145 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.cts +32 -0
- package/dist/utils.d.ts +32 -0
- package/dist/utils.js +1 -0
- package/package.json +67 -70
- package/.build/types/canvas-panel/Viewer.d.ts +0 -14
- package/.build/types/canvas-panel/context/overlays.d.ts +0 -3
- package/.build/types/canvas-panel/context/world-size.d.ts +0 -2
- package/.build/types/canvas-panel/index.d.ts +0 -46
- package/.build/types/canvas-panel/render/Annotation.d.ts +0 -8
- package/.build/types/canvas-panel/render/AnnotationPage.d.ts +0 -7
- package/.build/types/canvas-panel/render/Audio.d.ts +0 -11
- package/.build/types/canvas-panel/render/Canvas.d.ts +0 -34
- package/.build/types/canvas-panel/render/CanvasBackground.d.ts +0 -4
- package/.build/types/canvas-panel/render/DefaultCanvasFallback.d.ts +0 -6
- package/.build/types/canvas-panel/render/Image.d.ts +0 -16
- package/.build/types/canvas-panel/render/Model.d.ts +0 -7
- package/.build/types/canvas-panel/render/Video.d.ts +0 -12
- package/.build/types/canvas-panel/render/VideoYouTube.d.ts +0 -12
- package/.build/types/components/CanvasAnnotations.d.ts +0 -10
- package/.build/types/components/CombinedMetadata.d.ts +0 -4
- package/.build/types/components/Image.d.ts +0 -15
- package/.build/types/components/ManifestMetadata.d.ts +0 -4
- package/.build/types/components/Metadata.d.ts +0 -39
- package/.build/types/components/SequenceThumbnails.d.ts +0 -29
- package/.build/types/components/SingleCanvasThumbnail.d.ts +0 -20
- package/.build/types/context/AnnotationContext.d.ts +0 -5
- package/.build/types/context/AnnotationPageContext.d.ts +0 -5
- package/.build/types/context/CanvasContext.d.ts +0 -5
- package/.build/types/context/CollectionContext.d.ts +0 -5
- package/.build/types/context/ContextBridge.d.ts +0 -14
- package/.build/types/context/ImageServiceLoaderContext.d.ts +0 -4
- package/.build/types/context/ManifestContext.d.ts +0 -5
- package/.build/types/context/MediaContext.d.ts +0 -17
- package/.build/types/context/RangeContext.d.ts +0 -5
- package/.build/types/context/ResourceContext.d.ts +0 -15
- package/.build/types/context/VaultContext.d.ts +0 -14
- package/.build/types/context/ViewerPresetContext.d.ts +0 -3
- package/.build/types/context/VisibleCanvasContext.d.ts +0 -4
- package/.build/types/demo/demo.d.ts +0 -1
- package/.build/types/demo/media-controls.d.ts +0 -1
- package/.build/types/demo/viewer-controls.d.ts +0 -1
- package/.build/types/features/rendering-strategy/3d-strategy.d.ts +0 -12
- package/.build/types/features/rendering-strategy/audio-strategy.d.ts +0 -3
- package/.build/types/features/rendering-strategy/get-rendering-strategy.d.ts +0 -11
- package/.build/types/features/rendering-strategy/image-strategy.d.ts +0 -12
- package/.build/types/features/rendering-strategy/rendering-utils.d.ts +0 -12
- package/.build/types/features/rendering-strategy/resource-types.d.ts +0 -55
- package/.build/types/features/rendering-strategy/strategies.d.ts +0 -31
- package/.build/types/features/rendering-strategy/textual-content-strategy.d.ts +0 -16
- package/.build/types/features/rendering-strategy/video-strategy.d.ts +0 -3
- package/.build/types/future-helpers/ranges.d.ts +0 -7
- package/.build/types/future-helpers/sequences.d.ts +0 -8
- package/.build/types/hooks/useAnnotation.d.ts +0 -8
- package/.build/types/hooks/useAnnotationPage.d.ts +0 -8
- package/.build/types/hooks/useAnnotationPageManager.d.ts +0 -10
- package/.build/types/hooks/useAnnotationsAtTime.d.ts +0 -4
- package/.build/types/hooks/useCanvas.d.ts +0 -8
- package/.build/types/hooks/useCanvasClock.d.ts +0 -1
- package/.build/types/hooks/useCanvasSelector.d.ts +0 -0
- package/.build/types/hooks/useCanvasSubset.d.ts +0 -2
- package/.build/types/hooks/useCanvasTimeline.d.ts +0 -0
- package/.build/types/hooks/useCollection.d.ts +0 -8
- package/.build/types/hooks/useDispatch.d.ts +0 -2
- package/.build/types/hooks/useEnabledAnnotationPageIds.d.ts +0 -1
- package/.build/types/hooks/useEventListener.d.ts +0 -4
- package/.build/types/hooks/useExistingVault.d.ts +0 -2
- package/.build/types/hooks/useExternalCollection.d.ts +0 -13
- package/.build/types/hooks/useExternalManifest.d.ts +0 -13
- package/.build/types/hooks/useExternalResource.d.ts +0 -16
- package/.build/types/hooks/useImage.d.ts +0 -10
- package/.build/types/hooks/useImageService.d.ts +0 -9
- package/.build/types/hooks/useImageTile.d.ts +0 -11
- package/.build/types/hooks/useLoadImageService.d.ts +0 -6
- package/.build/types/hooks/useManifest.d.ts +0 -8
- package/.build/types/hooks/usePaintables.d.ts +0 -9
- package/.build/types/hooks/usePaintingAnnotations.d.ts +0 -5
- package/.build/types/hooks/useRange.d.ts +0 -8
- package/.build/types/hooks/useRenderingStrategy.d.ts +0 -15
- package/.build/types/hooks/useResourceEvents.d.ts +0 -3
- package/.build/types/hooks/useResources.d.ts +0 -1
- package/.build/types/hooks/useSearchService.d.ts +0 -2
- package/.build/types/hooks/useSimpleMediaPlayer.d.ts +0 -32
- package/.build/types/hooks/useStyleHelper.d.ts +0 -1
- package/.build/types/hooks/useStyles.d.ts +0 -3
- package/.build/types/hooks/useThumbnail.d.ts +0 -5
- package/.build/types/hooks/useVault.d.ts +0 -2
- package/.build/types/hooks/useVaultEffect.d.ts +0 -2
- package/.build/types/hooks/useVaultSelector.d.ts +0 -2
- package/.build/types/hooks/useVirtualAnnotationPage.d.ts +0 -14
- package/.build/types/hooks/useVirtualAnnotationPageContext.d.ts +0 -671
- package/.build/types/hooks/useVirtualCanvas.d.ts +0 -0
- package/.build/types/index.d.ts +0 -72
- package/.build/types/utility/flatten-annotation-page-ids.d.ts +0 -7
- package/.build/types/utility/i18n-utils.d.ts +0 -30
- package/.build/types/utils.d.ts +0 -2
- package/.build/types/viewers/SimpleViewerContext.d.ts +0 -6
- package/.build/types/viewers/SimpleViewerContext.hooks.d.ts +0 -19
- package/.build/types/viewers/SimpleViewerContext.types.d.ts +0 -46
- package/.build/types/viewers/SingleCanvasContext.d.ts +0 -1
- package/dist/bundle/cjs/index.js +0 -49
- package/dist/bundle/cjs/index.js.map +0 -1
- package/dist/bundle/esm/index.mjs +0 -3314
- package/dist/bundle/esm/index.mjs.map +0 -1
- package/dist/canvas-panel/cjs/canvas-panel.js +0 -47
- package/dist/canvas-panel/cjs/canvas-panel.js.map +0 -1
- package/dist/canvas-panel/esm/canvas-panel.mjs +0 -1853
- package/dist/canvas-panel/esm/canvas-panel.mjs.map +0 -1
- package/dist/index.umd.js +0 -393
- package/dist/index.umd.js.map +0 -1
- package/dist/react17/cjs/index.js +0 -49
- package/dist/react17/cjs/index.js.map +0 -1
- package/dist/react17/esm/index.mjs +0 -3314
- package/dist/react17/esm/index.mjs.map +0 -1
- package/dist/utils/cjs/utils.js +0 -2
- package/dist/utils/cjs/utils.js.map +0 -1
- package/dist/utils/esm/utils.mjs +0 -238
- package/dist/utils/esm/utils.mjs.map +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as St,A as Je,Aa as jt,B as Ue,Ba as er,C as Xe,Ca as K,D as Ye,Da as tr,E as Ze,Ea as rr,F as je,Fa as or,G as et,Ga as nr,H as tt,Ha as ir,I as rt,Ia as ar,J as ot,Ja as $,K as nt,L as it,M as at,N as st,O as mt,P as lt,Q as ct,R as ft,S as ut,T as dt,U as gt,V as pt,W as vt,X as xt,Y as yt,Z as Q,_ as ht,a as qe,aa as bt,b as w,ba as It,c as P,ca as Rt,d as Le,da as Ct,e as Te,ea as Pt,f as ke,fa as Nt,g as D,ga as N,h as Ee,ha as Mt,i as Ae,ia as wt,j as W,ja as zt,k as b,ka as qt,l as z,la as Lt,m as Fe,ma as Tt,n as Ve,na as kt,o as q,oa as Et,p as Oe,pa as At,q as De,qa as Ft,r as We,ra as R,s as He,sa as _t,t as Qe,ta as _,u as _e,ua as Kt,v as Ke,va as $t,w as H,wa as L,x as $e,xa as Bt,y as Be,ya as T,z as Ge,za as Gt}from"./chunk-HEVA2EDS.js";import{a as Vt,b as Ot,c as Dt,d as Wt,e as Ht,f as Qt,g as Jt,h as Ut,i as Xt,j as Yt,k as Zt}from"./chunk-YSH2CIKG.js";import{useCanvas as Z}from"@atlas-viewer/atlas";import{forwardRef as j,useImperativeHandle as ee}from"react";import{Fragment as te,jsx as B}from"react/jsx-runtime";var ur=j(function({canvasId:t},r){let i=Z(),o=_(t||i?.id),a=b();return ee(r,()=>o,[t,i]),!i||o.enabledPageIds.length===0?null:B(te,{children:o.enabledPageIds.map(n=>B($.RenderAnnotationPage,{page:a.get(n)},n))})});import{useMemo as ne}from"react";import{useMemo as re}from"react";import{Fragment as oe,jsx as v,jsxs as k}from"react/jsx-runtime";function E({metadata:e=[],config:t,labelWidth:r=16,showEmptyMessage:i=!0,allowHtml:o,emptyFallback:a,classes:n={},emptyMessage:s="No metadata available",emptyValueFallback:l="No value",emptyLabelFallback:g="",separator:d,tableFooter:x,tableHeader:y}){let p=re(()=>{let f=(t||[]).reduce((u,h)=>[...u,...h.keys],[]),m={};for(let u of e){let h=u&&u.label?Object.values(u.label):[];for(let c of h)if(c&&c.length&&(f.indexOf(`metadata.${c[0]}`)!==-1||f.length===0)&&u){let S=`metadata.${c[0]}`;m[S]=m[S]?m[S]:[],m[S].push(u);break}}return m},[t,e]);return Object.keys(p).length===0&&i?v(oe,{children:a})||v("div",{className:n.empty,children:s}):t&&t.length?k("table",{className:n.container,children:[y,v("tbody",{children:t.map((f,m)=>{let u=[];for(let h of f.keys)for(let c of p[h]||[])u.push(v(R,{enableDangerouslySetInnerHTML:o,defaultText:l,separator:d,children:c.value},m+"__"+h));return u.length===0?null:k("tr",{className:n.row,children:[v("td",{className:n.label,style:r?{minWidth:r}:{},children:v(R,{enableDangerouslySetInnerHTML:o,separator:d,defaultText:g,children:f.label})}),v("td",{className:n.value,children:u})]},m)})}),x]}):k("table",{className:n.container,children:[y,v("tbody",{children:e&&e.length?e.map((f,m)=>f?k("tr",{className:n.row,children:[v("td",{className:n.label,style:r?{minWidth:r}:{},children:v(R,{enableDangerouslySetInnerHTML:o,defaultText:l,separator:d,children:f.label})}),v("td",{className:n.value,children:v(R,{enableDangerouslySetInnerHTML:o,defaultText:l,separator:d,children:f.value})})]},m):null):null}),x]})}import{jsx as ie}from"react/jsx-runtime";function Pr(e){let t=q(),r=N(),i=H(),o=ne(()=>{let a=t?.metadata||[],n=r?.metadata||[],s=i?.metadata||[];return[...a,...n,...s]},[t,r,i]);return ie(E,{metadata:o,...e})}import{useEffect as le,useState as ce}from"react";import{createImageServiceRequest as ae,imageServiceRequestToString as se}from"@atlas-viewer/iiif-image-api";import{useMemo as me}from"react";function V(e,t={},r=[]){return me(()=>{if(!e)return null;let i=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(console.log("Invalid quality",t.quality,e.extraQualities),i="default"));let o=ae(e);return se({identifier:o.identifier,server:o.server,scheme:o.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:i||"default",prefix:o.prefix,originalPath:o.originalPath})},[...r])}import{jsx as A}from"react/jsx-runtime";function fe(e){let t=typeof e.src=="string"?e.src:e.src.id,r=L(),[i,o]=ce(!1),a;if(t){let s=r.loadServiceSync({id:t});s&&(a=s)}!a&&!i&&r.loadService({id:t}).then(()=>{o(!0)});let n=V(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[i,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return le(()=>()=>{o(!1)},[t]),n?A("img",{src:n,alt:e.alt,className:e.className,style:e.style}):A(ue,{...e,fetchImageService:!1})}function ue(e){if(e.fetchImageService)return A(fe,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,r=V(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return r?A("img",{src:r,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as de}from"react/jsx-runtime";function Hr(e){let t=q();return de(E,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as ye,useRef as he}from"react";import*as O from"react-lazy-load-image-component";import{getValue as ge}from"@iiif/helpers/i18n";import{Fragment as G,jsx as I,jsxs as xe}from"react/jsx-runtime";var{LazyLoadComponent:pe}=O||O.default;function J(e){let{size:t,visible:r,classes:i,canvasId:o,figure:a}=e,n=t?.width||128,s=t?.height||t?.width||128,l=I(ve,{...e}),g=I(pe,{threshold:300,style:{height:s,width:n},visibleByDefault:r,children:o?I(W,{canvas:o,children:l}):l});return a?I("figure",{className:i?.figure,children:g}):g}function ve({fallback:e,size:t,classes:r,showLabel:i,alt:o,dereference:a=!1}){let n=N(),s=t?.width||128,l=t?.height||t?.width||128,g=o||ge(n?.label)||"",d=K({width:s,height:l},a);return!d||d.type!=="fixed"?I(G,{children:e}):xe(G,{children:[I("div",{className:r?.imageWrapper,children:I("img",{className:r?.img,src:d.id,alt:g})}),i?I(R,{as:"figcaption",className:r?.label,children:n?.label}):null]})}import{jsx as M}from"react/jsx-runtime";function eo({flat:e,size:t,classes:r={},showLabel:i,figure:o,fallback:a}){let n=he(null),{items:s,sequence:l,currentSequenceIndex:g,setSequenceIndex:d}=Q(),x={row:r.selected?.row||r.row,item:r.selected?.item||r.item,figure:r.selected?.figure||r.figure,img:r.selected?.img||r.img,label:r.selected?.label||r.label,imageWrapper:r.selected?.imageWrapper||r.imageWrapper};ye(()=>{if(!n.current)return;let p=n.current.querySelector("[data-selected=true]");p&&p.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[g]);let y=[];for(let p of l){let C=[],f=l[g]===p;for(let m of p){let u=s[m];C.push(M("div",{className:f?x.item:r.item,children:M(J,{classes:f?x:r,canvasId:u.id,size:t,showLabel:i,figure:o,placeholder:M("div",{style:{height:128,width:128}}),fallback:a})},m))}if(e){y.push(C);continue}y.push(M("div",{onClick:m=>{d(l.indexOf(p))},"data-selected":f,className:f?x.row:r.row,children:C}))}return M("div",{ref:n,className:r.container,children:y})}import{jsx as Se}from"react/jsx-runtime";function no({annotation:e,children:t}){return Se(P,{value:{annotation:e},children:t})}import{jsx as be}from"react/jsx-runtime";function mo({annotationPage:e,children:t}){return be(P,{value:{annotationPage:e},children:t})}import{jsx as Ie}from"react/jsx-runtime";function uo({collection:e,children:t}){return Ie(P,{value:{collection:e},children:t})}function xo(e,t={}){return T(t)}function ho(e,t=!1){}function Ro(e){let r=w().manifest,i=e?e.map(o=>typeof o=="string"?o:o?.id):[];return z(o=>{let a=r?o.iiif.entities.Manifest[r]:void 0,n=a?.items||[];if(typeof e>"u")return n;let s=[];for(let l of a?.items||[])i.indexOf(l.id)!==-1&&s.push(l);return s},[i.join("/")])}import{useMemo as Re}from"react";function wo(e,t=[]){let{id:r,selector:i}=e,o=w(),a=r||o.collection,n=z(s=>a?s.iiif.entities.Collection[a]:void 0,[a]);return Re(()=>{if(n)return i?i(n):n},[n,i,...t])}import{useEffect as Ce,useMemo as Pe}from"react";import{createEventsHelper as Ne}from"@iiif/helpers/events";function ko(e,t,r,i,o=[]){let a=b(),n=Pe(()=>Ne(a),[a]);Ce(()=>{let s=e;return s?(n.addEventListener(s,t,r,i),()=>{n.removeEventListener(s,t,r)}):()=>{}},[n,e,t,...o])}function Vo(e,t){let{id:r,isLoaded:i,error:o,resource:a,requestId:n,cached:s}=D(e,t);return{id:r,isLoaded:i,error:o,manifest:a,requestId:n,cached:s}}import{getImageServices as U}from"@atlas-viewer/iiif-image-api";import{useEffect as Me,useMemo as X,useState as F}from"react";function Y({cacheKey:e}={}){let t=N(),r=T(),i=b(),o=L(),[a,n]=F(void 0),[s,l]=F(!1),[g,d]=F("idle"),[x,y]=F(void 0),p=t?t.id:"undefined",C=X(()=>{try{if(t&&r.length){let m=r[0],u=i.get(m.body[0]),c=U(u)[0];return c&&o.loadServiceSync({id:c.id||c["@id"],width:c.width||t.width,height:c.height||t.height})||void 0}}catch(m){console.error(m)}},[p,e,t]),f=g==="success"&&a?a:C;return Me(()=>{(async()=>{try{if(t&&r.length){let m=r[0],u=i.get(m.body[0]),c=U(u)[0];if(!c)return;l(!0),d("loading");try{let S=await o.loadService({id:c.id||c["@id"],width:c.width||t.width,height:c.height||t.height})||void 0;n(S),d("success"),l(!1)}catch(S){d("error"),y(S)}}}catch(m){d("error"),y(m)}})()},[p,e]),X(()=>({data:f,isFetching:s,status:g,error:x}),[f,s,g,x])}function Go(){let e=Y();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as we}from"@iiif/helpers/styles";import{useMemo as ze}from"react";function Zo(){let e=b();return ze(()=>we(e),[e])}export*from"@iiif/helpers/annotation-targets";export{no as AnnotationContext,mo as AnnotationPageContext,gt as Auth,tt as AuthProvider,rt as AuthProvider_Old,Ze as AuthRContext,je as AuthReactContext,et as AuthReactContextActions,ur as CanvasAnnotations,W as CanvasContext,$ as CanvasPanel,uo as CollectionContext,Pr as CombinedMetadata,St as ContextBridge,ue as Image,$t as ImageServiceLoaderContext,xt as InnerViewerProvider,Lt as LanguageProvider,kt as LanguageString,R as LocaleString,Ae as ManifestContext,Hr as ManifestMetadata,ar as MediaPlayerProvider,E as Metadata,Oe as RangeContext,Le as ReactVaultContext,P as ResourceProvider,qe as ResourceReactContext,eo as SequenceThumbnails,yt as SimpleViewerProvider,vt as SimpleViewerReactContext,J as SingleCanvasThumbnail,Te as VaultProvider,Pt as ViewerPresetContext,Ct as VirtualAnnotationProvider,Fe as VisibleCanvasReactContext,Ue as authDetailsForResource,Ge as createAuthStateStore,Je as createProbe,Dt as emptyActions,Qt as emptyStrategy,We as findAllCanvasesInRange,De as findFirstCanvasFromRange,He as findManifestSelectedRange,Qe as findSelectedRange,_t as flattenAnnotationPageIds,tr as formatTime,Jt as get3dStrategy,Ut as getImageStrategy,Ke as getManifestSequence,Ot as getParsedTargetSelector,Zt as getRenderingStrategy,Xt as getTextualContentStrategy,Yt as getVideoStrategy,_e as getVisibleCanvasesFromCanvasId,Be as hasAuth,Ye as makeAccessServiceRequest,Xe as makeAccessTokenRequest,Vt as parseSpecificResource,Wt as unknownResponse,Ht as unsupportedStrategy,zt as useAnnotation,qt as useAnnotationPage,_ as useAnnotationPageManager,xo as useAnnotationsAtTime,nt as useAuthActions,dt as useAuthActions_old,at as useAuthService,ct as useAuthService_old,ot as useAuthStore,mt as useAuthToken,ut as useAuthToken_old,st as useAuthTokens,ft as useAuthTokens_old,N as useCanvas,ho as useCanvasClock,$e as useCanvasSequence,Ro as useCanvasSubset,Et as useClosestLanguage,wo as useCollection,ht as useContextBridge,Ft as useCreateLocaleString,it as useCurrentAuth,lt as useCurrentAuth_old,bt as useDispatch,ko as useEventListener,ke as useExistingVault,Vo as useExternalCollection,Ee as useExternalManifest,D as useExternalResource,Tt as useIIIFLanguage,V as useImage,Y as useImageService,L as useImageServiceLoader,Go as useImageTile,Bt as useLoadImageService,At as useLocaleString,q as useManifest,nr as useMediaActions,ir as useMediaElements,or as useMediaState,Gt as usePaintables,T as usePaintingAnnotations,H as useRange,jt as useRenderingStrategy,w as useResourceContext,Mt as useResourceEvents,Kt as useResources,pt as useSearchService,rr as useSimpleMediaPlayer,Q as useSimpleViewer,Zo as useStyleHelper,wt as useStyles,K as useThumbnail,b as useVault,er as useVaultEffect,z as useVaultSelector,Nt as useViewerPreset,It as useVirtualAnnotationPage,Rt as useVirtualAnnotationPageContext,Ve as useVisibleCanvases};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { ChoiceDescription, Paintables, SupportedTarget } from '@iiif/helpers';
|
|
2
|
+
import { ImageService, ExternalWebResource, InternationalString } from '@iiif/presentation-3';
|
|
3
|
+
import { AnnotationPageNormalized, CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
4
|
+
import { BoxSelector, TemporalBoxSelector, TemporalSelector } from '@iiif/helpers/annotation-targets';
|
|
5
|
+
|
|
6
|
+
type ImageWithOptionalService = {
|
|
7
|
+
id: string;
|
|
8
|
+
annotationId: string;
|
|
9
|
+
type: 'Image';
|
|
10
|
+
service?: ImageService;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
sizes?: Array<{
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}>;
|
|
17
|
+
target: BoxSelector | TemporalBoxSelector;
|
|
18
|
+
selector?: BoxSelector;
|
|
19
|
+
};
|
|
20
|
+
type SingleAudio = {
|
|
21
|
+
type: 'Sound';
|
|
22
|
+
annotationId: string;
|
|
23
|
+
url: string;
|
|
24
|
+
format: string;
|
|
25
|
+
duration: number;
|
|
26
|
+
target: TemporalSelector;
|
|
27
|
+
/**
|
|
28
|
+
* Which part of this audio should be used (cropping).
|
|
29
|
+
*/
|
|
30
|
+
selector: TemporalSelector;
|
|
31
|
+
};
|
|
32
|
+
type SingleYouTubeVideo = {
|
|
33
|
+
type: 'VideoYouTube';
|
|
34
|
+
annotationId: string;
|
|
35
|
+
url: string;
|
|
36
|
+
youTubeId: string;
|
|
37
|
+
duration: number;
|
|
38
|
+
target: TemporalSelector | TemporalBoxSelector;
|
|
39
|
+
selector: TemporalSelector | TemporalBoxSelector;
|
|
40
|
+
};
|
|
41
|
+
type SingleVideo = {
|
|
42
|
+
type: 'Video';
|
|
43
|
+
annotationId: string;
|
|
44
|
+
url: string;
|
|
45
|
+
format: string;
|
|
46
|
+
duration: number;
|
|
47
|
+
/**
|
|
48
|
+
* Where on the canvas should this section of video be painted.
|
|
49
|
+
*/
|
|
50
|
+
target: TemporalSelector | TemporalBoxSelector;
|
|
51
|
+
/**
|
|
52
|
+
* Which part of this video should be painted.
|
|
53
|
+
*/
|
|
54
|
+
selector: TemporalSelector | TemporalBoxSelector;
|
|
55
|
+
};
|
|
56
|
+
type AudioSequence = {
|
|
57
|
+
type: 'SoundSequence';
|
|
58
|
+
items: SingleAudio[];
|
|
59
|
+
};
|
|
60
|
+
type VideoSequence = {
|
|
61
|
+
type: 'VideoSequence';
|
|
62
|
+
items: SingleVideo[];
|
|
63
|
+
};
|
|
64
|
+
type AnnotationPageDescription = {
|
|
65
|
+
pages: AnnotationPageNormalized[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type ImageServiceLoaderType = (imageService: any | undefined, { height, width }: {
|
|
69
|
+
height: number;
|
|
70
|
+
width: number;
|
|
71
|
+
}) => ImageService | undefined;
|
|
72
|
+
declare function useLoadImageService(): readonly [ImageServiceLoaderType, Record<string, string>];
|
|
73
|
+
|
|
74
|
+
type SingleImageStrategy = {
|
|
75
|
+
type: 'images';
|
|
76
|
+
image: ImageWithOptionalService;
|
|
77
|
+
images: Array<ImageWithOptionalService>;
|
|
78
|
+
choice?: ChoiceDescription;
|
|
79
|
+
annotations?: AnnotationPageDescription;
|
|
80
|
+
};
|
|
81
|
+
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): RenderingStrategy;
|
|
82
|
+
|
|
83
|
+
type Single3DModelStrategy = {
|
|
84
|
+
type: '3d-model';
|
|
85
|
+
model: ExternalWebResource;
|
|
86
|
+
choice?: ChoiceDescription;
|
|
87
|
+
annotations?: AnnotationPageDescription;
|
|
88
|
+
};
|
|
89
|
+
declare function get3dStrategy(canvas: CanvasNormalized, paintables: Paintables): RenderingStrategy;
|
|
90
|
+
|
|
91
|
+
type TextualContentStrategy = {
|
|
92
|
+
type: 'textual-content';
|
|
93
|
+
items: {
|
|
94
|
+
annotationId: string;
|
|
95
|
+
text: InternationalString;
|
|
96
|
+
target: SupportedTarget | null;
|
|
97
|
+
}[];
|
|
98
|
+
choice?: ChoiceDescription;
|
|
99
|
+
annotations?: AnnotationPageDescription;
|
|
100
|
+
};
|
|
101
|
+
declare function getTextualContentStrategy(canvas: CanvasNormalized, paintables: Paintables): RenderingStrategy;
|
|
102
|
+
|
|
103
|
+
type MediaStrategy = {
|
|
104
|
+
type: 'media';
|
|
105
|
+
media: SingleAudio | SingleVideo | AudioSequence | VideoSequence | SingleYouTubeVideo;
|
|
106
|
+
choice?: ChoiceDescription;
|
|
107
|
+
annotations?: AnnotationPageDescription;
|
|
108
|
+
};
|
|
109
|
+
type ComplexTimelineStrategy = {
|
|
110
|
+
type: 'complex-timeline';
|
|
111
|
+
items: Array<ImageWithOptionalService | SingleAudio | SingleVideo>;
|
|
112
|
+
choice?: ChoiceDescription;
|
|
113
|
+
annotations?: AnnotationPageDescription;
|
|
114
|
+
};
|
|
115
|
+
type EmptyStrategy = {
|
|
116
|
+
type: 'empty';
|
|
117
|
+
image: null;
|
|
118
|
+
images: [];
|
|
119
|
+
height: number;
|
|
120
|
+
width: number;
|
|
121
|
+
annotations?: AnnotationPageDescription;
|
|
122
|
+
};
|
|
123
|
+
type UnknownStrategy = {
|
|
124
|
+
type: 'unknown';
|
|
125
|
+
reason?: string;
|
|
126
|
+
annotations?: AnnotationPageDescription;
|
|
127
|
+
};
|
|
128
|
+
type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | Single3DModelStrategy | TextualContentStrategy | UnknownStrategy | EmptyStrategy;
|
|
129
|
+
|
|
130
|
+
type StrategyActions = {
|
|
131
|
+
makeChoice: (id: string, options?: {
|
|
132
|
+
deselectOthers?: boolean;
|
|
133
|
+
deselect?: boolean;
|
|
134
|
+
}) => void;
|
|
135
|
+
};
|
|
136
|
+
type UseRenderingStrategy = [RenderingStrategy, StrategyActions];
|
|
137
|
+
type UseRenderingStrategyOptions = {
|
|
138
|
+
strategies?: Array<RenderingStrategy['type']>;
|
|
139
|
+
annotationPageManagerId?: string;
|
|
140
|
+
enableSingleAnnotation?: boolean;
|
|
141
|
+
defaultChoices?: string[];
|
|
142
|
+
};
|
|
143
|
+
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
144
|
+
|
|
145
|
+
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type TextualContentStrategy as T, type UnknownStrategy as U, type VideoSequence as V, type SingleImageStrategy as a, type SingleAudio as b, type SingleVideo as c, type SingleYouTubeVideo as d, type AnnotationPageDescription as e, getTextualContentStrategy as f, getImageStrategy as g, type Single3DModelStrategy as h, get3dStrategy as i, type ImageServiceLoaderType as j, type UseRenderingStrategy as k, type UseRenderingStrategyOptions as l, useRenderingStrategy as m, useLoadImageService as u };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { ChoiceDescription, Paintables, SupportedTarget } from '@iiif/helpers';
|
|
2
|
+
import { ImageService, ExternalWebResource, InternationalString } from '@iiif/presentation-3';
|
|
3
|
+
import { AnnotationPageNormalized, CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
4
|
+
import { BoxSelector, TemporalBoxSelector, TemporalSelector } from '@iiif/helpers/annotation-targets';
|
|
5
|
+
|
|
6
|
+
type ImageWithOptionalService = {
|
|
7
|
+
id: string;
|
|
8
|
+
annotationId: string;
|
|
9
|
+
type: 'Image';
|
|
10
|
+
service?: ImageService;
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
sizes?: Array<{
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}>;
|
|
17
|
+
target: BoxSelector | TemporalBoxSelector;
|
|
18
|
+
selector?: BoxSelector;
|
|
19
|
+
};
|
|
20
|
+
type SingleAudio = {
|
|
21
|
+
type: 'Sound';
|
|
22
|
+
annotationId: string;
|
|
23
|
+
url: string;
|
|
24
|
+
format: string;
|
|
25
|
+
duration: number;
|
|
26
|
+
target: TemporalSelector;
|
|
27
|
+
/**
|
|
28
|
+
* Which part of this audio should be used (cropping).
|
|
29
|
+
*/
|
|
30
|
+
selector: TemporalSelector;
|
|
31
|
+
};
|
|
32
|
+
type SingleYouTubeVideo = {
|
|
33
|
+
type: 'VideoYouTube';
|
|
34
|
+
annotationId: string;
|
|
35
|
+
url: string;
|
|
36
|
+
youTubeId: string;
|
|
37
|
+
duration: number;
|
|
38
|
+
target: TemporalSelector | TemporalBoxSelector;
|
|
39
|
+
selector: TemporalSelector | TemporalBoxSelector;
|
|
40
|
+
};
|
|
41
|
+
type SingleVideo = {
|
|
42
|
+
type: 'Video';
|
|
43
|
+
annotationId: string;
|
|
44
|
+
url: string;
|
|
45
|
+
format: string;
|
|
46
|
+
duration: number;
|
|
47
|
+
/**
|
|
48
|
+
* Where on the canvas should this section of video be painted.
|
|
49
|
+
*/
|
|
50
|
+
target: TemporalSelector | TemporalBoxSelector;
|
|
51
|
+
/**
|
|
52
|
+
* Which part of this video should be painted.
|
|
53
|
+
*/
|
|
54
|
+
selector: TemporalSelector | TemporalBoxSelector;
|
|
55
|
+
};
|
|
56
|
+
type AudioSequence = {
|
|
57
|
+
type: 'SoundSequence';
|
|
58
|
+
items: SingleAudio[];
|
|
59
|
+
};
|
|
60
|
+
type VideoSequence = {
|
|
61
|
+
type: 'VideoSequence';
|
|
62
|
+
items: SingleVideo[];
|
|
63
|
+
};
|
|
64
|
+
type AnnotationPageDescription = {
|
|
65
|
+
pages: AnnotationPageNormalized[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type ImageServiceLoaderType = (imageService: any | undefined, { height, width }: {
|
|
69
|
+
height: number;
|
|
70
|
+
width: number;
|
|
71
|
+
}) => ImageService | undefined;
|
|
72
|
+
declare function useLoadImageService(): readonly [ImageServiceLoaderType, Record<string, string>];
|
|
73
|
+
|
|
74
|
+
type SingleImageStrategy = {
|
|
75
|
+
type: 'images';
|
|
76
|
+
image: ImageWithOptionalService;
|
|
77
|
+
images: Array<ImageWithOptionalService>;
|
|
78
|
+
choice?: ChoiceDescription;
|
|
79
|
+
annotations?: AnnotationPageDescription;
|
|
80
|
+
};
|
|
81
|
+
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): RenderingStrategy;
|
|
82
|
+
|
|
83
|
+
type Single3DModelStrategy = {
|
|
84
|
+
type: '3d-model';
|
|
85
|
+
model: ExternalWebResource;
|
|
86
|
+
choice?: ChoiceDescription;
|
|
87
|
+
annotations?: AnnotationPageDescription;
|
|
88
|
+
};
|
|
89
|
+
declare function get3dStrategy(canvas: CanvasNormalized, paintables: Paintables): RenderingStrategy;
|
|
90
|
+
|
|
91
|
+
type TextualContentStrategy = {
|
|
92
|
+
type: 'textual-content';
|
|
93
|
+
items: {
|
|
94
|
+
annotationId: string;
|
|
95
|
+
text: InternationalString;
|
|
96
|
+
target: SupportedTarget | null;
|
|
97
|
+
}[];
|
|
98
|
+
choice?: ChoiceDescription;
|
|
99
|
+
annotations?: AnnotationPageDescription;
|
|
100
|
+
};
|
|
101
|
+
declare function getTextualContentStrategy(canvas: CanvasNormalized, paintables: Paintables): RenderingStrategy;
|
|
102
|
+
|
|
103
|
+
type MediaStrategy = {
|
|
104
|
+
type: 'media';
|
|
105
|
+
media: SingleAudio | SingleVideo | AudioSequence | VideoSequence | SingleYouTubeVideo;
|
|
106
|
+
choice?: ChoiceDescription;
|
|
107
|
+
annotations?: AnnotationPageDescription;
|
|
108
|
+
};
|
|
109
|
+
type ComplexTimelineStrategy = {
|
|
110
|
+
type: 'complex-timeline';
|
|
111
|
+
items: Array<ImageWithOptionalService | SingleAudio | SingleVideo>;
|
|
112
|
+
choice?: ChoiceDescription;
|
|
113
|
+
annotations?: AnnotationPageDescription;
|
|
114
|
+
};
|
|
115
|
+
type EmptyStrategy = {
|
|
116
|
+
type: 'empty';
|
|
117
|
+
image: null;
|
|
118
|
+
images: [];
|
|
119
|
+
height: number;
|
|
120
|
+
width: number;
|
|
121
|
+
annotations?: AnnotationPageDescription;
|
|
122
|
+
};
|
|
123
|
+
type UnknownStrategy = {
|
|
124
|
+
type: 'unknown';
|
|
125
|
+
reason?: string;
|
|
126
|
+
annotations?: AnnotationPageDescription;
|
|
127
|
+
};
|
|
128
|
+
type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | Single3DModelStrategy | TextualContentStrategy | UnknownStrategy | EmptyStrategy;
|
|
129
|
+
|
|
130
|
+
type StrategyActions = {
|
|
131
|
+
makeChoice: (id: string, options?: {
|
|
132
|
+
deselectOthers?: boolean;
|
|
133
|
+
deselect?: boolean;
|
|
134
|
+
}) => void;
|
|
135
|
+
};
|
|
136
|
+
type UseRenderingStrategy = [RenderingStrategy, StrategyActions];
|
|
137
|
+
type UseRenderingStrategyOptions = {
|
|
138
|
+
strategies?: Array<RenderingStrategy['type']>;
|
|
139
|
+
annotationPageManagerId?: string;
|
|
140
|
+
enableSingleAnnotation?: boolean;
|
|
141
|
+
defaultChoices?: string[];
|
|
142
|
+
};
|
|
143
|
+
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
144
|
+
|
|
145
|
+
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type TextualContentStrategy as T, type UnknownStrategy as U, type VideoSequence as V, type SingleImageStrategy as a, type SingleAudio as b, type SingleVideo as c, type SingleYouTubeVideo as d, type AnnotationPageDescription as e, getTextualContentStrategy as f, getImageStrategy as g, type Single3DModelStrategy as h, get3dStrategy as i, type ImageServiceLoaderType as j, type UseRenderingStrategy as k, type UseRenderingStrategyOptions as l, useRenderingStrategy as m, useLoadImageService as u };
|
package/dist/utils.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var f=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},D=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of z(t))!O.call(e,o)&&o!==r&&f(e,o,{get:()=>t[o],enumerable:!(i=b(t,o))||i.enumerable});return e};var A=e=>D(f({},"__esModule",{value:!0}),e);var V={};B(V,{emptyActions:()=>k,emptyStrategy:()=>y,getParsedTargetSelector:()=>c,getRenderingStrategy:()=>M,parseSpecificResource:()=>W,unknownResponse:()=>l,unsupportedStrategy:()=>n});module.exports=A(V);var x=require("@iiif/helpers");function W(e){return e.type==="SpecificResource"?[e.source,{selector:e.selector}]:[e,{selector:null}]}function c(e,t){let{selector:r,source:i}=(0,x.expandTarget)(t);if(i.id!==e.id)return[null,i];let o={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}};return[r?r.type==="TemporalSelector"?{type:"TemporalBoxSelector",temporal:r.temporal,spatial:o.spatial}:r:null,i]}var k={makeChoice:()=>{}},l={type:"unknown"},n=e=>({type:"unknown",reason:e,annotations:{pages:[]}}),y=(e,t)=>({type:"empty",width:e,height:t,annotations:{pages:[]},image:null,images:[]});var U=["model/gltf-binary"];function T(e,t){let i=t.items[0].resource;return i.format?U.indexOf(i.format)===-1?n(`3D format: ${i.format} is unsupported`):{type:"3d-model",model:i}:n("Unknown format")}function I(e,t){if(!e.duration)return n("No duration on canvas");if(t.items.length>1)return n("Only one audio source supported");let r=t.items[0]?.resource;return r?r.format?{type:"media",media:{annotationId:t.items[0].annotationId,duration:e.duration,url:r.id,type:"Sound",target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:r.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}},annotations:{pages:[]}}:n("Audio does not have format"):n("Unknown audio")}var C=require("@atlas-viewer/iiif-image-api");var S=require("@iiif/helpers/annotation-targets");function v(e,t,r){let i=[];for(let o of t.items){let a=o.resource&&o.resource.type==="SpecificResource"?o.resource.source:o.resource;if(!a.id)return n("No resource Identifier");let s;if(a.service){let u=(0,C.getImageServices)(a);u[0]&&(s=r(u[0],e))}let p={type:"BoxSelector",spatial:{x:0,y:0,width:Number(e.width),height:Number(e.height)}},[d,h]=c(e,o.target);if(!(h.id===e.id||decodeURIComponent(h.id||"")===(e.id||"")))continue;let L=o.resource.width&&o.resource.height?{type:"BoxSelector",spatial:{x:0,y:0,width:o.resource.width,height:o.resource.height}}:void 0,m=o.resource.type==="SpecificResource"?(0,S.expandTarget)(o.resource):null;if(o.selector){let u=(0,S.expandTarget)({type:"SpecificResource",source:o.resource,selector:o.selector});u&&(m=u)}let g=m&&m.selector&&(m.selector.type==="BoxSelector"||m.selector.type==="TemporalBoxSelector")?{type:"BoxSelector",spatial:{x:m.selector.spatial.x,y:m.selector.spatial.y,width:m.selector.spatial.width,height:m.selector.spatial.height}}:void 0;s&&!s.id&&(s.id=s["@id"]);let N={id:a.id,type:"Image",annotationId:o.annotationId,width:Number(d||g?a.width:e.width),height:Number(d||g?a.height:e.height),service:s,sizes:s&&s.sizes?s.sizes:a.width&&a.height?[{width:a.width,height:a.height}]:[],target:d&&d.type!=="PointSelector"?d:p,selector:g};i.push(N)}return{type:"images",image:i[0],images:i,choice:t.choice}}function R(e,t={},r){let i=e.language||r||"none";switch(e.type){case"TextualBody":{typeof e.value<"u"&&(t[i]=e.value);break}case"List":case"Composite":case"Choice":e.items&&e.items.forEach(o=>R(o,t,i))}return t}function w(e,t){let r=[];return t.items.forEach(i=>{if(i.resource){let[o]=c(e,i.target);r.push({annotationId:i.annotationId,text:R(i.resource),target:o})}}),{type:"textual-content",items:r}}var E=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function P(e,t){let r=t.items.filter(p=>p.type==="video"),i=!1;if(e.duration||(i=!0),r.length>1)return n("Only one video source supported");let o=r[0]?.resource,a=!!(o.service||[]).find(p=>(p.profile||"").includes("youtube.com"));if(!a&&i)return n("Video does not have duration");if(!o)return n("Unknown video");if((!o.format||o.format==="text/html")&&!a)return n("Video does not have format");let s={annotationId:t.items[0].annotationId,duration:e.duration,url:o.id,type:"Video",items:[],target:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}},format:o.format,selector:{type:"TemporalSelector",temporal:{startTime:0,endTime:e.duration}}};if(a){s.type="VideoYouTube";let p=o.id.match(E);if(!p[1])return n("Video is not known youtube video");s.youTubeId=p[1]}return{type:"media",media:s,annotations:{pages:[]}}}function M({canvas:e,paintables:t,supports:r,loadImageService:i}){if(!e)return console.log("No canvas"),l;if(t.types.length===0)return r.indexOf("empty")!==-1?y(e.width,e.height):(console.log("No paintables"),l);if(t.types.length!==1)if(t.types.length===2&&t.types.indexOf("text")!==-1)t.types=t.types.filter(a=>a!=="text");else return r.indexOf("complex-timeline")===-1?n("Complex timeline not supported"):n("ComplexTimelineStrategy not yet supported");let o=t.types[0];return o==="image"?r.indexOf("images")===-1?n("Image not supported"):v(e,t,i):o==="Model"||o==="model"?r.indexOf("3d-model")===-1?n("3D not supported"):T(e,t):o==="textualbody"?r.indexOf("textual-content")===-1?n("Textual content not supported"):w(e,t):o==="sound"||o==="audio"?r.indexOf("media")===-1?n("Media not supported"):I(e,t):o==="video"?r.indexOf("media")===-1?n("Media not supported"):P(e,t):l}
|
package/dist/utils.d.cts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { k as UseRenderingStrategy, R as RenderingStrategy, j as ImageServiceLoaderType } from './useRenderingStrategy-Xj9yQm4y.cjs';
|
|
2
|
+
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
|
+
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
|
+
import { ContentResource, W3CAnnotationTarget, PointSelector } from '@iiif/presentation-3';
|
|
5
|
+
import { TemporalBoxSelector, BoxSelector, SupportedTarget } from '@iiif/helpers';
|
|
6
|
+
import '@iiif/helpers/annotation-targets';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Parse specific resource.
|
|
10
|
+
*
|
|
11
|
+
* This could be expanded to support pulling out more from the specific resource.
|
|
12
|
+
*
|
|
13
|
+
* @param resource
|
|
14
|
+
*/
|
|
15
|
+
declare function parseSpecificResource(resource: ContentResource): any[];
|
|
16
|
+
declare function getParsedTargetSelector(canvas: CanvasNormalized, target: W3CAnnotationTarget | W3CAnnotationTarget[]): [TemporalBoxSelector | BoxSelector | PointSelector | null, SupportedTarget['source']];
|
|
17
|
+
declare const emptyActions: {
|
|
18
|
+
makeChoice: () => void;
|
|
19
|
+
};
|
|
20
|
+
declare const unknownResponse: UseRenderingStrategy[0];
|
|
21
|
+
declare const unsupportedStrategy: (reason: string) => UseRenderingStrategy[0];
|
|
22
|
+
declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
|
|
23
|
+
|
|
24
|
+
interface GetRenderStrategyOptions {
|
|
25
|
+
canvas: CanvasNormalized | null | undefined;
|
|
26
|
+
paintables: Paintables;
|
|
27
|
+
supports: string[];
|
|
28
|
+
loadImageService: ImageServiceLoaderType;
|
|
29
|
+
}
|
|
30
|
+
declare function getRenderingStrategy({ canvas, paintables, supports, loadImageService }: GetRenderStrategyOptions): RenderingStrategy;
|
|
31
|
+
|
|
32
|
+
export { emptyActions, emptyStrategy, getParsedTargetSelector, getRenderingStrategy, parseSpecificResource, unknownResponse, unsupportedStrategy };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { k as UseRenderingStrategy, R as RenderingStrategy, j as ImageServiceLoaderType } from './useRenderingStrategy-Xj9yQm4y.js';
|
|
2
|
+
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
|
+
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
|
+
import { ContentResource, W3CAnnotationTarget, PointSelector } from '@iiif/presentation-3';
|
|
5
|
+
import { TemporalBoxSelector, BoxSelector, SupportedTarget } from '@iiif/helpers';
|
|
6
|
+
import '@iiif/helpers/annotation-targets';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Parse specific resource.
|
|
10
|
+
*
|
|
11
|
+
* This could be expanded to support pulling out more from the specific resource.
|
|
12
|
+
*
|
|
13
|
+
* @param resource
|
|
14
|
+
*/
|
|
15
|
+
declare function parseSpecificResource(resource: ContentResource): any[];
|
|
16
|
+
declare function getParsedTargetSelector(canvas: CanvasNormalized, target: W3CAnnotationTarget | W3CAnnotationTarget[]): [TemporalBoxSelector | BoxSelector | PointSelector | null, SupportedTarget['source']];
|
|
17
|
+
declare const emptyActions: {
|
|
18
|
+
makeChoice: () => void;
|
|
19
|
+
};
|
|
20
|
+
declare const unknownResponse: UseRenderingStrategy[0];
|
|
21
|
+
declare const unsupportedStrategy: (reason: string) => UseRenderingStrategy[0];
|
|
22
|
+
declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
|
|
23
|
+
|
|
24
|
+
interface GetRenderStrategyOptions {
|
|
25
|
+
canvas: CanvasNormalized | null | undefined;
|
|
26
|
+
paintables: Paintables;
|
|
27
|
+
supports: string[];
|
|
28
|
+
loadImageService: ImageServiceLoaderType;
|
|
29
|
+
}
|
|
30
|
+
declare function getRenderingStrategy({ canvas, paintables, supports, loadImageService }: GetRenderStrategyOptions): RenderingStrategy;
|
|
31
|
+
|
|
32
|
+
export { emptyActions, emptyStrategy, getParsedTargetSelector, getRenderingStrategy, parseSpecificResource, unknownResponse, unsupportedStrategy };
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o,b as r,c as e,d as f,e as m,f as p,k as t}from"./chunk-YSH2CIKG.js";export{e as emptyActions,p as emptyStrategy,r as getParsedTargetSelector,t as getRenderingStrategy,o as parseSpecificResource,f as unknownResponse,m as unsupportedStrategy};
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-iiif-vault",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"web": "dist/bundle.global.js",
|
|
7
9
|
"files": [
|
|
8
|
-
".build",
|
|
9
10
|
"dist"
|
|
10
11
|
],
|
|
11
12
|
"contributors": [
|
|
@@ -13,87 +14,83 @@
|
|
|
13
14
|
],
|
|
14
15
|
"exports": {
|
|
15
16
|
".": {
|
|
16
|
-
"require":
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./dist/index.d.cts",
|
|
19
|
+
"default": "./dist/index.cjs"
|
|
20
|
+
},
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
20
25
|
},
|
|
21
26
|
"./canvas-panel": {
|
|
22
|
-
"require":
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/canvas-panel.d.cts",
|
|
29
|
+
"default": "./dist/canvas-panel.cjs"
|
|
30
|
+
},
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/canvas-panel.d.ts",
|
|
33
|
+
"default": "./dist/canvas-panel.js"
|
|
34
|
+
}
|
|
25
35
|
},
|
|
26
36
|
"./utils": {
|
|
27
|
-
"require":
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"typesVersions": {
|
|
38
|
-
"*": {
|
|
39
|
-
"*": [
|
|
40
|
-
".build/types/index.d.ts"
|
|
41
|
-
],
|
|
42
|
-
"utils": [
|
|
43
|
-
".build/types/utils.d.ts"
|
|
44
|
-
],
|
|
45
|
-
"canvas-panel": [
|
|
46
|
-
".build/types/canvas-panel/index.d.ts"
|
|
47
|
-
]
|
|
37
|
+
"require": {
|
|
38
|
+
"types": "./dist/utils.d.cts",
|
|
39
|
+
"default": "./dist/utils.cjs"
|
|
40
|
+
},
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/utils.d.ts",
|
|
43
|
+
"default": "./dist/utils.js"
|
|
44
|
+
}
|
|
48
45
|
}
|
|
49
46
|
},
|
|
50
47
|
"scripts": {
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"test": "vitest"
|
|
48
|
+
"build": "tsup && tsup --config tsup.umd.ts",
|
|
49
|
+
"dev": "tsup --watch",
|
|
50
|
+
"typecheck": "tsc --noEmit",
|
|
51
|
+
"test": "vitest",
|
|
52
|
+
"prepack": "tsup && tsup --config tsup.umd.ts",
|
|
53
|
+
"lint": "publint",
|
|
54
|
+
"start": "vite"
|
|
55
55
|
},
|
|
56
56
|
"license": "MIT",
|
|
57
|
+
"resolutions": {
|
|
58
|
+
"react-reconciler": "0.29"
|
|
59
|
+
},
|
|
57
60
|
"dependencies": {
|
|
58
|
-
"@atlas-viewer/atlas": "
|
|
59
|
-
"@atlas-viewer/iiif-image-api": "
|
|
60
|
-
"@iiif/helpers": "
|
|
61
|
-
"@iiif/parser": "
|
|
62
|
-
"@iiif/presentation-2": "
|
|
63
|
-
"@iiif/presentation-3": "
|
|
64
|
-
"@iiif/presentation-3-normalized": "
|
|
65
|
-
"react": "^
|
|
66
|
-
"react-
|
|
67
|
-
"react-
|
|
68
|
-
"
|
|
61
|
+
"@atlas-viewer/atlas": "^2.2.2",
|
|
62
|
+
"@atlas-viewer/iiif-image-api": "^2.2.0",
|
|
63
|
+
"@iiif/helpers": "^1.1.0",
|
|
64
|
+
"@iiif/parser": "^2.1.0",
|
|
65
|
+
"@iiif/presentation-2": "^1.0.4",
|
|
66
|
+
"@iiif/presentation-3": "^2.2.2",
|
|
67
|
+
"@iiif/presentation-3-normalized": "^0.9.7",
|
|
68
|
+
"react-error-boundary": "^4.0.13",
|
|
69
|
+
"react-lazy-load-image-component": "^1.6.0",
|
|
70
|
+
"react-reconciler": "~0.29.0",
|
|
71
|
+
"zustand": "^4.5.2"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"react": "^18.2.0",
|
|
75
|
+
"react-dom": "^18.2.0"
|
|
69
76
|
},
|
|
70
77
|
"devDependencies": {
|
|
71
|
-
"@testing-library/react": "^14.
|
|
72
|
-
"@
|
|
73
|
-
"@types/react": "^18.2.
|
|
74
|
-
"@types/react-dom": "^18.2.19",
|
|
78
|
+
"@testing-library/react": "^14.3.0",
|
|
79
|
+
"@types/react": "^18.2.75",
|
|
80
|
+
"@types/react-dom": "^18.2.24",
|
|
75
81
|
"@types/react-lazy-load-image-component": "^1.6.3",
|
|
76
|
-
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
77
|
-
"@typescript-eslint/parser": "7.0.1",
|
|
78
82
|
"@vitejs/plugin-react": "^4.2.1",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
83
|
-
"happy-dom": "^13.3.8",
|
|
83
|
+
"esbuild-plugin-globals": "^0.2.0",
|
|
84
|
+
"esbuild-plugin-umd-wrapper": "^2.0.0",
|
|
85
|
+
"happy-dom": "^14.7.1",
|
|
84
86
|
"prettier": "^3.2.5",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"react-17": "npm:react@17",
|
|
88
|
-
"react-18": "npm:react@18",
|
|
89
|
-
"react-dom-16": "npm:react-dom@16",
|
|
90
|
-
"react-dom-17": "npm:react-dom@17",
|
|
91
|
-
"react-dom-18": "npm:react-dom@18",
|
|
87
|
+
"publint": "^0.2.7",
|
|
88
|
+
"query-string": "^9.0.0",
|
|
92
89
|
"tslib": "^2.6.2",
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
90
|
+
"tsup": "^8.0.2",
|
|
91
|
+
"typescript": "^5.4.4",
|
|
92
|
+
"vite": "^5.2.8",
|
|
93
|
+
"vitest": "^1.4.0"
|
|
97
94
|
},
|
|
98
95
|
"publishConfig": {
|
|
99
96
|
"access": "public"
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { AtlasProps } from '@atlas-viewer/atlas';
|
|
3
|
-
export declare function Viewer({ children, errorFallback, outerContainerProps, worldScale: _worldScale, ...props }: AtlasProps & {
|
|
4
|
-
height?: number | string;
|
|
5
|
-
width?: number | string;
|
|
6
|
-
resizeHash?: number;
|
|
7
|
-
containerProps?: any;
|
|
8
|
-
outerContainerProps?: any;
|
|
9
|
-
aspectRatio?: number;
|
|
10
|
-
errorFallback?: any;
|
|
11
|
-
worldScale?: number;
|
|
12
|
-
} & {
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
}): import("react/jsx-dev-runtime").JSX.Element;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const SetOverlaysReactContext: import("react").Context<(key: string, element: any | null, props?: any) => void>;
|
|
2
|
-
export declare const SetPortalReactContext: import("react").Context<(key: string, element: any | null, props?: any) => void>;
|
|
3
|
-
export declare function useOverlay(type: 'portal' | 'overlay' | 'none', key: string, element: any, props: any, deps?: any[]): void;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { FC, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
2
|
-
import { Viewer } from './Viewer';
|
|
3
|
-
import { RenderAnnotation } from './render/Annotation';
|
|
4
|
-
import { RenderAnnotationPage } from './render/AnnotationPage';
|
|
5
|
-
import { CanvasProps, RenderCanvas } from './render/Canvas';
|
|
6
|
-
import { RenderImage } from './render/Image';
|
|
7
|
-
import { CanvasBackground } from './render/CanvasBackground';
|
|
8
|
-
import { SimpleViewerContext } from '../viewers/SimpleViewerContext.types';
|
|
9
|
-
import { Audio, AudioHTML } from './render/Audio';
|
|
10
|
-
import { Video, VideoHTML } from './render/Video';
|
|
11
|
-
import { Model, ModelHTML } from './render/Model';
|
|
12
|
-
import { ViewerMode } from '@atlas-viewer/atlas';
|
|
13
|
-
interface CanvasPanelProps {
|
|
14
|
-
manifest: string;
|
|
15
|
-
startCanvas?: string;
|
|
16
|
-
rangeId?: string;
|
|
17
|
-
pagingEnabled?: boolean;
|
|
18
|
-
header?: ReactNode;
|
|
19
|
-
children?: ReactNode;
|
|
20
|
-
mode?: ViewerMode;
|
|
21
|
-
reuseAtlas?: boolean;
|
|
22
|
-
height?: number;
|
|
23
|
-
spacing?: number;
|
|
24
|
-
components?: {
|
|
25
|
-
ViewerControls?: FC;
|
|
26
|
-
MediaControls?: FC;
|
|
27
|
-
};
|
|
28
|
-
canvasProps?: Omit<Partial<CanvasProps>, 'x'>;
|
|
29
|
-
annotations?: ReactNode;
|
|
30
|
-
}
|
|
31
|
-
type CanvasPanelType = ForwardRefExoticComponent<CanvasPanelProps & RefAttributes<SimpleViewerContext>> & {
|
|
32
|
-
RenderImage: typeof RenderImage;
|
|
33
|
-
RenderCanvas: typeof RenderCanvas;
|
|
34
|
-
RenderAnnotationPage: typeof RenderAnnotationPage;
|
|
35
|
-
RenderAnnotation: typeof RenderAnnotation;
|
|
36
|
-
Viewer: typeof Viewer;
|
|
37
|
-
CanvasBackground: typeof CanvasBackground;
|
|
38
|
-
Audio: typeof Audio;
|
|
39
|
-
Video: typeof Video;
|
|
40
|
-
Model: typeof Model;
|
|
41
|
-
AudioHTML: typeof AudioHTML;
|
|
42
|
-
VideoHTML: typeof VideoHTML;
|
|
43
|
-
ModelHTML: typeof ModelHTML;
|
|
44
|
-
};
|
|
45
|
-
export declare const CanvasPanel: CanvasPanelType;
|
|
46
|
-
export {};
|