@manifest-editor/shell 2.0.1-next.0.d468080 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +31 -31
- package/dist/index.d.cts +48 -47
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -984,6 +984,6 @@ import{ActionButton as e,CreatorGrid as t,DefaultTooltipContent as n,DownloadBut
|
|
|
984
984
|
flex: 1;
|
|
985
985
|
min-width: 0;
|
|
986
986
|
overflow: hidden;
|
|
987
|
-
`,Qi=ue(function(e){let t=dt(),n=Ln(),{vault:r}=k(xe),i=r||void 0,a=N(null),o=N(null),{loading:s,state:c,leftPanels:l,centerPanels:u,rightPanels:f,modals:p=[],actions:h}=n,g=l.find(e=>e.id===c.leftPanel.current),_=f.find(e=>e.id===c.rightPanel.current),v=u.find(e=>e.id===c.centerPanel.current),y=p.find(e=>e.id===c.modal.current),b=c.pinnedRightPanel.pinned?f.find(e=>e.id===c.pinnedRightPanel.current):void 0,[ee]=_i([`(max-width: 1020px)`]),x=e.isLoading||!1,te=j(()=>(n.background||[]).map((e,t)=>I(ae,{children:e.render()},t)),[n.background]),S=Mi(`left-panel/${g?.id}`,{left:!0,marginLeft:60,minWidthPx:g?.options?.minWidth||200,maxWidthPx:g?.options?.maxWidth||720,loading:s}),C=Mi(`right-panel/${_?.id}`,{left:!1,minWidthPx:_?.options?.minWidth||320,maxWidthPx:_?.options?.maxWidth||720,loading:s}),w=_&&(b?.id!==_.id||!Ze(c.pinnedRightPanel.state,c.rightPanel.state)),T=S.widthB===`auto`?void 0:()=>S.setWidths({widthA:`auto`,widthB:Bn({options:g?.options,fallback:320})}),E=C.widthB===`auto`?void 0:()=>C.setWidths({widthA:`auto`,widthB:Bn({options:_?.options,fallback:320})});if(fe(()=>{ee&&c.leftPanel.open&&c.rightPanel.open&&(h.leftPanel.close(),h.rightPanel.close())},[ee]),fe(()=>{if(v&&v.onMount)return v.onMount(c.centerPanel.state||v.defaultState||{},{...n,current:h.centerPanel,vault:i},t)},[c.centerPanel.current]),fe(()=>{f.length&&h.rightPanel.change({id:f[0].id}),l.length&&h.leftPanel.change({id:l[0].id}),u.length&&h.centerPanel.change({id:u[0].id})},[]),s)return null;let ne=t=>I(Xi,{$menu:e.leftPanelMenuPosition||`bottom`,ref:S.refs.resizableDiv,className:[`manifest-editor`,t?`transition transition-${t}`:``].join(` `),style:{width:c.leftPanel.open||t!==`exited`?S.widthB:void 0,minWidth:g?.options?.minWidth},children:x?I(Zi,{children:I(Oi,{})}):L(F,{children:[e.leftPanelMenu?I(X,{$open:c.leftPanel.open&&t!==`exited`,$position:e.leftPanelMenuPosition||`bottom`,children:e.leftPanelMenu}):null,I(Zi,{children:c.leftPanel.open||t!==`exited`?I(F,{children:g?I(er,{isLeft:!0,noHeader:!0,transition:t,panel:g,state:c.leftPanel,actions:h.leftPanel}):null}):null})]})}),re=()=>!y||c.modal.open===!1?null:I(d,{title:y.label,onClose:()=>h.modal.close(),children:Vn(y.render(c.modal.state||y.defaultState||{},{...n,current:h.modal,vault:i},t))}),ie=()=>L(Xi,{$menu:e.centerPanelMenuPosition||`top`,children:[e.centerPanelMenu?I(X,{$open:c.centerPanel.open,$position:e.centerPanelMenuPosition||`top`,children:e.centerPanelMenu}):null,I(Zi,{children:I(Be,{resetKeys:[v?.id],FallbackComponent:Rn,children:x?I(`div`,{style:{display:`flex`,flex:1,justifyContent:`center`,alignItems:`center`},children:I(Di,{stroke:`rgba(0,0,0,.3)`,fontSize:`2em`})}):c.centerPanel.open&&v?Vn(v.render(c.centerPanel.state||v.defaultState||{},{...n,current:h.centerPanel,vault:i},t)):null})})]}),oe=t=>I(Xi,{$menu:e.rightPanelMenuPosition||`bottom`,ref:C.refs.resizableDiv,className:t?`transition transition-${t}`:``,style:{width:c.rightPanel.open||t!==`exited`?C.widthB:void 0,minWidth:_?.options?.minWidth},children:x?I(Zi,{children:I(Oi,{})}):L(F,{children:[e.rightPanelMenu?I(X,{$open:c.rightPanel.open,$position:e.rightPanelMenuPosition||`bottom`,children:e.rightPanelMenu}):null,I(Zi,{children:c.rightPanel.open||t!==`exited`?L(F,{children:[w?I(er,{panel:_,state:c.rightPanel,actions:h.rightPanel,pinActions:h.pinnedRightPanel,available:f}):null,b?I(er,{panel:b,state:c.pinnedRightPanel,actions:h.pinnedRightPanel,close:h.rightPanel.close}):null]}):null})]})});return ee?L(Ui,{children:[e.hideHeader?null:L(Wi,{children:[e.header||null,e.menu?I(`menu`,{children:e.menu}):null]}),I(Ki,{children:L(Ni,{children:[I(Pi,{children:ie()}),L(Fi,{children:[l.length>0?I(Ii,{onClick:h.leftPanel.toggle,children:g?.label}):null,f.length>0?I(Ri,{children:L(zi,{onClick:h.rightPanel.toggle,children:[I(St,{rotate:180}),_?.label]})}):null,I(Li,{children:`Preview`})]}),f.length>0?I(Bi,{$open:c.rightPanel.open,children:oe()}):null,l.length>0?I(Vi,{$open:c.leftPanel.open,children:ne()}):null,l.length>0||f.length>0?I(Hi,{$open:c.leftPanel.open||c.rightPanel.open,onClick:()=>{h.leftPanel.close(),h.rightPanel.close()}}):null]})})]}):L(Ui,{className:`manifest-editor ${e.className}`,children:[e.hideHeader?null:L(Wi,{children:[e.header||null,e.menu?I(`menu`,{children:e.menu}):null]}),L(Ki,{ref:e=>{S.refs.container.current=e,C.refs.container.current=e},children:[l.length>0?I(m,{current:c.leftPanel.current,items:l.map(e=>({id:e.id,label:e.label,icon:e.icon,divide:e.divide,onClick:()=>{c.leftPanel.current===e.id?h.leftPanel.toggle():h.leftPanel.change({id:e.id})}})),open:c.leftPanel.open}):null,l.length>0?I(Xe,{nodeRef:a,in:c.leftPanel.open,timeout:400,unmountOnExit:!1,children:e=>L(F,{children:[I(qi,{ref:a,$width:S.widthB,$state:e,$motion:!0,children:ne(e)}),I(Ei,{ref:S.refs.resizer,reset:T,dir:`left`,transition:e,open:c.leftPanel.open||e!==`exited`,actions:h.leftPanel})]})}):null,I(Ji,{children:ie()}),f.length>0?I(Xe,{nodeRef:o,in:c.rightPanel.open,timeout:400,unmountOnExit:!1,children:e=>L(F,{children:[I(Ei,{ref:C.refs.resizer,dir:`right`,reset:E,open:c.rightPanel.open,actions:h.rightPanel}),I(Yi,{ref:o,$width:C.widthB,$state:e,$motion:!0,children:oe(e)})]})}):null]}),I(Gi,{children:e.footer||null}),I(`div`,{className:`hidden`,children:te}),I(F,{children:re()})]})});function Z(e,t){function n(){t({type:`popStack`,panel:e,payload:void 0})}function r(n){t({type:`change`,panel:e,payload:n})}function i(n){t({type:`open`,panel:e,payload:n})}function a(){t({type:`close`,panel:e,payload:void 0})}function o(){t({type:`toggle`,panel:e,payload:void 0})}function s(){t({type:`minimise`,panel:e,payload:void 0})}function c(n){t({type:`maximise`,panel:e,payload:n})}function l(n){t({type:`setCustomWidth`,panel:e,payload:n})}function u(){t({type:`resetSize`,panel:e,payload:void 0})}function d(n){t({type:`pin`,panel:e,payload:n})}function f(){t({type:`unpin`,panel:e,payload:void 0})}return j(()=>({popStack:n,change:r,open:i,close:a,toggle:o,minimise:s,maximise:c,setCustomWidth:l,resetSize:u,pin:d,unpin:f}),[])}function $i(e,t){if(t.payload&&t.payload.stacked){if(e.current){let n=e.stack[e.stack.length-1];if(n&&n.id===e.current)return;t.payload.unique&&(e.stack=e.stack.filter(t=>t.id!==e.current)),e.stack.push({id:e.current,state:e.state?{...Ae(e.state)}:{}})}}else e.stack=[]}function ea(e,t){switch(t.type){case`popStack`:if(e.stack.length){let t=e.stack[e.stack.length-1];t&&(e.current=t.id,e.state=t.state),e.stack=e.stack.slice(0,-1)}break;case`change`:t.payload.id!==e.current&&$i(e,t),e.state=t.payload.state,e.current=t.payload.id;break;case`close`:e.open=!1;break;case`open`:e.open=!0,t.payload&&(t.payload.id!==e.current&&$i(e,t),e.state=t.payload.state,e.current=t.payload.id);break;case`toggle`:e.open=!e.open;break;case`maximise`:e.minimised=!1,t.payload&&(e.state=t.payload.state,e.current=t.payload.id);break;case`minimise`:e.minimised=!0;break;case`setCustomWidth`:e.customWidth=t.payload;break;case`resetSize`:e.customWidth=void 0}if(zn(e))switch(t.type){case`pin`:e.pinned=!0,e.state=t.payload.state,e.current=t.payload.id;break;case`unpin`:e.pinned=!1,e.state=void 0;break}}const ta=je((e,t)=>{switch(t.panel){case`centerPanel`:ea(e.centerPanel,t);break;case`leftPanel`:ea(e.leftPanel,t);break;case`rightPanel`:ea(e.rightPanel,t);break;case`modal`:ea(e.modal,t);break;case`pinnedRightPanel`:ea(e.pinnedRightPanel,t);break}});function Q(){return{customWidth:void 0,minimised:!1,open:!0,current:null,state:null,stack:[]}}function na(){return{leftPanel:Q(),centerPanel:Q(),rightPanel:Q(),modal:Q(),pinnedRightPanel:{...Q(),pinnable:!0,pinned:!1}}}const ra=D({resource:null});function ia(){return k(ra)}function aa(){let e=B(),{resource:t}=ia();U(t,`Nothing selected`);let{id:n,type:r}=t;return ke(()=>e.get({id:n,type:r}),[n,r])}function oa(){let{resource:e}=ia();return e}function sa({resource:e,children:t}){let{id:n,type:r}=e||{};return I(ra.Provider,{value:j(()=>({resource:n&&r?{id:n,type:r}:null}),[n,r]),children:t})}var ca=class extends ie{constructor(...e){super(...e),G(this,`state`,{hasError:!1})}static getDerivedStateFromError(e){return console.error(e),{hasError:!0}}componentDidCatch(e,t){console.error(`Uncaught error:`,e,t)}render(){return this.state.hasError?I(`h1`,{children:`Sorry.. there was an error`}):this.props.children}};function la(e,t){return typeof e==`string`?{id:e,state:t}:e}const ua=ue(function(e){let t=W(),n=hi(),r=t.layout,[i,a]=M(ta,void 0,na),o={centerPanel:Z(`centerPanel`,a),leftPanel:Z(`leftPanel`,a),rightPanel:Z(`rightPanel`,a),pinnedRightPanel:Z(`pinnedRightPanel`,a),modal:Z(`modal`,a),editingStack:vr()};function s(e){let t=r.rightPanels.find(t=>t.id===e);if(t)return[t,o.rightPanel,o.pinnedRightPanel];let n=r.centerPanels.find(t=>t.id===e);if(n)return[n,o.centerPanel];let i=r.leftPanels.find(t=>t.id===e);if(i)return[i,o.leftPanel];U(!1,`Was not able to find panel with id "${e}"`)}function c(e,t){let{id:r,state:i,stacked:a}=la(e,t),[o,c,l]=s(r);if(l&&o.options?.openPinned)l.pin({id:r,state:{...o.defaultState||{},...i||{}}});else{let e={id:r,state:{...o.defaultState||{},...i||{}},stacked:a};n.emit(`layout.open`,e),c.open(e)}}function l(e,t){let{id:r,state:i}=la(e,t),[a,o]=s(r),c={id:r,state:{...a.defaultState||{},...i||{}},stacked:!0};n.emit(`layout.open`,c),o.open(c)}function u(e,t){let{id:r,state:i,stacked:a}=la(e,t),[o,c]=s(r),l={id:r,state:{...o.defaultState||{},...i||{}},stacked:a};n.emit(`layout.change`,l),c.change(l)}function d(e,t){let{id:r}=la(e,t),[,i]=s(r);n.emit(`layout.close`,{id:r}),i.close()}function f(e,t){let{id:r}=la(e,t),[,i]=s(r);n.emit(`layout.toggle`,{id:r}),i.toggle()}function p(e,t={},{reset:i,property:a,stacked:s,forceOpen:c}={}){let l={resource:Fe(e)?e:{type:`SpecificResource`,source:e},...t};n.emit(`layout.edit`,l),o.editingStack.edit(l,i),r.rightPanels.find(e=>e.id===`@manifest-editor/editor`)&&(c?o.rightPanel.open({id:`@manifest-editor/editor`,stacked:s!==!1,state:{property:a},unique:!0}):o.rightPanel.change({id:`@manifest-editor/editor`,stacked:s!==!1,state:{property:a},unique:!0}))}function m(e){o.editingStack.create(e,{}),n.emit(`layout.create`,e),r.modals?.find(e=>e.id===`@manifest-editor/creator`)?o.modal.open({id:`@manifest-editor/creator`,stacked:!0,unique:!0,state:e}):r.rightPanels.find(e=>e.id===`@manifest-editor/creator`)&&o.rightPanel.open({id:`@manifest-editor/creator`,stacked:!0,unique:!0,state:e})}let h={open:c,change:u,close:d,toggle:f,stack:l,edit:p,create:m};return I(Mn.Provider,{value:j(()=>({...o,...h}),[r]),children:I(Nn.Provider,{value:i,children:e.children})})}),da=[{id:`universal-viewer`,config:{url:`https://universalviewer.dev/#?iiifManifestId={manifestId}`},type:`external-manifest-preview`,label:`Universal viewer`},{id:`mirador-3`,type:`external-manifest-preview`,label:`Mirador 3`,config:{url:`https://tomcrane.github.io/scratch/mirador3/?iiif-content={manifestId}`}},{id:`annona`,type:`external-manifest-preview`,label:`Annona`,config:{url:`https://ncsu-libraries.github.io/annona/tools/#/display?url={manifestId}&viewtype=iiif-storyboard&settings=%7B%22fullpage%22%3Atrue%7D`}},{id:`iiif-preview`,config:{url:`https://iiif-preview.digirati.services/store`},type:`iiif-preview-service`,label:`IIIF Preview`}],fa=new Qe({approximateServices:!0,verificationsRequired:8,enableFetching:!0});function pa({config:e,saveConfig:t,children:n,theme:r,previews:i,resource:a,editing:o}){let s=it(),c=j(()=>({...s,...e,previews:e?.previews||s.previews||da}),[s,e]);return I(ca,{children:I(ye.Provider,{value:fa,children:I(Ot,{resource:a,children:I(sr,{children:I(pe,{theme:r||Fr,children:I(ot,{config:c,saveConfig:t,children:I(Or,{children:I(ua,{children:I(Vr,{children:I(Bt,{previews:i||[],configs:c.previews,children:I(ge,{children:n})})})})})})})})})})})}const ma={},ha=D(`global`);function ga(){return k(ha)}function _a(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function va(e){let t=ga(),[,n]=M(e=>e+1,0),r=j(()=>(ma[t]||(ma[t]={}),ma[t][e]||(ma[t][e]={name:e,emitter:Je(),status:`idle`,promise:Promise.resolve(),abort:new AbortController,reject:()=>void 0,resolve:()=>void 0}),ma[t][e]),[t,e]);return $(r,`abort`,n),$(r,`error`,n),$(r,`complete`,n),$(r,`running`,n),r}function $(e,t,n){let r=O(()=>n(e),[n]);A(()=>{let n=e.emitter;return n.on(t,r),()=>n.off(t,r)},[t,r,e.emitter])}const ya=()=>void 0;function ba(e,t){let n=va(e);return $(n,`complete`,t||ya),[e=>{n.status===`running`&&(n.abort.abort(),n.emitter.emit(`abort`)),n.error&&(n.error=``);let t=_a();t.promise.then(()=>n.emitter.emit(`complete`)).catch(()=>n.emitter.emit(`error`)),n.status=`running`,n.request=e,n.promise=t.promise,n.resolve=t.resolve,n.reject=t.reject,n.emitter.emit(`running`)},n]}function xa(e,t){let n=va(e);return $(n,`running`,t),[e=>{n.status===`running`&&(n.response=e,n.status=`complete`,n.resolve())},n,(e,t)=>{n.status===`running`&&(n.error=t||e,n.status=`error`,n.reject(e))}]}function Sa({children:e}){return I(ha.Provider,{value:j(()=>`id-${Date.now()}`,[]),children:e})}function Ca(e){return!1}function wa({as:e,reference:t,onReference:n,onLink:r,onAnalysis:i,onDropReference:a,onDropLink:o,onDropAnalysis:s,onPasteReference:c,onPasteLink:l,onPasteAnalysis:u,...d}){let f=e||`div`,p=a||n,m=c||n,h=l||r,g=u||i,_=j(()=>t,[t?.id,t?.type]),v=O(function(e){e.defaultPrevented||(e.preventDefault(),e.clipboardData&&_&&_.id&&_.type&&e.clipboardData.setData(`application/json+vault`,JSON.stringify({id:_.id,type:_.type})))},[_]),y=O(async function(e){if(!e.defaultPrevented&&(e.preventDefault(),e.clipboardData)){if(d.onLoading&&d.onLoading(),m){let t=e.clipboardData.getData(`application/json+vault`);if(t)try{let e=JSON.parse(t);e&&e.id&&e.type&&m(e)}catch{}}if(h||g){let t=e.clipboardData.getData(`text`);if(t.startsWith(`http`)){let e=t.split(`
|
|
987
|
+
`,Qi=ue(function(e){let t=dt(),n=Ln(),{vault:r}=k(xe),i=r||void 0,a=N(null),o=N(null),{loading:s,state:c,leftPanels:l,centerPanels:u,rightPanels:f,modals:p=[],actions:h}=n,g=l.find(e=>e.id===c.leftPanel.current),_=f.find(e=>e.id===c.rightPanel.current),v=u.find(e=>e.id===c.centerPanel.current),y=p.find(e=>e.id===c.modal.current),b=c.pinnedRightPanel.pinned?f.find(e=>e.id===c.pinnedRightPanel.current):void 0,[ee]=_i([`(max-width: 1020px)`]),x=e.isLoading||!1,te=j(()=>(n.background||[]).map((e,t)=>I(ae,{children:e.render()},t)),[n.background]),S=Mi(`left-panel/${g?.id}`,{left:!0,marginLeft:60,minWidthPx:g?.options?.minWidth||200,maxWidthPx:g?.options?.maxWidth||720,loading:s}),C=Mi(`right-panel/${_?.id}`,{left:!1,minWidthPx:_?.options?.minWidth||320,maxWidthPx:_?.options?.maxWidth||720,loading:s}),w=_&&(b?.id!==_.id||!Ze(c.pinnedRightPanel.state,c.rightPanel.state)),T=S.widthB===`auto`?void 0:()=>S.setWidths({widthA:`auto`,widthB:Bn({options:g?.options,fallback:320})}),E=C.widthB===`auto`?void 0:()=>C.setWidths({widthA:`auto`,widthB:Bn({options:_?.options,fallback:320})});if(fe(()=>{ee&&c.leftPanel.open&&c.rightPanel.open&&(h.leftPanel.close(),h.rightPanel.close())},[ee]),fe(()=>{if(v&&v.onMount)return v.onMount(c.centerPanel.state||v.defaultState||{},{...n,current:h.centerPanel,vault:i},t)},[c.centerPanel.current]),fe(()=>{f.length&&h.rightPanel.change({id:f[0].id}),l.length&&h.leftPanel.change({id:l[0].id}),u.length&&h.centerPanel.change({id:u[0].id})},[]),s)return null;let ne=t=>I(Xi,{$menu:e.leftPanelMenuPosition||`bottom`,ref:S.refs.resizableDiv,className:[`manifest-editor`,t?`transition transition-${t}`:``].join(` `),style:{width:c.leftPanel.open||t!==`exited`?S.widthB:void 0,minWidth:g?.options?.minWidth},children:x?I(Zi,{children:I(Oi,{})}):L(F,{children:[e.leftPanelMenu?I(X,{$open:c.leftPanel.open&&t!==`exited`,$position:e.leftPanelMenuPosition||`bottom`,children:e.leftPanelMenu}):null,I(Zi,{children:c.leftPanel.open||t!==`exited`?I(F,{children:g?I(er,{isLeft:!0,noHeader:!0,transition:t,panel:g,state:c.leftPanel,actions:h.leftPanel}):null}):null})]})}),re=()=>!y||c.modal.open===!1?null:I(d,{title:y.label,onClose:()=>h.modal.close(),children:Vn(y.render(c.modal.state||y.defaultState||{},{...n,current:h.modal,vault:i},t))}),ie=()=>L(Xi,{$menu:e.centerPanelMenuPosition||`top`,children:[e.centerPanelMenu?I(X,{$open:c.centerPanel.open,$position:e.centerPanelMenuPosition||`top`,children:e.centerPanelMenu}):null,I(Zi,{children:I(Be,{resetKeys:[v?.id],FallbackComponent:Rn,children:x?I(`div`,{style:{display:`flex`,flex:1,justifyContent:`center`,alignItems:`center`},children:I(Di,{stroke:`rgba(0,0,0,.3)`,fontSize:`2em`})}):c.centerPanel.open&&v?Vn(v.render(c.centerPanel.state||v.defaultState||{},{...n,current:h.centerPanel,vault:i},t)):null})})]}),oe=t=>I(Xi,{$menu:e.rightPanelMenuPosition||`bottom`,ref:C.refs.resizableDiv,className:t?`transition transition-${t}`:``,style:{width:c.rightPanel.open||t!==`exited`?C.widthB:void 0,minWidth:_?.options?.minWidth},children:x?I(Zi,{children:I(Oi,{})}):L(F,{children:[e.rightPanelMenu?I(X,{$open:c.rightPanel.open,$position:e.rightPanelMenuPosition||`bottom`,children:e.rightPanelMenu}):null,I(Zi,{children:c.rightPanel.open||t!==`exited`?L(F,{children:[w?I(er,{panel:_,state:c.rightPanel,actions:h.rightPanel,pinActions:h.pinnedRightPanel,available:f}):null,b?I(er,{panel:b,state:c.pinnedRightPanel,actions:h.pinnedRightPanel,close:h.rightPanel.close}):null]}):null})]})});return ee?L(Ui,{children:[e.hideHeader?null:L(Wi,{children:[e.header||null,e.menu?I(`menu`,{children:e.menu}):null]}),I(Ki,{children:L(Ni,{children:[I(Pi,{children:ie()}),L(Fi,{children:[l.length>0?I(Ii,{onClick:h.leftPanel.toggle,children:g?.label}):null,f.length>0?I(Ri,{children:L(zi,{onClick:h.rightPanel.toggle,children:[I(St,{rotate:180}),_?.label]})}):null,I(Li,{children:`Preview`})]}),f.length>0?I(Bi,{$open:c.rightPanel.open,children:oe()}):null,l.length>0?I(Vi,{$open:c.leftPanel.open,children:ne()}):null,l.length>0||f.length>0?I(Hi,{$open:c.leftPanel.open||c.rightPanel.open,onClick:()=>{h.leftPanel.close(),h.rightPanel.close()}}):null]})})]}):L(Ui,{id:e.htmlId||`manifest-editor-container`,className:`manifest-editor ${e.className||``}`,children:[e.hideHeader?null:L(Wi,{children:[e.header||null,e.menu?I(`menu`,{children:e.menu}):null]}),L(Ki,{ref:e=>{S.refs.container.current=e,C.refs.container.current=e},children:[l.length>0?I(m,{current:c.leftPanel.current,items:l.map(e=>({id:e.id,label:e.label,icon:e.icon,divide:e.divide,onClick:()=>{c.leftPanel.current===e.id?h.leftPanel.toggle():h.leftPanel.change({id:e.id})}})),open:c.leftPanel.open}):null,l.length>0?I(Xe,{nodeRef:a,in:c.leftPanel.open,timeout:400,unmountOnExit:!1,children:e=>L(F,{children:[I(qi,{ref:a,$width:S.widthB,$state:e,$motion:!0,children:ne(e)}),I(Ei,{ref:S.refs.resizer,reset:T,dir:`left`,transition:e,open:c.leftPanel.open||e!==`exited`,actions:h.leftPanel})]})}):null,I(Ji,{children:ie()}),f.length>0?I(Xe,{nodeRef:o,in:c.rightPanel.open,timeout:400,unmountOnExit:!1,children:e=>L(F,{children:[I(Ei,{ref:C.refs.resizer,dir:`right`,reset:E,open:c.rightPanel.open,actions:h.rightPanel}),I(Yi,{ref:o,$width:C.widthB,$state:e,$motion:!0,children:oe(e)})]})}):null]}),I(Gi,{children:e.footer||null}),I(`div`,{className:`hidden`,children:te}),I(F,{children:re()})]})});function Z(e,t){function n(){t({type:`popStack`,panel:e,payload:void 0})}function r(n){t({type:`change`,panel:e,payload:n})}function i(n){t({type:`open`,panel:e,payload:n})}function a(){t({type:`close`,panel:e,payload:void 0})}function o(){t({type:`toggle`,panel:e,payload:void 0})}function s(){t({type:`minimise`,panel:e,payload:void 0})}function c(n){t({type:`maximise`,panel:e,payload:n})}function l(n){t({type:`setCustomWidth`,panel:e,payload:n})}function u(){t({type:`resetSize`,panel:e,payload:void 0})}function d(n){t({type:`pin`,panel:e,payload:n})}function f(){t({type:`unpin`,panel:e,payload:void 0})}return j(()=>({popStack:n,change:r,open:i,close:a,toggle:o,minimise:s,maximise:c,setCustomWidth:l,resetSize:u,pin:d,unpin:f}),[])}function $i(e,t){if(t.payload&&t.payload.stacked){if(e.current){let n=e.stack[e.stack.length-1];if(n&&n.id===e.current)return;t.payload.unique&&(e.stack=e.stack.filter(t=>t.id!==e.current)),e.stack.push({id:e.current,state:e.state?{...Ae(e.state)}:{}})}}else e.stack=[]}function ea(e,t){switch(t.type){case`popStack`:if(e.stack.length){let t=e.stack[e.stack.length-1];t&&(e.current=t.id,e.state=t.state),e.stack=e.stack.slice(0,-1)}break;case`change`:t.payload.id!==e.current&&$i(e,t),e.state=t.payload.state,e.current=t.payload.id;break;case`close`:e.open=!1;break;case`open`:e.open=!0,t.payload&&(t.payload.id!==e.current&&$i(e,t),e.state=t.payload.state,e.current=t.payload.id);break;case`toggle`:e.open=!e.open;break;case`maximise`:e.minimised=!1,t.payload&&(e.state=t.payload.state,e.current=t.payload.id);break;case`minimise`:e.minimised=!0;break;case`setCustomWidth`:e.customWidth=t.payload;break;case`resetSize`:e.customWidth=void 0}if(zn(e))switch(t.type){case`pin`:e.pinned=!0,e.state=t.payload.state,e.current=t.payload.id;break;case`unpin`:e.pinned=!1,e.state=void 0;break}}const ta=je((e,t)=>{switch(t.panel){case`centerPanel`:ea(e.centerPanel,t);break;case`leftPanel`:ea(e.leftPanel,t);break;case`rightPanel`:ea(e.rightPanel,t);break;case`modal`:ea(e.modal,t);break;case`pinnedRightPanel`:ea(e.pinnedRightPanel,t);break}});function Q(){return{customWidth:void 0,minimised:!1,open:!0,current:null,state:null,stack:[]}}function na(){return{leftPanel:Q(),centerPanel:Q(),rightPanel:Q(),modal:Q(),pinnedRightPanel:{...Q(),pinnable:!0,pinned:!1}}}const ra=D({resource:null});function ia(){return k(ra)}function aa(){let e=B(),{resource:t}=ia();U(t,`Nothing selected`);let{id:n,type:r}=t;return ke(()=>e.get({id:n,type:r}),[n,r])}function oa(){let{resource:e}=ia();return e}function sa({resource:e,children:t}){let{id:n,type:r}=e||{};return I(ra.Provider,{value:j(()=>({resource:n&&r?{id:n,type:r}:null}),[n,r]),children:t})}var ca=class extends ie{constructor(...e){super(...e),G(this,`state`,{hasError:!1})}static getDerivedStateFromError(e){return console.error(e),{hasError:!0}}componentDidCatch(e,t){console.error(`Uncaught error:`,e,t)}render(){return this.state.hasError?I(`h1`,{children:`Sorry.. there was an error`}):this.props.children}};function la(e,t){return typeof e==`string`?{id:e,state:t}:e}const ua=ue(function(e){let t=W(),n=hi(),r=t.layout,[i,a]=M(ta,void 0,na),o={centerPanel:Z(`centerPanel`,a),leftPanel:Z(`leftPanel`,a),rightPanel:Z(`rightPanel`,a),pinnedRightPanel:Z(`pinnedRightPanel`,a),modal:Z(`modal`,a),editingStack:vr()};function s(e){let t=r.rightPanels.find(t=>t.id===e);if(t)return[t,o.rightPanel,o.pinnedRightPanel];let n=r.centerPanels.find(t=>t.id===e);if(n)return[n,o.centerPanel];let i=r.leftPanels.find(t=>t.id===e);if(i)return[i,o.leftPanel];U(!1,`Was not able to find panel with id "${e}"`)}function c(e,t){let{id:r,state:i,stacked:a}=la(e,t),[o,c,l]=s(r);if(l&&o.options?.openPinned)l.pin({id:r,state:{...o.defaultState||{},...i||{}}});else{let e={id:r,state:{...o.defaultState||{},...i||{}},stacked:a};n.emit(`layout.open`,e),c.open(e)}}function l(e,t){let{id:r,state:i}=la(e,t),[a,o]=s(r),c={id:r,state:{...a.defaultState||{},...i||{}},stacked:!0};n.emit(`layout.open`,c),o.open(c)}function u(e,t){let{id:r,state:i,stacked:a}=la(e,t),[o,c]=s(r),l={id:r,state:{...o.defaultState||{},...i||{}},stacked:a};n.emit(`layout.change`,l),c.change(l)}function d(e,t){let{id:r}=la(e,t),[,i]=s(r);n.emit(`layout.close`,{id:r}),i.close()}function f(e,t){let{id:r}=la(e,t),[,i]=s(r);n.emit(`layout.toggle`,{id:r}),i.toggle()}function p(e,t={},{reset:i,property:a,stacked:s,forceOpen:c}={}){let l={resource:Fe(e)?e:{type:`SpecificResource`,source:e},...t};n.emit(`layout.edit`,l),o.editingStack.edit(l,i),r.rightPanels.find(e=>e.id===`@manifest-editor/editor`)&&(c?o.rightPanel.open({id:`@manifest-editor/editor`,stacked:s!==!1,state:{property:a},unique:!0}):o.rightPanel.change({id:`@manifest-editor/editor`,stacked:s!==!1,state:{property:a},unique:!0}))}function m(e){o.editingStack.create(e,{}),n.emit(`layout.create`,e),r.modals?.find(e=>e.id===`@manifest-editor/creator`)?o.modal.open({id:`@manifest-editor/creator`,stacked:!0,unique:!0,state:e}):r.rightPanels.find(e=>e.id===`@manifest-editor/creator`)&&o.rightPanel.open({id:`@manifest-editor/creator`,stacked:!0,unique:!0,state:e})}let h={open:c,change:u,close:d,toggle:f,stack:l,edit:p,create:m};return I(Mn.Provider,{value:j(()=>({...o,...h}),[r]),children:I(Nn.Provider,{value:i,children:e.children})})}),da=[{id:`universal-viewer`,config:{url:`https://universalviewer.dev/#?iiifManifestId={manifestId}`},type:`external-manifest-preview`,label:`Universal viewer`},{id:`mirador-3`,type:`external-manifest-preview`,label:`Mirador 3`,config:{url:`https://tomcrane.github.io/scratch/mirador3/?iiif-content={manifestId}`}},{id:`annona`,type:`external-manifest-preview`,label:`Annona`,config:{url:`https://ncsu-libraries.github.io/annona/tools/#/display?url={manifestId}&viewtype=iiif-storyboard&settings=%7B%22fullpage%22%3Atrue%7D`}},{id:`iiif-preview`,config:{url:`https://iiif-preview.digirati.services/store`},type:`iiif-preview-service`,label:`IIIF Preview`}],fa=new Qe({approximateServices:!0,verificationsRequired:8,enableFetching:!0});function pa({config:e,saveConfig:t,children:n,theme:r,previews:i,resource:a,editing:o}){let s=it(),c=j(()=>({...s,...e,previews:e?.previews||s.previews||da}),[s,e]);return I(ca,{children:I(ye.Provider,{value:fa,children:I(Ot,{resource:a,children:I(sr,{children:I(pe,{theme:r||Fr,children:I(ot,{config:c,saveConfig:t,children:I(Or,{children:I(ua,{children:I(Vr,{children:I(Bt,{previews:i||[],configs:c.previews,children:I(ge,{children:n})})})})})})})})})})})}const ma={},ha=D(`global`);function ga(){return k(ha)}function _a(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function va(e){let t=ga(),[,n]=M(e=>e+1,0),r=j(()=>(ma[t]||(ma[t]={}),ma[t][e]||(ma[t][e]={name:e,emitter:Je(),status:`idle`,promise:Promise.resolve(),abort:new AbortController,reject:()=>void 0,resolve:()=>void 0}),ma[t][e]),[t,e]);return $(r,`abort`,n),$(r,`error`,n),$(r,`complete`,n),$(r,`running`,n),r}function $(e,t,n){let r=O(()=>n(e),[n]);A(()=>{let n=e.emitter;return n.on(t,r),()=>n.off(t,r)},[t,r,e.emitter])}const ya=()=>void 0;function ba(e,t){let n=va(e);return $(n,`complete`,t||ya),[e=>{n.status===`running`&&(n.abort.abort(),n.emitter.emit(`abort`)),n.error&&(n.error=``);let t=_a();t.promise.then(()=>n.emitter.emit(`complete`)).catch(()=>n.emitter.emit(`error`)),n.status=`running`,n.request=e,n.promise=t.promise,n.resolve=t.resolve,n.reject=t.reject,n.emitter.emit(`running`)},n]}function xa(e,t){let n=va(e);return $(n,`running`,t),[e=>{n.status===`running`&&(n.response=e,n.status=`complete`,n.resolve())},n,(e,t)=>{n.status===`running`&&(n.error=t||e,n.status=`error`,n.reject(e))}]}function Sa({children:e}){return I(ha.Provider,{value:j(()=>`id-${Date.now()}`,[]),children:e})}function Ca(e){return!1}function wa({as:e,reference:t,onReference:n,onLink:r,onAnalysis:i,onDropReference:a,onDropLink:o,onDropAnalysis:s,onPasteReference:c,onPasteLink:l,onPasteAnalysis:u,...d}){let f=e||`div`,p=a||n,m=c||n,h=l||r,g=u||i,_=j(()=>t,[t?.id,t?.type]),v=O(function(e){e.defaultPrevented||(e.preventDefault(),e.clipboardData&&_&&_.id&&_.type&&e.clipboardData.setData(`application/json+vault`,JSON.stringify({id:_.id,type:_.type})))},[_]),y=O(async function(e){if(!e.defaultPrevented&&(e.preventDefault(),e.clipboardData)){if(d.onLoading&&d.onLoading(),m){let t=e.clipboardData.getData(`application/json+vault`);if(t)try{let e=JSON.parse(t);e&&e.id&&e.type&&m(e)}catch{}}if(h||g){let t=e.clipboardData.getData(`text`);if(t.startsWith(`http`)){let e=t.split(`
|
|
988
988
|
`);for(let t of e){if(g)try{let e=await Ca(t);if(e){g(e);continue}}catch{}h&&h(t)}}}d.onComplete&&d.onComplete()}},[]),b=O(function(e){e.defaultPrevented||(e.preventDefault(),e.dataTransfer&&d.draggable&&(e.dataTransfer.effectAllowed=`all`,_&&_.id&&_.type&&e.dataTransfer.setData(`application/json+vault`,JSON.stringify({id:_.id,type:_.type}))))},[]);return I(f,{onCopy:v,onPaste:y,onDrop:O(async function(e){if(e.preventDefault(),e.dataTransfer){if(p){let t=e.dataTransfer.getData(`application/json+vault`);if(t)try{let n=JSON.parse(t);n&&n.id&&n.type&&p(n,e)}catch{return}}let t=e.dataTransfer.getData(`application/json`);if(t){JSON.parse(t);return}if(e.dataTransfer.getData(`text/plain`))return}},[]),onDragOver:O(e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`)},[]),onDragStart:b,tabIndex:-1,...d})}export{nn as AppHeader,sn as AppMenuProvider,pt as AppProvider,ct as AppReactContext,Dt as AppResourceInstanceProvider,Ot as AppResourceProvider,lt as AppStateReactContext,he as AtlasStoreProvider,_e as AtlasStoreReactContext,Ir as BaseAnnotationCreator,Nr as BaseEditor,Ar as BaseEditorBackButton,jr as BaseEditorCloseButton,Rr as ConfigEditor,ot as ConfigProvider,nt as ConfigReactContext,Vr as ContextMenuProvider,Br as ContextMenuReactContext,Or as EditingStack,J as EditingStackContext,mi as EventEmitterProvider,fi as ExportPanel,ar as HOMEPAGE_COLLECTION,xi as HandleContainer,Ei as HandleControls,kr as InlineEditingStack,Qi as Layout,Mn as LayoutActionsReactContext,Nn as LayoutStateReactContext,er as ModularPanel,Xn as ModularPanelHeader,q as ModulePanelButton,_t as MultiAppProvider,Rn as PanelError,tn as PreviewButton,Bt as PreviewProvider,cr as PreviewVaultBoundary,sr as PreviewVaultContext,st as PrimeAppReactContext,pi as ReactEmitterContext,sa as ResourceEditingProvider,ra as ResourceEditingReactContext,rt as SaveConfigReactContext,pa as ShellProvider,Sa as TaskBridge,wa as UniversalCopyTarget,pn as analyse,hn as analyseJson,pr as baseCreator,Pr as baseEditor,Cn as copyToClipboard,xn as createActionIdentity,Sn as createDownload,tr as createPreviewVault,fn as detectMedia,Mr as editBasedOnResource,En as extendApp,na as getDefaultLayoutState,Q as getDefaultPanelState,vn as getFormat,yn as getImageDimensions,bn as getManifestNomalized,zn as isPinnableState,ta as layoutReducer,Tn as mapApp,Bn as panelSizing,ln as polygonToBoundingBox,wn as randomId,Vn as renderHelper,bi as useAnnotationCreatorState,Tr as useAnnotationPageEditor,W as useApp,ut as useAppInstance,an as useAppMenu,on as useAppMenuItem,Et as useAppResource,Tt as useAppResourceInstance,dt as useAppState,ht as useApps,cn as useAtlasStore,In as useAvailableLayouts,Cr as useCollectionEditor,it as useConfig,xr as useCreatingResource,lr as useCreator,Gr as useCustomContextMenu,Lr as useDecayState,ia as useEditingContext,yr as useEditingResource,br as useEditingResourceStack,vr as useEditingStack,Er as useEditor,hi as useEmitter,gi as useEvent,wr as useGenericEditor,Dn as useHighlightedImageResource,kn as useHoverHighlightImageResource,ur as useInlineCreator,Fn as useLayoutActions,Ln as useLayoutProvider,Pn as useLayoutState,E as useLocalStorage,Sr as useManifestEditor,_i as useMatchMedia,ne as useOptionalLocalStorage,oa as useOptionalResource,Z as usePanelActions,Ht as usePreviewContext,or as usePreviewHistory,nr as usePreviewVault,Vt as usePreviews,aa as useResource,Ur as useResourceContextMenuItems,at as useSaveConfig,vi as useSaveVault,Jn as useSetCustomTitle,yi as useSvgTools,va as useTask,ba as useTaskDispatch,$ as useTaskEvent,xa as useTaskRunner,On as useTemporaryHighlight};
|
|
989
989
|
//# sourceMappingURL=index.js.map
|