@nulib/clover 0.0.0-stage → 4.0.0-beta.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/LICENSE +9 -0
- package/README.md +120 -2
- package/dist/components/Annotations/Annotations.mjs +674 -0
- package/dist/components/Annotations/EntryBodies.mjs +52 -0
- package/dist/components/Annotations/languages.mjs +43 -0
- package/dist/components/Body/Body.mjs +51 -0
- package/dist/components/Body/BodyAlert.mjs +25 -0
- package/dist/components/Body/Caption.mjs +90 -0
- package/dist/components/Body/CaptionDetails.mjs +50 -0
- package/dist/components/Body/Pending.mjs +9 -0
- package/dist/components/Body/glyphs.mjs +66 -0
- package/dist/components/Body/renderers.mjs +30 -0
- package/dist/components/Body/useControlsVisibility.mjs +204 -0
- package/dist/components/Body/useNearViewport.mjs +27 -0
- package/dist/components/Canvas/AnnotationMenu.mjs +128 -0
- package/dist/components/Canvas/AnnotationState.mjs +338 -0
- package/dist/components/Canvas/Annotations.mjs +497 -0
- package/dist/components/Canvas/CanvasView.mjs +669 -0
- package/dist/components/Canvas/ChoiceMenu.mjs +77 -0
- package/dist/components/Canvas/Connected.mjs +228 -0
- package/dist/components/Canvas/ControlMenu.mjs +67 -0
- package/dist/components/Canvas/Controls.mjs +233 -0
- package/dist/components/Canvas/FrameAnimation.mjs +344 -0
- package/dist/components/Canvas/LoadedCanvas.mjs +177 -0
- package/dist/components/Canvas/Placeholder.mjs +105 -0
- package/dist/components/Canvas/fromManifest.mjs +44 -0
- package/dist/components/Canvas/index.mjs +19 -0
- package/dist/components/Canvas/layout.mjs +369 -0
- package/dist/components/Canvas/media/MediaBody.mjs +285 -0
- package/dist/components/Canvas/media/Player.mjs +193 -0
- package/dist/components/Canvas/media/Transport.mjs +511 -0
- package/dist/components/Canvas/media/TransportButton.mjs +39 -0
- package/dist/components/Canvas/media/useBarHeight.mjs +28 -0
- package/dist/components/Canvas/media/useCaptionTracks.mjs +131 -0
- package/dist/components/Canvas/media/useMediaController.mjs +77 -0
- package/dist/components/Canvas/media/useMediaElement.mjs +100 -0
- package/dist/components/Canvas/panClearOfControls.mjs +92 -0
- package/dist/components/Canvas/rendererSurface.mjs +6 -0
- package/dist/components/Canvas/surface.mjs +5 -0
- package/dist/components/Canvas/track.mjs +43 -0
- package/dist/components/Canvas/useSvgReader.mjs +23 -0
- package/dist/components/Collection/Collection.mjs +76 -0
- package/dist/components/CollectionSelect/CollectionSelect.mjs +114 -0
- package/dist/components/Contents/Contents.mjs +120 -0
- package/dist/components/Download/Download.mjs +105 -0
- package/dist/components/Items/Item.mjs +184 -0
- package/dist/components/Items/Items.mjs +455 -0
- package/dist/components/Items/Pager.mjs +190 -0
- package/dist/components/Items/StandaloneItems.mjs +80 -0
- package/dist/components/Items/clamped.mjs +90 -0
- package/dist/components/Label/Label.mjs +39 -0
- package/dist/components/Map/LoadedMap.mjs +26 -0
- package/dist/components/Map/Map.mjs +38 -0
- package/dist/components/Map/MapView.mjs +539 -0
- package/dist/components/Map/basemap.mjs +50 -0
- package/dist/components/Map/maplibre-worker.mjs +7 -0
- package/dist/components/Map/overlayImage.mjs +17 -0
- package/dist/components/Map/worker.mjs +22 -0
- package/dist/components/Panel/About.mjs +148 -0
- package/dist/components/Panel/Panel.mjs +259 -0
- package/dist/components/Panel/PanelToggle.mjs +43 -0
- package/dist/components/Panel/PartOfManifest.mjs +52 -0
- package/dist/components/Primitives/Primitives.mjs +263 -0
- package/dist/components/Primitives/resource.mjs +11 -0
- package/dist/components/Provider/Provider.mjs +174 -0
- package/dist/components/Root/Announcer.mjs +58 -0
- package/dist/components/Root/Root.mjs +29 -0
- package/dist/components/Root/useRootState.mjs +188 -0
- package/dist/components/Scene/Connected.mjs +48 -0
- package/dist/components/Scene/Loaded.mjs +56 -0
- package/dist/components/Scene/RotatePad.mjs +204 -0
- package/dist/components/Scene/Scene.mjs +20 -0
- package/dist/components/Scene/SceneView.mjs +539 -0
- package/dist/components/Scene/cloverEngine.mjs +105 -0
- package/dist/components/Scene/engine.mjs +141 -0
- package/dist/components/Scene/engines.mjs +23 -0
- package/dist/components/Scene/gestures.mjs +74 -0
- package/dist/components/Scene/models.mjs +78 -0
- package/dist/components/Scene/orbit.mjs +60 -0
- package/dist/components/Search/Search.mjs +246 -0
- package/dist/components/Split/Split.mjs +210 -0
- package/dist/components/Split/splitting.mjs +203 -0
- package/dist/components/Status/Status.mjs +47 -0
- package/dist/components/Timeline/Connected.mjs +25 -0
- package/dist/components/Timeline/Timeline.mjs +40 -0
- package/dist/components/Timeline/playerSurface.mjs +84 -0
- package/dist/components/Transcript/Transcript.mjs +377 -0
- package/dist/components/Viewer/Viewer.mjs +19 -0
- package/dist/core/annotation-bodies.mjs +29 -0
- package/dist/core/annotation-collection.mjs +55 -0
- package/dist/core/annotation-name.mjs +31 -0
- package/dist/core/annotation-sets.mjs +155 -0
- package/dist/core/annotations-content.mjs +27 -0
- package/dist/core/annotations.mjs +73 -0
- package/dist/core/clover.mjs +393 -0
- package/dist/core/content-state-reader.mjs +82 -0
- package/dist/core/content-state.mjs +43 -0
- package/dist/core/direction.mjs +12 -0
- package/dist/core/geo-detect.mjs +30 -0
- package/dist/core/geo.mjs +283 -0
- package/dist/core/items.mjs +76 -0
- package/dist/core/keep-fragments.mjs +40 -0
- package/dist/core/link.mjs +28 -0
- package/dist/core/load.mjs +183 -0
- package/dist/core/map-config.mjs +12 -0
- package/dist/core/markdown.mjs +139 -0
- package/dist/core/pages.mjs +51 -0
- package/dist/core/painted-bodies.mjs +20 -0
- package/dist/core/painting.mjs +17 -0
- package/dist/core/presentation.mjs +27 -0
- package/dist/core/ranges.mjs +133 -0
- package/dist/core/region.mjs +32 -0
- package/dist/core/request.mjs +40 -0
- package/dist/core/sanitize.mjs +72 -0
- package/dist/core/search-service.mjs +22 -0
- package/dist/core/search.mjs +154 -0
- package/dist/core/selectors.mjs +94 -0
- package/dist/core/sequence.mjs +70 -0
- package/dist/core/show-link.mjs +16 -0
- package/dist/core/store.mjs +40 -0
- package/dist/core/svg-shape.mjs +183 -0
- package/dist/core/text.mjs +36 -0
- package/dist/core/thumbnail.mjs +55 -0
- package/dist/core/value.mjs +39 -0
- package/dist/core/vtt.mjs +111 -0
- package/dist/hooks/useFullscreen.mjs +21 -0
- package/dist/hooks/useFullscreenSupported.mjs +11 -0
- package/dist/hooks/useLoaded.mjs +27 -0
- package/dist/hooks/useWithinFullscreen.mjs +24 -0
- package/dist/i18n/config.mjs +170 -0
- package/dist/i18n/hostLanguage.mjs +6 -0
- package/dist/i18n/locales/en.json.mjs +5 -0
- package/dist/i18n/locales/es.json.mjs +5 -0
- package/dist/i18n/locales/fi.json.mjs +5 -0
- package/dist/i18n/locales/fr.json.mjs +5 -0
- package/dist/i18n/locales/index.mjs +13 -0
- package/dist/i18n/locales/nb.json.mjs +5 -0
- package/dist/i18n/locales/nn.json.mjs +5 -0
- package/dist/i18n/locales/no.json.mjs +5 -0
- package/dist/i18n/locales/pt.json.mjs +5 -0
- package/dist/i18n/reader.mjs +13 -0
- package/dist/i18n/useCloverTranslation.mjs +28 -0
- package/dist/index.d.mts +2215 -0
- package/dist/index.mjs +133 -0
- package/dist/lib/asArray.mjs +5 -0
- package/dist/lib/classnames.mjs +5 -0
- package/dist/lib/fullscreen.mjs +65 -0
- package/dist/lib/gltf/bounds.mjs +44 -0
- package/dist/lib/gltf/load.mjs +156 -0
- package/dist/lib/gltf/mat4.mjs +150 -0
- package/dist/lib/gltf/renderer.mjs +342 -0
- package/dist/lib/gltf/shaders.mjs +192 -0
- package/dist/lib/hls.mjs +6 -0
- package/dist/lib/pointer.mjs +38 -0
- package/dist/lib/renderer/CanvasRenderer.mjs +857 -0
- package/dist/lib/renderer/backends/backend.mjs +21 -0
- package/dist/lib/renderer/backends/canvas2d/Canvas2DBackend.mjs +91 -0
- package/dist/lib/renderer/backends/contexts.mjs +27 -0
- package/dist/lib/renderer/backends/dom/DomLayers.mjs +91 -0
- package/dist/lib/renderer/backends/webgl2/WebGL2Backend.mjs +248 -0
- package/dist/lib/renderer/backends/webgl2/shaders.mjs +28 -0
- package/dist/lib/renderer/camera/Camera.mjs +64 -0
- package/dist/lib/renderer/camera/CameraAnimator.mjs +90 -0
- package/dist/lib/renderer/input/GestureController.mjs +252 -0
- package/dist/lib/renderer/io/TileCache.mjs +207 -0
- package/dist/lib/renderer/io/decode.mjs +156 -0
- package/dist/lib/renderer/loop/FrameLoop.mjs +50 -0
- package/dist/lib/renderer/math/affine.mjs +68 -0
- package/dist/lib/renderer/math/rect.mjs +45 -0
- package/dist/lib/renderer/overlays/Navigator.mjs +141 -0
- package/dist/lib/renderer/overlays/OverlayLayer.mjs +94 -0
- package/dist/lib/renderer/scene/planFrame.mjs +168 -0
- package/dist/lib/renderer/scene/regions.mjs +30 -0
- package/dist/lib/renderer/scene/sceneItem.mjs +114 -0
- package/dist/lib/renderer/scene/uploadBudget.mjs +30 -0
- package/dist/lib/renderer/sources/imageService.mjs +160 -0
- package/dist/lib/renderer/sources/sizedImage.mjs +38 -0
- package/dist/lib/renderer/sources/tilePyramid.mjs +172 -0
- package/dist/lib/time.mjs +21 -0
- package/dist/map/index.d.mts +195 -0
- package/dist/map/index.mjs +16 -0
- package/dist/react/context.mjs +46 -0
- package/dist/react/hooks.mjs +69 -0
- package/dist/react/language.mjs +30 -0
- package/dist/styles.css +1 -0
- package/dist/templates/default/Default.mjs +229 -0
- package/dist/templates/document/Document.mjs +286 -0
- package/dist/templates/document/DocumentPanel.mjs +9 -0
- package/dist/templates/document/Sheets.mjs +360 -0
- package/dist/templates/gallery/Gallery.mjs +62 -0
- package/dist/templates/index.d.mts +276 -0
- package/dist/templates/index.mjs +11 -0
- package/dist/templates/shared/Lightbox.mjs +111 -0
- package/dist/templates/shared/LightboxBody.mjs +9 -0
- package/dist/templates/shared/dragToClose.mjs +129 -0
- package/dist/templates/shared/useDragToClose.mjs +35 -0
- package/dist/templates/shared/useDrawer.mjs +113 -0
- package/dist/templates/shared/useFollowFocus.mjs +24 -0
- package/dist/templates/shared/useSlide.mjs +52 -0
- package/dist/templates/shared/useSpine.mjs +26 -0
- package/dist/templates.css +1 -0
- package/dist/three/index.d.mts +6 -0
- package/dist/three/index.mjs +8 -0
- package/dist/ui/Button.mjs +53 -0
- package/dist/ui/ControlCluster.mjs +87 -0
- package/dist/ui/Cue.mjs +13 -0
- package/dist/ui/ErrorBoundary.mjs +26 -0
- package/dist/ui/ExitFullscreen.mjs +46 -0
- package/dist/ui/FieldPill.mjs +153 -0
- package/dist/ui/HideToggle.mjs +57 -0
- package/dist/ui/Loading.mjs +20 -0
- package/dist/ui/Markup.mjs +95 -0
- package/dist/ui/ReadMore.mjs +84 -0
- package/dist/ui/Sections.mjs +448 -0
- package/dist/ui/Steps.mjs +84 -0
- package/dist/ui/Tip.mjs +196 -0
- package/dist/ui/bringIntoView.mjs +27 -0
- package/dist/ui/controlGlyphs.mjs +120 -0
- package/dist/ui/heading.mjs +19 -0
- package/dist/ui/languageCode.mjs +8 -0
- package/dist/ui/mediaIcons.mjs +104 -0
- package/dist/ui/useClusterReach.mjs +50 -0
- package/dist/ui/useContainerName.mjs +19 -0
- package/dist/ui/useOneOpen.mjs +22 -0
- package/dist/ui/useRovingFocus.mjs +64 -0
- package/dist/ui/useScrollTrack.mjs +150 -0
- package/dist/ui/useUniqueId.mjs +10 -0
- package/dist/ui/visuallyHidden.mjs +15 -0
- package/dist/web-components/About-DbrFSVBm.mjs +1 -0
- package/dist/web-components/AnnotationMenu-EBjIQpQl.mjs +1 -0
- package/dist/web-components/AnnotationState-DQTaO6Gz.mjs +1 -0
- package/dist/web-components/Annotations-Cb9U7HJ_.mjs +2 -0
- package/dist/web-components/Annotations-Dl0SgHBS.mjs +1 -0
- package/dist/web-components/Body-DxSz3iST.mjs +1 -0
- package/dist/web-components/BodyAlert-C8EOXz24.mjs +1 -0
- package/dist/web-components/Button-uWgfvqsL.mjs +1 -0
- package/dist/web-components/Camera-cdCqKMup.mjs +1 -0
- package/dist/web-components/Canvas2DBackend-CnLEHRs4.mjs +1 -0
- package/dist/web-components/CanvasView-BI3YzNdK.mjs +1 -0
- package/dist/web-components/CaptionDetails-B80ZhZ7v.mjs +1 -0
- package/dist/web-components/ChoiceMenu-DCp7-co7.mjs +1 -0
- package/dist/web-components/Collection-B1Le2_TU.mjs +1 -0
- package/dist/web-components/CollectionSelect-BL_jQog-.mjs +1 -0
- package/dist/web-components/Connected-BxqaRL9o.mjs +1 -0
- package/dist/web-components/Connected-DCBI-j9H.mjs +1 -0
- package/dist/web-components/Connected-DkhfVWxd.mjs +1 -0
- package/dist/web-components/Contents-zYEGHLfe.mjs +1 -0
- package/dist/web-components/ControlMenu-CAHiLAtl.mjs +1 -0
- package/dist/web-components/Cue-BT2V9VAq.mjs +1 -0
- package/dist/web-components/Document-BdCjGnJN.mjs +1 -0
- package/dist/web-components/DocumentPanel-X_Rta0Wu.mjs +1 -0
- package/dist/web-components/DomLayers-BD4QPbl6.mjs +1 -0
- package/dist/web-components/Download-DqU-goFi.mjs +1 -0
- package/dist/web-components/EntryBodies-DXAQH0vR.mjs +1 -0
- package/dist/web-components/ErrorBoundary-chQaO-Up.mjs +1 -0
- package/dist/web-components/FieldPill-CyEssPVm.mjs +1 -0
- package/dist/web-components/FrameAnimation-Bb0pOoRl.mjs +1 -0
- package/dist/web-components/Gallery-BXU3TcT3.mjs +1 -0
- package/dist/web-components/HideToggle-BwMrOBMu.mjs +1 -0
- package/dist/web-components/Items-DRj1UEpC.mjs +1 -0
- package/dist/web-components/Label-D6aVJB9s.mjs +1 -0
- package/dist/web-components/LightboxBody-BzXQGMDn.mjs +1 -0
- package/dist/web-components/Loaded-D5xmFRSo.mjs +1 -0
- package/dist/web-components/LoadedCanvas-DOjtxLSe.mjs +1 -0
- package/dist/web-components/LoadedMap-DouDS2lO.mjs +1 -0
- package/dist/web-components/Loading-CBKfwsML.mjs +1 -0
- package/dist/web-components/Map-Bcgp_R8H.mjs +1 -0
- package/dist/web-components/MapView-CD5zkTs8.mjs +1 -0
- package/dist/web-components/Markup-C1hMA8wk.mjs +2 -0
- package/dist/web-components/MediaBody-B_Gii4we.mjs +1 -0
- package/dist/web-components/MediaBody-BfrKIPte.mjs +1 -0
- package/dist/web-components/Navigator-BSJbEbuJ.mjs +1 -0
- package/dist/web-components/Pager-Di_2hHM3.mjs +1 -0
- package/dist/web-components/Panel-DbsC8A9V.mjs +1 -0
- package/dist/web-components/PanelToggle-mUDw73zI.mjs +1 -0
- package/dist/web-components/PartOfManifest-7eOwURrF.mjs +1 -0
- package/dist/web-components/Pending-BPOQ2z1L.mjs +1 -0
- package/dist/web-components/Primitives-XQO3m1wG.mjs +1 -0
- package/dist/web-components/Provider-B61118lU.mjs +1 -0
- package/dist/web-components/ReadMore-BJH-qqte.mjs +1 -0
- package/dist/web-components/Root-Dj277K6p.mjs +1 -0
- package/dist/web-components/Scene-BTWpLeec.mjs +1 -0
- package/dist/web-components/SceneView-BYo7WmPt.mjs +1 -0
- package/dist/web-components/Search-ZV8FFN4p.mjs +1 -0
- package/dist/web-components/Sections-ejwu1_Sm.mjs +2 -0
- package/dist/web-components/StandaloneItems-BYaiyCca.mjs +1 -0
- package/dist/web-components/Status-YbQK2KzY.mjs +1 -0
- package/dist/web-components/Timeline-ByyVSd7B.mjs +1 -0
- package/dist/web-components/Tip-IO11xX4x.mjs +1 -0
- package/dist/web-components/Transcript-D0gUxUoA.mjs +1 -0
- package/dist/web-components/annotation-collection-Csv7WIlm.mjs +1 -0
- package/dist/web-components/annotations-content-BS_OFz5Z.mjs +1 -0
- package/dist/web-components/assets/maplibre-gl-worker-kTz9OPxr.js +13831 -0
- package/dist/web-components/body-CKjwwFep.mjs +1 -0
- package/dist/web-components/bringIntoView-CQH5ZgMM.mjs +1 -0
- package/dist/web-components/canvas-CIzpp-Uz.mjs +1 -0
- package/dist/web-components/classnames-DukgfdpI.mjs +1 -0
- package/dist/web-components/cloverEngine-B4LinbSt.mjs +164 -0
- package/dist/web-components/content-state-reader-D1BkpICh.mjs +1 -0
- package/dist/web-components/contexts-ByL3eA_T.mjs +1 -0
- package/dist/web-components/controls-Dj2BybWb.mjs +1 -0
- package/dist/web-components/custom-elements.json +2739 -0
- package/dist/web-components/dragToClose-C-Pf1IeO.mjs +1 -0
- package/dist/web-components/engine-BSt8LTso.mjs +4228 -0
- package/dist/web-components/engines-CC0OEsVE.mjs +1 -0
- package/dist/web-components/es-BwMkoRod.mjs +1 -0
- package/dist/web-components/fi-gPFOn9RK.mjs +1 -0
- package/dist/web-components/fr-DUHmgdJo.mjs +1 -0
- package/dist/web-components/fromManifest-BhemHaoA.mjs +1 -0
- package/dist/web-components/glyphs-drROkef9.mjs +1 -0
- package/dist/web-components/heading-Cjt0f-Eu.mjs +1 -0
- package/dist/web-components/hls-CdKrthkC.mjs +40 -0
- package/dist/web-components/hooks-BXzQSllm.mjs +1 -0
- package/dist/web-components/imageService-dsdmcegU.mjs +1 -0
- package/dist/web-components/index-B7nZdqLg.mjs +1 -0
- package/dist/web-components/index.d.mts +604 -0
- package/dist/web-components/index.mjs +1 -0
- package/dist/web-components/index.umd.js +18 -0
- package/dist/web-components/items-CB2Uk7ts.mjs +1 -0
- package/dist/web-components/items-jfQ5XzEj.mjs +1 -0
- package/dist/web-components/keep-fragments-B5nlv2ck.mjs +1 -0
- package/dist/web-components/label-Vbg_cMOJ.mjs +1 -0
- package/dist/web-components/languageCode-cCpiU0b0.mjs +1 -0
- package/dist/web-components/layout-mMHI0lsj.mjs +1 -0
- package/dist/web-components/link-ZRnv5NFR.mjs +1 -0
- package/dist/web-components/logo-Boy6u4m2.mjs +1 -0
- package/dist/web-components/maplibre-gl-CQ4OueXY.mjs +823 -0
- package/dist/web-components/markdown-CCYJwzFn.mjs +5 -0
- package/dist/web-components/models-D1EE_CmH.mjs +1 -0
- package/dist/web-components/nb-BSvnQ6jd.mjs +1 -0
- package/dist/web-components/nn-Dg2_HdZu.mjs +1 -0
- package/dist/web-components/no-BSvnQ6jd.mjs +1 -0
- package/dist/web-components/nodes-B7JRwBgl.mjs +1 -0
- package/dist/web-components/overlayImage-0OgQl1TL.mjs +1 -0
- package/dist/web-components/panClearOfControls-ac9uf-Qs.mjs +1 -0
- package/dist/web-components/panel-CjXfre-g.mjs +1 -0
- package/dist/web-components/part-cUiPs2-y.mjs +1 -0
- package/dist/web-components/playerSurface-CU5XxI1j.mjs +1 -0
- package/dist/web-components/provider-C1wKfdjb.mjs +1 -0
- package/dist/web-components/pt-B3J80JgO.mjs +1 -0
- package/dist/web-components/read-more-DNHNtG-a.mjs +1 -0
- package/dist/web-components/rendererSurface-DhIlOjGT.mjs +22 -0
- package/dist/web-components/renderers-BMSWEFUR.mjs +1 -0
- package/dist/web-components/resource-DLHocQ1C.mjs +1 -0
- package/dist/web-components/sanitize-Dc7nOsgO.mjs +3 -0
- package/dist/web-components/search-CLy2Wj01.mjs +1 -0
- package/dist/web-components/shared-YUjOSBKO.mjs +1 -0
- package/dist/web-components/show-link-CyzYE1eS.mjs +1 -0
- package/dist/web-components/sizedImage-uv_NlE0l.mjs +1 -0
- package/dist/web-components/split-CYuMjp89.mjs +1 -0
- package/dist/web-components/splitting-BnQUxxgH.mjs +1 -0
- package/dist/web-components/status-Ms5L0ghK.mjs +1 -0
- package/dist/web-components/styles-CyuM_fB1.mjs +1 -0
- package/dist/web-components/svg-shape-DLY3g7oq.mjs +1 -0
- package/dist/web-components/text-BTAkxEfQ.mjs +5 -0
- package/dist/web-components/three.mjs +1 -0
- package/dist/web-components/thumbnail-c2K_iQsD.mjs +1 -0
- package/dist/web-components/time-B9GZoYcm.mjs +1 -0
- package/dist/web-components/tip-dWhupWSr.mjs +1 -0
- package/dist/web-components/toggle-BQTjR1I3.mjs +1 -0
- package/dist/web-components/upgrader-XNxI-5jo.mjs +1 -0
- package/dist/web-components/useContainerName-BpJ3IWY0.mjs +1 -0
- package/dist/web-components/useNearViewport-CtLyYg9n.mjs +1 -0
- package/dist/web-components/useScrollTrack-WbG28FPD.mjs +1 -0
- package/dist/web-components/viewer/AnnotationMenu-ZKyBeyUU.mjs +1 -0
- package/dist/web-components/viewer/AnnotationState-DO33zokc.mjs +1 -0
- package/dist/web-components/viewer/Annotations-BOjhr5ks.mjs +1 -0
- package/dist/web-components/viewer/Annotations-DkLueFLK.mjs +2 -0
- package/dist/web-components/viewer/Canvas2DBackend-CAmzJD5P.mjs +1 -0
- package/dist/web-components/viewer/CaptionDetails-DOJlUtOn.mjs +1 -0
- package/dist/web-components/viewer/ChoiceMenu-BDq6H34G.mjs +1 -0
- package/dist/web-components/viewer/Collection-By3puO0V.mjs +1 -0
- package/dist/web-components/viewer/Connected-DZNO2CPf.mjs +1 -0
- package/dist/web-components/viewer/Connected-ESg5y49m.mjs +1 -0
- package/dist/web-components/viewer/Contents-B_FqDwTW.mjs +1 -0
- package/dist/web-components/viewer/ControlMenu-DdQl-dTf.mjs +1 -0
- package/dist/web-components/viewer/Cue-BTRHfiWQ.mjs +1 -0
- package/dist/web-components/viewer/Document-B9_PyD2w.mjs +1 -0
- package/dist/web-components/viewer/DocumentPanel-CtEJVPoE.mjs +1 -0
- package/dist/web-components/viewer/DomLayers-DRdQSEtN.mjs +1 -0
- package/dist/web-components/viewer/EntryBodies-CJuTRcTq.mjs +1 -0
- package/dist/web-components/viewer/FieldPill-06uwrNwE.mjs +1 -0
- package/dist/web-components/viewer/FrameAnimation-3dcDHf5q.mjs +1 -0
- package/dist/web-components/viewer/Gallery-BYasTqZc.mjs +1 -0
- package/dist/web-components/viewer/HideToggle-BxkNMX-T.mjs +1 -0
- package/dist/web-components/viewer/LightboxBody-CXMc1xOH.mjs +1 -0
- package/dist/web-components/viewer/MapView-DCerrRRV.mjs +1 -0
- package/dist/web-components/viewer/MediaBody-BdkJcyGy.mjs +1 -0
- package/dist/web-components/viewer/MediaBody-waF4KvHp.mjs +1 -0
- package/dist/web-components/viewer/Navigator-CKwDgG2x.mjs +1 -0
- package/dist/web-components/viewer/PartOfManifest-DalHJFwC.mjs +1 -0
- package/dist/web-components/viewer/Search-Di_QQfDb.mjs +1 -0
- package/dist/web-components/viewer/StandaloneItems-B9J6nnWn.mjs +1 -0
- package/dist/web-components/viewer/Transcript-aHOixfna.mjs +1 -0
- package/dist/web-components/viewer/annotation-collection-I2UkdobR.mjs +1 -0
- package/dist/web-components/viewer/annotations-content-D-i4j9pD.mjs +1 -0
- package/dist/web-components/viewer/cloverEngine-CynoKdta.mjs +164 -0
- package/dist/web-components/viewer/content-state-reader-D7GIMcKK.mjs +1 -0
- package/dist/web-components/viewer/host-DlCltI_c.mjs +1 -0
- package/dist/web-components/viewer/index.d.mts +7 -0
- package/dist/web-components/viewer/index.mjs +1 -0
- package/dist/web-components/viewer/index.umd.js +18 -0
- package/dist/web-components/viewer/link-BX-wzj1u.mjs +1 -0
- package/dist/web-components/viewer/overlayImage-CHqn1fG8.mjs +1 -0
- package/dist/web-components/viewer/renderers-C_wdmw9v.mjs +1 -0
- package/dist/web-components/viewer/search-BHLyNxZ6.mjs +1 -0
- package/dist/web-components/viewer/styles-BRCkEU3w.mjs +1 -0
- package/dist/web-components/viewer/viewer-ipqAA-xQ.mjs +28 -0
- package/dist/web-components/viewer/vtt-XiS_-5Ao.mjs +5 -0
- package/dist/web-components/viewer-DEHIsIHd.mjs +1 -0
- package/dist/web-components/vtt-DYAOuQoK.mjs +5 -0
- package/dist/web-components/worker-CjXN0dku.mjs +1 -0
- package/package.json +111 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { GROUPS } from "./painting.mjs";
|
|
3
|
+
import { bodiesOf } from "./painting.mjs";
|
|
4
|
+
import { asArray } from "../lib/asArray.mjs";
|
|
5
|
+
function readFragment(id, fragment) {
|
|
6
|
+
const time = /(?:^|[#&])t=([^&]+)/.exec(fragment);
|
|
7
|
+
const t = time && { t: time[1] };
|
|
8
|
+
const xywh = /(?:^|[#&])xywh=(?:pixel:)?([^&]+)/.exec(fragment);
|
|
9
|
+
if (xywh) {
|
|
10
|
+
const [x, y, w, h] = xywh[1].split(",").map(Number);
|
|
11
|
+
if ([x, y, w, h].every(Number.isFinite)) {
|
|
12
|
+
return { id, rect: { x, y, w, h }, ...t };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return t && { id, ...t };
|
|
16
|
+
}
|
|
17
|
+
function readUri(uri) {
|
|
18
|
+
const hash = uri.indexOf("#");
|
|
19
|
+
if (hash >= 0) {
|
|
20
|
+
const id = uri.slice(0, hash);
|
|
21
|
+
return readFragment(id, uri.slice(hash)) ?? { id };
|
|
22
|
+
}
|
|
23
|
+
const query = uri.indexOf("&t=");
|
|
24
|
+
if (query >= 0) return { id: uri.slice(0, query), t: uri.slice(query + 3) };
|
|
25
|
+
return { id: uri };
|
|
26
|
+
}
|
|
27
|
+
const first = (target) => {
|
|
28
|
+
var _a;
|
|
29
|
+
return Array.isArray(target) ? first(target[0]) : GROUPS.includes(target == null ? void 0 : target.type) ? first((_a = target.items) == null ? void 0 : _a[0]) : target;
|
|
30
|
+
};
|
|
31
|
+
function parseAnnotationTarget(target) {
|
|
32
|
+
return readTarget(first(target));
|
|
33
|
+
}
|
|
34
|
+
function readTarget(target) {
|
|
35
|
+
var _a;
|
|
36
|
+
if (typeof target === "string") return readUri(target);
|
|
37
|
+
if (!target || typeof target !== "object") return { id: "" };
|
|
38
|
+
if (target.type !== "SpecificResource" || target.source === void 0) {
|
|
39
|
+
return readUri(target.id ?? "");
|
|
40
|
+
}
|
|
41
|
+
const source = typeof target.source === "string" ? readUri(target.source) : readUri(((_a = target.source) == null ? void 0 : _a.id) ?? "");
|
|
42
|
+
for (const raw of asArray(target.selector)) {
|
|
43
|
+
const selector = raw;
|
|
44
|
+
if ((selector == null ? void 0 : selector.type) === "PointSelector") {
|
|
45
|
+
return {
|
|
46
|
+
id: source.id,
|
|
47
|
+
point: { x: Number(selector.x), y: Number(selector.y) }
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if ((selector == null ? void 0 : selector.type) === "SvgSelector" && selector.value) {
|
|
51
|
+
return { id: source.id, svg: String(selector.value) };
|
|
52
|
+
}
|
|
53
|
+
if ((selector == null ? void 0 : selector.type) === "FragmentSelector" && selector.value) {
|
|
54
|
+
const parsed = readFragment(source.id, String(selector.value));
|
|
55
|
+
if (parsed) return parsed;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return source;
|
|
59
|
+
}
|
|
60
|
+
const isSound = (type) => type === "Audio" || type === "Sound";
|
|
61
|
+
const supplementsOnly = (motivation) => {
|
|
62
|
+
const motivations = asArray(motivation);
|
|
63
|
+
return motivations.length > 0 && motivations.every((each) => each === "supplementing");
|
|
64
|
+
};
|
|
65
|
+
const isRegionText = (motivation, target) => supplementsOnly(motivation) && Boolean(target.rect || target.svg || target.point) && !target.t;
|
|
66
|
+
export {
|
|
67
|
+
GROUPS,
|
|
68
|
+
bodiesOf,
|
|
69
|
+
isRegionText,
|
|
70
|
+
isSound,
|
|
71
|
+
parseAnnotationTarget,
|
|
72
|
+
supplementsOnly
|
|
73
|
+
};
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { findEntry, selectDrawnSets, selectHiddenSets, manifestOfAnnotation, readPage } from "./annotation-sets.mjs";
|
|
3
|
+
import { buildContentState } from "./content-state.mjs";
|
|
4
|
+
import { fetchResource, loadContent, loadManifest } from "./load.mjs";
|
|
5
|
+
import { referencedPages, fetchPage, embedPage } from "./pages.mjs";
|
|
6
|
+
import { selectVisibleCanvases, selectCanvas, selectSequence, canvasOfView, selectPosition, selectStart } from "./selectors.mjs";
|
|
7
|
+
import { searchServiceOf, SEARCH_SET_ID } from "./search-service.mjs";
|
|
8
|
+
import { createStore, createChannel } from "./store.mjs";
|
|
9
|
+
function navigationOf(clover, position, total) {
|
|
10
|
+
return {
|
|
11
|
+
position,
|
|
12
|
+
total,
|
|
13
|
+
hasPrevious: position > 0,
|
|
14
|
+
hasNext: position + 1 < total,
|
|
15
|
+
previous: () => clover.previous(),
|
|
16
|
+
next: () => clover.next(),
|
|
17
|
+
first: () => clover.first(),
|
|
18
|
+
last: () => clover.last(),
|
|
19
|
+
goTo: (canvasId) => clover.goTo(canvasId)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const NO_SEARCH = {
|
|
23
|
+
query: "",
|
|
24
|
+
status: "idle",
|
|
25
|
+
hits: [],
|
|
26
|
+
set: null
|
|
27
|
+
};
|
|
28
|
+
const INITIAL = {
|
|
29
|
+
status: "idle",
|
|
30
|
+
error: null,
|
|
31
|
+
manifest: null,
|
|
32
|
+
collection: null,
|
|
33
|
+
canvasId: null,
|
|
34
|
+
target: null,
|
|
35
|
+
annotationId: null,
|
|
36
|
+
hiddenSets: [],
|
|
37
|
+
shownSets: [],
|
|
38
|
+
addedSets: [],
|
|
39
|
+
search: NO_SEARCH
|
|
40
|
+
};
|
|
41
|
+
function createClover(options = {}) {
|
|
42
|
+
const store = createStore(INITIAL);
|
|
43
|
+
const viewport = createChannel(null);
|
|
44
|
+
const media = createChannel(null);
|
|
45
|
+
const captions = createChannel(null);
|
|
46
|
+
const highlight = createChannel(null);
|
|
47
|
+
const chapter = createChannel(null);
|
|
48
|
+
let annotating = null;
|
|
49
|
+
let searching = null;
|
|
50
|
+
let hostSets = [];
|
|
51
|
+
let stateSets = [];
|
|
52
|
+
let pending = null;
|
|
53
|
+
const added = () => hostSets.length || stateSets.length ? [...hostSets, ...stateSets] : INITIAL.addedSets;
|
|
54
|
+
let request = options.request;
|
|
55
|
+
let loading = null;
|
|
56
|
+
const requested = /* @__PURE__ */ new Set();
|
|
57
|
+
let pageScope = "view";
|
|
58
|
+
let allHeld = 0;
|
|
59
|
+
const embedVisiblePages = () => {
|
|
60
|
+
const { manifest, canvasId } = store.get();
|
|
61
|
+
if (!manifest) return;
|
|
62
|
+
const signal = loading == null ? void 0 : loading.signal;
|
|
63
|
+
for (const [canvas, list, pageId] of referencedPages(
|
|
64
|
+
pageScope === "all" || allHeld > 0 ? selectSequence(manifest).canvases : selectVisibleCanvases(manifest, canvasId)
|
|
65
|
+
)) {
|
|
66
|
+
if (requested.has(pageId)) continue;
|
|
67
|
+
requested.add(pageId);
|
|
68
|
+
fetchPage(pageId, canvas, request, signal).then((page) => {
|
|
69
|
+
if (signal == null ? void 0 : signal.aborted) return;
|
|
70
|
+
store.set(
|
|
71
|
+
(state) => state.manifest ? { manifest: embedPage(state.manifest, canvas, list, page) } : {}
|
|
72
|
+
);
|
|
73
|
+
}).catch(() => requested.delete(pageId));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
store.subscribe(embedVisiblePages);
|
|
77
|
+
const arrive = (manifest, collection, deepLink, initial, pick) => {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const { canvases } = selectSequence(manifest);
|
|
80
|
+
const has = (id) => Boolean(id) && canvases.some((canvas) => canvas.id === id);
|
|
81
|
+
const start = selectStart(manifest);
|
|
82
|
+
const target = has(deepLink == null ? void 0 : deepLink.canvasId) ? deepLink : has(start == null ? void 0 : start.canvasId) ? start : null;
|
|
83
|
+
const canvasId = has(initial.canvasId) ? initial.canvasId : (target == null ? void 0 : target.canvasId) ?? (has(initial.defaultCanvasId) ? initial.defaultCanvasId : null) ?? ((_a = canvases[0]) == null ? void 0 : _a.id) ?? null;
|
|
84
|
+
searching == null ? void 0 : searching.abort();
|
|
85
|
+
const picked = pick && ((_b = findEntry(stateSets, pick)) == null ? void 0 : _b.canvasId) === canvasId ? pick : null;
|
|
86
|
+
const arrival = target && picked ? { ...target, region: void 0 } : target;
|
|
87
|
+
store.set({
|
|
88
|
+
status: "ready",
|
|
89
|
+
search: NO_SEARCH,
|
|
90
|
+
manifest,
|
|
91
|
+
collection,
|
|
92
|
+
canvasId,
|
|
93
|
+
target: arrival && arrival.canvasId === canvasId ? arrival : null,
|
|
94
|
+
addedSets: added(),
|
|
95
|
+
annotationId: picked
|
|
96
|
+
});
|
|
97
|
+
if (canvasId && canvasId !== initial.canvasId) {
|
|
98
|
+
(_c = options.onCanvasChange) == null ? void 0 : _c.call(options, canvasId);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const setVisible = (setId, visible) => store.set((state) => {
|
|
102
|
+
const hidden = state.hiddenSets.filter((id) => id !== setId);
|
|
103
|
+
const shown = state.shownSets.filter((id) => id !== setId);
|
|
104
|
+
return visible ? { hiddenSets: hidden, shownSets: [...shown, setId] } : { hiddenSets: [...hidden, setId], shownSets: shown };
|
|
105
|
+
});
|
|
106
|
+
const navigate = (canvasId, target) => {
|
|
107
|
+
var _a, _b, _c;
|
|
108
|
+
if (!canvasId) return;
|
|
109
|
+
if ((_a = options.isControlled) == null ? void 0 : _a.call(options)) {
|
|
110
|
+
if (target) store.set({ target });
|
|
111
|
+
(_b = options.onCanvasChange) == null ? void 0 : _b.call(options, canvasId);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const changed = store.get().canvasId !== canvasId;
|
|
115
|
+
store.set({ canvasId, target });
|
|
116
|
+
if (changed) (_c = options.onCanvasChange) == null ? void 0 : _c.call(options, canvasId);
|
|
117
|
+
};
|
|
118
|
+
const stepTo = (view, autoplay = false) => {
|
|
119
|
+
const { manifest } = store.get();
|
|
120
|
+
const canvasId = canvasOfView(manifest, view);
|
|
121
|
+
navigate(canvasId, canvasId && autoplay ? { canvasId, autoplay } : null);
|
|
122
|
+
};
|
|
123
|
+
const position = () => {
|
|
124
|
+
const { manifest, canvasId } = store.get();
|
|
125
|
+
return {
|
|
126
|
+
at: selectPosition(manifest, canvasId),
|
|
127
|
+
total: selectSequence(manifest).views.length
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
const begin = () => {
|
|
131
|
+
loading == null ? void 0 : loading.abort();
|
|
132
|
+
const controller = new AbortController();
|
|
133
|
+
loading = controller;
|
|
134
|
+
requested.clear();
|
|
135
|
+
store.set({ status: "loading", error: null, annotationId: null });
|
|
136
|
+
return controller.signal;
|
|
137
|
+
};
|
|
138
|
+
const fail = (error) => store.set({
|
|
139
|
+
status: "error",
|
|
140
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
141
|
+
});
|
|
142
|
+
async function load(content, initial = {}) {
|
|
143
|
+
var _a;
|
|
144
|
+
const signal = begin();
|
|
145
|
+
try {
|
|
146
|
+
const loaded = await loadContent(content, {
|
|
147
|
+
request,
|
|
148
|
+
signal,
|
|
149
|
+
manifestId: initial.manifestId ?? void 0
|
|
150
|
+
});
|
|
151
|
+
if (signal.aborted) return;
|
|
152
|
+
const note = loaded.annotation;
|
|
153
|
+
const noted = note ? readPage({ items: [note] }, `${note.id}#content-state`) : [];
|
|
154
|
+
stateSets = noted.length ? [{ id: `${note.id}#content-state`, source: "added", entries: noted }] : loaded.annotationSets ?? [];
|
|
155
|
+
const pick = pending ?? ((_a = noted[0]) == null ? void 0 : _a.id) ?? loaded.pick;
|
|
156
|
+
pending = null;
|
|
157
|
+
arrive(
|
|
158
|
+
loaded.manifest,
|
|
159
|
+
loaded.collection ?? null,
|
|
160
|
+
loaded.target,
|
|
161
|
+
initial,
|
|
162
|
+
pick
|
|
163
|
+
);
|
|
164
|
+
} catch (error) {
|
|
165
|
+
if (!signal.aborted) fail(error);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const isShown = (id) => {
|
|
169
|
+
const { manifest, collection } = store.get();
|
|
170
|
+
return (manifest == null ? void 0 : manifest.id) === id || (collection == null ? void 0 : collection.id) === id;
|
|
171
|
+
};
|
|
172
|
+
const memberOf = (id) => {
|
|
173
|
+
var _a;
|
|
174
|
+
return (((_a = store.get().collection) == null ? void 0 : _a.items) ?? []).find(
|
|
175
|
+
(item) => item.id === id
|
|
176
|
+
) ?? { id, type: "Manifest" };
|
|
177
|
+
};
|
|
178
|
+
const openAnnotation = (manifestId, id) => {
|
|
179
|
+
var _a, _b;
|
|
180
|
+
pending = id;
|
|
181
|
+
if ((_a = options.isManifestControlled) == null ? void 0 : _a.call(options)) {
|
|
182
|
+
(_b = options.onManifestChange) == null ? void 0 : _b.call(options, manifestId);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
void show({ id: manifestId, type: "Manifest" }).then(
|
|
186
|
+
(shown) => {
|
|
187
|
+
var _a2;
|
|
188
|
+
return shown && ((_a2 = options.onManifestChange) == null ? void 0 : _a2.call(options, manifestId));
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
const show = async (member, canvasId) => {
|
|
193
|
+
if (member.type === "Collection") {
|
|
194
|
+
await load(member.id);
|
|
195
|
+
return store.get().status === "ready";
|
|
196
|
+
}
|
|
197
|
+
const { collection } = store.get();
|
|
198
|
+
const signal = begin();
|
|
199
|
+
const pick = pending;
|
|
200
|
+
pending = null;
|
|
201
|
+
const waiting = pick ? findEntry(stateSets, pick) : null;
|
|
202
|
+
try {
|
|
203
|
+
const next = await loadManifest(member, { request, signal });
|
|
204
|
+
if (signal.aborted) return false;
|
|
205
|
+
arrive(
|
|
206
|
+
next,
|
|
207
|
+
collection,
|
|
208
|
+
waiting ? { canvasId: waiting.canvasId } : canvasId ? { canvasId } : void 0,
|
|
209
|
+
{},
|
|
210
|
+
pick
|
|
211
|
+
);
|
|
212
|
+
return true;
|
|
213
|
+
} catch (error) {
|
|
214
|
+
if (!signal.aborted) fail(error);
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
return {
|
|
219
|
+
store,
|
|
220
|
+
viewport,
|
|
221
|
+
media,
|
|
222
|
+
captions,
|
|
223
|
+
highlight,
|
|
224
|
+
chapter,
|
|
225
|
+
get request() {
|
|
226
|
+
return request;
|
|
227
|
+
},
|
|
228
|
+
setRequest(next) {
|
|
229
|
+
request = next;
|
|
230
|
+
},
|
|
231
|
+
load,
|
|
232
|
+
async openCollection(id) {
|
|
233
|
+
var _a;
|
|
234
|
+
const shown = store.get().manifest;
|
|
235
|
+
if (!shown || ((_a = store.get().collection) == null ? void 0 : _a.id) === id) return;
|
|
236
|
+
try {
|
|
237
|
+
const collection = await fetchResource(id, { request });
|
|
238
|
+
if (collection.type !== "Collection") return;
|
|
239
|
+
if (store.get().manifest !== shown) return;
|
|
240
|
+
store.set({ collection });
|
|
241
|
+
} catch {
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
async goToManifest(id, canvasId) {
|
|
245
|
+
var _a, _b, _c;
|
|
246
|
+
if (isShown(id)) return;
|
|
247
|
+
const member = memberOf(id);
|
|
248
|
+
if (member.type !== "Collection" && ((_a = options.isManifestControlled) == null ? void 0 : _a.call(options))) {
|
|
249
|
+
(_b = options.onManifestChange) == null ? void 0 : _b.call(options, id);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (await show(member, canvasId)) {
|
|
253
|
+
(_c = options.onManifestChange) == null ? void 0 : _c.call(options, store.get().manifest.id);
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
async syncManifest(id) {
|
|
257
|
+
if (!id || isShown(id) || store.get().status !== "ready") return;
|
|
258
|
+
await show(memberOf(id));
|
|
259
|
+
},
|
|
260
|
+
goTo(canvasId, target) {
|
|
261
|
+
navigate(canvasId, target ? { ...target, canvasId } : null);
|
|
262
|
+
},
|
|
263
|
+
next({ autoplay = false, wrap = false } = {}) {
|
|
264
|
+
const { at, total } = position();
|
|
265
|
+
if (at + 1 < total) stepTo(at + 1, autoplay);
|
|
266
|
+
else if (wrap && total > 1) stepTo(0, autoplay);
|
|
267
|
+
},
|
|
268
|
+
previous() {
|
|
269
|
+
const { at } = position();
|
|
270
|
+
if (at > 0) stepTo(at - 1);
|
|
271
|
+
},
|
|
272
|
+
first() {
|
|
273
|
+
stepTo(0);
|
|
274
|
+
},
|
|
275
|
+
last() {
|
|
276
|
+
stepTo(position().total - 1);
|
|
277
|
+
},
|
|
278
|
+
consumeTarget() {
|
|
279
|
+
store.set({ target: null });
|
|
280
|
+
},
|
|
281
|
+
syncCanvas(canvasId) {
|
|
282
|
+
if (canvasId) store.set({ canvasId });
|
|
283
|
+
},
|
|
284
|
+
selectAnnotation(id) {
|
|
285
|
+
const { manifest, addedSets, canvasId, search } = store.get();
|
|
286
|
+
const entry = findEntry(
|
|
287
|
+
selectDrawnSets(manifest, addedSets, search.set),
|
|
288
|
+
id
|
|
289
|
+
);
|
|
290
|
+
store.set({ annotationId: entry ? id : null });
|
|
291
|
+
if (!entry) return;
|
|
292
|
+
const { hiddenSets, shownSets } = store.get();
|
|
293
|
+
if (entry.setId !== SEARCH_SET_ID && selectHiddenSets(manifest, addedSets, hiddenSets, shownSets).includes(
|
|
294
|
+
entry.setId
|
|
295
|
+
))
|
|
296
|
+
setVisible(entry.setId, true);
|
|
297
|
+
const shown = selectVisibleCanvases(manifest, canvasId).some(
|
|
298
|
+
(canvas) => canvas.id === entry.canvasId
|
|
299
|
+
);
|
|
300
|
+
const exists = selectCanvas(manifest, entry.canvasId) !== null;
|
|
301
|
+
if (!shown && exists) navigate(entry.canvasId, null);
|
|
302
|
+
const elsewhere = exists ? void 0 : manifestOfAnnotation(entry.annotation);
|
|
303
|
+
if (elsewhere) openAnnotation(elsewhere, entry.id);
|
|
304
|
+
},
|
|
305
|
+
async search(query) {
|
|
306
|
+
searching == null ? void 0 : searching.abort();
|
|
307
|
+
const service = searchServiceOf(store.get().manifest);
|
|
308
|
+
const q = query.trim();
|
|
309
|
+
if (!q || !service) {
|
|
310
|
+
searching = null;
|
|
311
|
+
store.set({ search: NO_SEARCH, annotationId: null });
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const controller = new AbortController();
|
|
315
|
+
searching = controller;
|
|
316
|
+
store.set((state) => ({
|
|
317
|
+
search: { ...state.search, query: q, status: "loading" }
|
|
318
|
+
}));
|
|
319
|
+
try {
|
|
320
|
+
const { searchInto } = await import("./search.mjs");
|
|
321
|
+
await searchInto(store, service, q, request, controller.signal);
|
|
322
|
+
} catch {
|
|
323
|
+
store.set({
|
|
324
|
+
search: { query: q, status: "error", hits: [], set: null }
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
setSetVisible(setId, visible) {
|
|
329
|
+
setVisible(setId, visible);
|
|
330
|
+
},
|
|
331
|
+
async loadAnnotations(input) {
|
|
332
|
+
annotating == null ? void 0 : annotating.abort();
|
|
333
|
+
if (!input) {
|
|
334
|
+
hostSets = [];
|
|
335
|
+
store.set({ addedSets: added() });
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const controller = new AbortController();
|
|
339
|
+
annotating = controller;
|
|
340
|
+
try {
|
|
341
|
+
const { loadAnnotationSets } = await import("./annotation-collection.mjs");
|
|
342
|
+
const sets = await loadAnnotationSets(input, {
|
|
343
|
+
request,
|
|
344
|
+
signal: controller.signal
|
|
345
|
+
});
|
|
346
|
+
if (controller.signal.aborted) return;
|
|
347
|
+
hostSets = sets;
|
|
348
|
+
store.set({ addedSets: added() });
|
|
349
|
+
} catch {
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
getContentState() {
|
|
353
|
+
const { manifest, canvasId } = store.get();
|
|
354
|
+
if (!manifest || !canvasId) return null;
|
|
355
|
+
const view = viewport.get();
|
|
356
|
+
const element = media.get();
|
|
357
|
+
const time = element && element.currentTime > 0 ? element.currentTime : null;
|
|
358
|
+
const current = view && selectVisibleCanvases(manifest, canvasId).some(
|
|
359
|
+
(canvas) => canvas.id === view.canvasId
|
|
360
|
+
);
|
|
361
|
+
const onView = current && !time ? view : null;
|
|
362
|
+
return buildContentState({
|
|
363
|
+
manifestId: manifest.id,
|
|
364
|
+
canvasId: (onView == null ? void 0 : onView.canvasId) ?? canvasId,
|
|
365
|
+
region: onView == null ? void 0 : onView.region,
|
|
366
|
+
time
|
|
367
|
+
});
|
|
368
|
+
},
|
|
369
|
+
setAnnotationPages(scope) {
|
|
370
|
+
if (scope === pageScope) return;
|
|
371
|
+
pageScope = scope;
|
|
372
|
+
embedVisiblePages();
|
|
373
|
+
},
|
|
374
|
+
holdAllAnnotationPages() {
|
|
375
|
+
allHeld++;
|
|
376
|
+
embedVisiblePages();
|
|
377
|
+
let held = true;
|
|
378
|
+
return () => {
|
|
379
|
+
if (held) allHeld--;
|
|
380
|
+
held = false;
|
|
381
|
+
};
|
|
382
|
+
},
|
|
383
|
+
dispose() {
|
|
384
|
+
loading == null ? void 0 : loading.abort();
|
|
385
|
+
annotating == null ? void 0 : annotating.abort();
|
|
386
|
+
searching == null ? void 0 : searching.abort();
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
export {
|
|
391
|
+
createClover,
|
|
392
|
+
navigationOf
|
|
393
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { parseAnnotationTarget } from "./annotations.mjs";
|
|
3
|
+
import { asArray } from "../lib/asArray.mjs";
|
|
4
|
+
function decodeBase64Url(encoded) {
|
|
5
|
+
const base64 = encoded.replace(/-/g, "+").replace(/_/g, "/");
|
|
6
|
+
const padded = base64 + "=".repeat((4 - base64.length % 4) % 4);
|
|
7
|
+
const binary = atob(padded);
|
|
8
|
+
try {
|
|
9
|
+
return decodeURIComponent(binary);
|
|
10
|
+
} catch {
|
|
11
|
+
const bytes = Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
12
|
+
return new TextDecoder().decode(bytes);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function decodeContentState(value) {
|
|
16
|
+
const trimmed = value.trim();
|
|
17
|
+
for (const read of [
|
|
18
|
+
() => JSON.parse(trimmed),
|
|
19
|
+
() => JSON.parse(decodeBase64Url(trimmed))
|
|
20
|
+
]) {
|
|
21
|
+
try {
|
|
22
|
+
const json = read();
|
|
23
|
+
if (json && typeof json === "object") return json;
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function startTime(t) {
|
|
30
|
+
if (!t) return void 0;
|
|
31
|
+
const seconds = Number(t.split(",")[0]);
|
|
32
|
+
return Number.isFinite(seconds) ? seconds : void 0;
|
|
33
|
+
}
|
|
34
|
+
const collectionOf = (resource) => asArray(resource == null ? void 0 : resource.partOf).find(
|
|
35
|
+
(part) => (part == null ? void 0 : part.id) && part.type === "Collection"
|
|
36
|
+
);
|
|
37
|
+
function resolveContentState(json) {
|
|
38
|
+
const target = json.type === "Annotation" ? asArray(json.target)[0] : json;
|
|
39
|
+
if (!target) return null;
|
|
40
|
+
const parsed = parseAnnotationTarget(target);
|
|
41
|
+
const resource = typeof target === "string" ? { id: parsed.id } : target.type === "SpecificResource" ? typeof target.source === "string" ? { id: target.source } : target.source ?? {} : target;
|
|
42
|
+
const type = resource.type;
|
|
43
|
+
if (type === "Manifest" || type === "Collection") {
|
|
44
|
+
const collection2 = type === "Manifest" ? collectionOf(resource) : void 0;
|
|
45
|
+
return collection2 ? { id: collection2.id, type: "Collection", manifestId: parsed.id } : { id: parsed.id, type };
|
|
46
|
+
}
|
|
47
|
+
const pointTime = asArray(target.selector).find(
|
|
48
|
+
(selector) => (selector == null ? void 0 : selector.type) === "PointSelector" && selector.t != null
|
|
49
|
+
);
|
|
50
|
+
const canvasTarget = { canvasId: parsed.id };
|
|
51
|
+
if (parsed.rect) canvasTarget.region = parsed.rect;
|
|
52
|
+
const time = (pointTime == null ? void 0 : pointTime.t) ?? startTime(parsed.t);
|
|
53
|
+
if (time !== void 0) canvasTarget.time = Number(time);
|
|
54
|
+
const partOf = asArray(resource.partOf).find(
|
|
55
|
+
(part) => (part == null ? void 0 : part.id) && (!part.type || part.type === "Manifest")
|
|
56
|
+
);
|
|
57
|
+
const collection = collectionOf(partOf);
|
|
58
|
+
const annotation = json.type === "Annotation" && asArray(json.body).length ? {
|
|
59
|
+
id: json.id ?? `${parsed.id}#content-state`,
|
|
60
|
+
type: "Annotation",
|
|
61
|
+
motivation: asArray(json.motivation),
|
|
62
|
+
body: json.body,
|
|
63
|
+
target
|
|
64
|
+
} : void 0;
|
|
65
|
+
const shared = annotation ? { annotation } : {};
|
|
66
|
+
return collection && partOf ? {
|
|
67
|
+
id: collection.id,
|
|
68
|
+
type: "Collection",
|
|
69
|
+
manifestId: partOf.id,
|
|
70
|
+
target: canvasTarget,
|
|
71
|
+
...shared
|
|
72
|
+
} : partOf ? { id: partOf.id, type: "Manifest", target: canvasTarget, ...shared } : {
|
|
73
|
+
id: parsed.id,
|
|
74
|
+
type: type ?? "Canvas",
|
|
75
|
+
target: canvasTarget,
|
|
76
|
+
...shared
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export {
|
|
80
|
+
decodeContentState,
|
|
81
|
+
resolveContentState
|
|
82
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { asArray } from "../lib/asArray.mjs";
|
|
3
|
+
function isContentState(json) {
|
|
4
|
+
const value = json;
|
|
5
|
+
if (!value || typeof value !== "object") return false;
|
|
6
|
+
if (value.type === "Annotation") {
|
|
7
|
+
return asArray(value.motivation).includes("contentState");
|
|
8
|
+
}
|
|
9
|
+
return value.type === "SpecificResource";
|
|
10
|
+
}
|
|
11
|
+
function encodeContentState(json) {
|
|
12
|
+
return btoa(encodeURIComponent(JSON.stringify(json))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
13
|
+
}
|
|
14
|
+
function buildContentState({
|
|
15
|
+
manifestId,
|
|
16
|
+
canvasId,
|
|
17
|
+
region,
|
|
18
|
+
time
|
|
19
|
+
}) {
|
|
20
|
+
const source = {
|
|
21
|
+
id: canvasId,
|
|
22
|
+
type: "Canvas",
|
|
23
|
+
partOf: [{ id: manifestId, type: "Manifest" }]
|
|
24
|
+
};
|
|
25
|
+
const fragment = time != null && time > 0 ? `t=${Math.round(time * 100) / 100}` : region ? `xywh=${[region.x, region.y, region.w, region.h].map(Math.round).join(",")}` : null;
|
|
26
|
+
const json = {
|
|
27
|
+
"@context": "http://iiif.io/api/presentation/3/context.json",
|
|
28
|
+
id: `${canvasId}#content-state`,
|
|
29
|
+
type: "Annotation",
|
|
30
|
+
motivation: ["contentState"],
|
|
31
|
+
target: fragment ? {
|
|
32
|
+
type: "SpecificResource",
|
|
33
|
+
source,
|
|
34
|
+
selector: { type: "FragmentSelector", value: fragment }
|
|
35
|
+
} : source
|
|
36
|
+
};
|
|
37
|
+
return { json, encoded: encodeContentState(json) };
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
buildContentState,
|
|
41
|
+
encodeContentState,
|
|
42
|
+
isContentState
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const RTL_LANGUAGE = /^(ar|arc|ckb|dv|fa|he|iw|ks|ps|sd|syr|ug|ur|yi)$/;
|
|
3
|
+
const RTL_SCRIPT = /^(adlm|arab|hebr|nkoo|rohg|syrc|thaa)$/;
|
|
4
|
+
function directionOf(lang) {
|
|
5
|
+
if (!lang) return void 0;
|
|
6
|
+
const [primary, ...subtags] = lang.toLowerCase().split(/[-_]/);
|
|
7
|
+
const script = subtags.find((subtag) => subtag.length === 4);
|
|
8
|
+
return (script ? RTL_SCRIPT.test(script) : RTL_LANGUAGE.test(primary)) ? "rtl" : void 0;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
directionOf
|
|
12
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { selectSequence } from "./selectors.mjs";
|
|
3
|
+
import { asArray } from "../lib/asArray.mjs";
|
|
4
|
+
function hasMapData(manifest, collection = null) {
|
|
5
|
+
if (!manifest) return false;
|
|
6
|
+
if ((collection == null ? void 0 : collection.navPlace) || manifest.navPlace) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
for (const canvas of selectSequence(manifest).canvases) {
|
|
10
|
+
if (canvas.navPlace) return true;
|
|
11
|
+
for (const page of asArray(canvas.annotations)) {
|
|
12
|
+
for (const annotation of asArray(page == null ? void 0 : page.items)) {
|
|
13
|
+
if (annotation == null ? void 0 : annotation.navPlace) return true;
|
|
14
|
+
if (asArray(annotation == null ? void 0 : annotation.motivation).includes("georeferencing")) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
const bodies = asArray(annotation == null ? void 0 : annotation.body);
|
|
18
|
+
if (bodies.some(
|
|
19
|
+
(body) => (body == null ? void 0 : body.type) === "Feature" || (body == null ? void 0 : body.type) === "FeatureCollection"
|
|
20
|
+
)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
hasMapData
|
|
30
|
+
};
|