@nulib/clover 4.0.0-beta.1 → 4.0.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/README.md +7 -7
- package/dist/components/Annotations/Annotations.mjs +165 -204
- package/dist/components/Annotations/EntryBodies.mjs +28 -3
- package/dist/components/Annotations/languages.mjs +1 -17
- package/dist/components/Body/BodyAlert.mjs +2 -1
- package/dist/components/Body/Caption.mjs +2 -1
- package/dist/components/Body/CaptionDetails.mjs +2 -1
- package/dist/components/Body/glyphs.mjs +9 -0
- package/dist/components/Canvas/AnnotationMenu.mjs +76 -60
- package/dist/components/Canvas/AnnotationState.mjs +9 -2
- package/dist/components/Canvas/Annotations.mjs +16 -7
- package/dist/components/Canvas/CanvasView.mjs +173 -32
- package/dist/components/Canvas/ChoiceMenu.mjs +51 -31
- package/dist/components/Canvas/Connected.mjs +38 -4
- package/dist/components/Canvas/ControlMenu.mjs +6 -4
- package/dist/components/Canvas/Controls.mjs +17 -1
- package/dist/components/Canvas/FrameAnimation.mjs +568 -167
- package/dist/components/Canvas/LoadedCanvas.mjs +5 -3
- package/dist/components/Canvas/PlaceBox.mjs +74 -0
- package/dist/components/Canvas/Placeholder.mjs +2 -1
- package/dist/components/Canvas/fromManifest.mjs +2 -1
- package/dist/components/Canvas/layout.mjs +121 -32
- package/dist/components/Canvas/media/MediaBody.mjs +32 -6
- package/dist/components/Canvas/media/Player.mjs +11 -25
- package/dist/components/Canvas/media/Transport.mjs +94 -61
- package/dist/components/Canvas/media/TransportButton.mjs +2 -1
- package/dist/components/Canvas/media/placeMenu.mjs +19 -0
- package/dist/components/Canvas/media/seekGaps.mjs +43 -0
- package/dist/components/Canvas/media/sequence.mjs +96 -0
- package/dist/components/Canvas/media/useMediaElement.mjs +22 -3
- package/dist/components/Collection/Collection.mjs +2 -1
- package/dist/components/CollectionSelect/CollectionSelect.mjs +5 -2
- package/dist/components/Contents/Contents.mjs +163 -34
- package/dist/components/Download/Download.mjs +34 -38
- package/dist/components/Download/downloads.mjs +40 -0
- package/dist/components/Items/AnnotationItems.mjs +165 -0
- package/dist/components/Items/CountMenu.mjs +89 -0
- package/dist/components/Items/Item.mjs +24 -17
- package/dist/components/Items/Items.mjs +65 -37
- package/dist/components/Items/Pager.mjs +39 -79
- package/dist/components/Items/PagerLayout.mjs +41 -0
- package/dist/components/Items/Position.mjs +103 -0
- package/dist/components/Items/StandaloneItems.mjs +12 -4
- package/dist/components/Items/TargetItems.mjs +202 -0
- package/dist/components/Label/Label.mjs +2 -1
- package/dist/components/Map/MapView.mjs +367 -57
- package/dist/components/Panel/About.mjs +36 -7
- package/dist/components/Panel/AboutActions.mjs +117 -0
- package/dist/components/Panel/Panel.mjs +58 -18
- package/dist/components/Panel/PartOfManifest.mjs +4 -3
- package/dist/components/Panel/ReadingLanguages.mjs +20 -0
- package/dist/components/Primitives/Primitives.mjs +18 -3
- package/dist/components/Provider/Provider.mjs +19 -5
- package/dist/components/Root/Announcer.mjs +3 -2
- package/dist/components/Root/Root.mjs +5 -2
- package/dist/components/Root/useRootState.mjs +14 -2
- package/dist/components/Scene/SceneView.mjs +23 -6
- package/dist/components/Search/Search.mjs +3 -2
- package/dist/components/Split/Split.mjs +4 -1
- package/dist/components/Status/Status.mjs +10 -2
- package/dist/components/Timeline/playerSurface.mjs +2 -1
- package/dist/components/Transcript/Transcript.mjs +42 -23
- package/dist/core/annotation-bodies.mjs +25 -5
- package/dist/core/annotation-collection.mjs +3 -2
- package/dist/core/annotation-name.mjs +12 -9
- package/dist/core/annotation-sets.mjs +139 -10
- package/dist/core/annotations-content.mjs +8 -1
- package/dist/core/annotations.mjs +8 -1
- package/dist/core/choice-key.mjs +5 -0
- package/dist/core/clover.mjs +105 -20
- package/dist/core/content-state-reader.mjs +33 -2
- package/dist/core/dates-format.mjs +30 -0
- package/dist/core/dates.mjs +19 -0
- package/dist/core/geo.mjs +46 -5
- package/dist/core/image-layers.mjs +96 -0
- package/dist/core/items.mjs +4 -2
- package/dist/core/language-choice.mjs +30 -0
- package/dist/core/link.mjs +15 -1
- package/dist/core/load.mjs +4 -2
- package/dist/core/pages.mjs +20 -1
- package/dist/core/presentation.mjs +6 -4
- package/dist/core/range-regions.mjs +70 -0
- package/dist/core/ranges.mjs +52 -18
- package/dist/core/region.mjs +7 -2
- package/dist/core/sanitize.mjs +86 -1
- package/dist/core/save-file.mjs +33 -0
- package/dist/core/selectors.mjs +12 -0
- package/dist/core/upgrade.mjs +23 -0
- package/dist/core/value.mjs +11 -23
- package/dist/hooks/useFullscreenExit.mjs +26 -0
- package/dist/hooks/useHighContrast.mjs +27 -0
- package/dist/i18n/autonym.mjs +11 -0
- package/dist/i18n/config.mjs +3 -8
- package/dist/{core → i18n}/direction.mjs +5 -1
- package/dist/i18n/languages.mjs +44 -0
- package/dist/i18n/locales/en.json.mjs +1 -1
- package/dist/i18n/locales/es.json.mjs +1 -1
- package/dist/i18n/locales/fi.json.mjs +1 -1
- package/dist/i18n/locales/fr.json.mjs +1 -1
- package/dist/i18n/locales/nb.json.mjs +1 -1
- package/dist/i18n/locales/nn.json.mjs +1 -1
- package/dist/i18n/locales/no.json.mjs +1 -1
- package/dist/i18n/locales/pt.json.mjs +1 -1
- package/dist/{ui → i18n}/useContainerName.mjs +5 -4
- package/dist/{react/language.mjs → i18n/useRootLanguage.mjs} +2 -2
- package/dist/index.d.mts +393 -53
- package/dist/index.mjs +6 -2
- package/dist/lib/fullscreen.mjs +6 -1
- package/dist/lib/renderer/CanvasRenderer.mjs +28 -5
- package/dist/lib/renderer/math/affine.mjs +14 -0
- package/dist/lib/renderer/scene/planFrame.mjs +12 -12
- package/dist/lib/renderer/scene/regions.mjs +11 -1
- package/dist/lib/renderer/scene/sceneItem.mjs +72 -9
- package/dist/lib/time.mjs +10 -0
- package/dist/map/index.d.mts +26 -4
- package/dist/react/fetchManifest.mjs +19 -0
- package/dist/react/hooks.mjs +7 -1
- package/dist/react/readingLanguages.mjs +16 -0
- package/dist/react/usePagesReached.mjs +42 -0
- package/dist/styles.css +1 -1
- package/dist/templates/default/Default.mjs +87 -9
- package/dist/templates/document/Document.mjs +5 -1
- package/dist/templates/index.d.mts +21 -3
- package/dist/templates.css +1 -1
- package/dist/ui/BodyUnloadable.mjs +34 -0
- package/dist/ui/Button.mjs +2 -1
- package/dist/ui/Chevron.mjs +34 -0
- package/dist/ui/ControlCluster.mjs +6 -3
- package/dist/ui/EntryThumbnail.mjs +60 -0
- package/dist/ui/ExitFullscreen.mjs +2 -1
- package/dist/ui/FieldPill.mjs +5 -4
- package/dist/ui/HideToggle.mjs +2 -1
- package/dist/ui/LanguageChoice.mjs +45 -0
- package/dist/ui/ListEnd.mjs +29 -0
- package/dist/ui/Markup.mjs +27 -8
- package/dist/ui/NavDate.mjs +29 -0
- package/dist/ui/ReadMore.mjs +3 -2
- package/dist/ui/Sections.mjs +19 -28
- package/dist/ui/Steps.mjs +4 -3
- package/dist/ui/Tip.mjs +9 -4
- package/dist/web-components/About-DhOGPFaI.mjs +1 -0
- package/dist/web-components/AnnotationItems-CNP4CJiT.mjs +1 -0
- package/dist/web-components/AnnotationMenu-BCwwwfbb.mjs +1 -0
- package/dist/web-components/AnnotationState-CavxnAAq.mjs +1 -0
- package/dist/web-components/Annotations-DDjSrBL5.mjs +2 -0
- package/dist/web-components/Annotations-rBmeI5sR.mjs +1 -0
- package/dist/web-components/Body-DaY1UJIy.mjs +1 -0
- package/dist/web-components/BodyAlert-COKp19lq.mjs +1 -0
- package/dist/web-components/BodyUnloadable-DcTM7hHF.mjs +1 -0
- package/dist/web-components/Button-DLFYqtz9.mjs +1 -0
- package/dist/web-components/{Camera-cdCqKMup.mjs → Camera-Cp5ma-6C.mjs} +1 -1
- package/dist/web-components/{Canvas2DBackend-CnLEHRs4.mjs → Canvas2DBackend-3PToh87Z.mjs} +1 -1
- package/dist/web-components/CanvasView-BWQ4SK2b.mjs +2 -0
- package/dist/web-components/CaptionDetails-DSziiuQV.mjs +1 -0
- package/dist/web-components/Chevron-r-_hUPn8.mjs +1 -0
- package/dist/web-components/ChoiceMenu-DTuEEUeM.mjs +1 -0
- package/dist/web-components/Collection-B9swJtPW.mjs +1 -0
- package/dist/web-components/CollectionSelect-CBWUbqQi.mjs +1 -0
- package/dist/web-components/Connected-B2d6EoFl.mjs +1 -0
- package/dist/web-components/Connected-BSRM9FJY.mjs +1 -0
- package/dist/web-components/Connected-BnpxYeJN.mjs +1 -0
- package/dist/web-components/Contents-D7FPxSH-.mjs +1 -0
- package/dist/web-components/ControlMenu-Crtho2cs.mjs +1 -0
- package/dist/web-components/CountMenu-DyTp_J4k.mjs +1 -0
- package/dist/web-components/Cue-CbZaGwZh.mjs +1 -0
- package/dist/web-components/Document-BfltLWZZ.mjs +1 -0
- package/dist/web-components/DocumentPanel-ZSe40cV4.mjs +1 -0
- package/dist/web-components/{DomLayers-BD4QPbl6.mjs → DomLayers-CTGub6wo.mjs} +1 -1
- package/dist/web-components/Download-BOYNIb7C.mjs +1 -0
- package/dist/web-components/EntryBodies-Bfd2Z42z.mjs +1 -0
- package/dist/web-components/EntryThumbnail-DQE8ajI9.mjs +1 -0
- package/dist/web-components/FieldPill-D5DNJWLy.mjs +1 -0
- package/dist/web-components/FrameAnimation-IfR1czfc.mjs +1 -0
- package/dist/web-components/Gallery-DD06BDQo.mjs +1 -0
- package/dist/web-components/HideToggle-DL911R1Z.mjs +1 -0
- package/dist/web-components/Items-BHzT9A73.mjs +1 -0
- package/dist/web-components/Label-KabnxuMN.mjs +1 -0
- package/dist/web-components/LanguageChoice-DT1UPiDn.mjs +1 -0
- package/dist/web-components/LightboxBody-BhRhdXo6.mjs +1 -0
- package/dist/web-components/ListEnd-CbwNlty-.mjs +1 -0
- package/dist/web-components/{Loaded-D5xmFRSo.mjs → Loaded-BWfEBJyg.mjs} +1 -1
- package/dist/web-components/LoadedCanvas-CdZ5WOWz.mjs +1 -0
- package/dist/web-components/LoadedMap-DQyQVRVQ.mjs +1 -0
- package/dist/web-components/{Loading-CBKfwsML.mjs → Loading-zw74TdAz.mjs} +1 -1
- package/dist/web-components/{Map-Bcgp_R8H.mjs → Map--dJhk0_0.mjs} +1 -1
- package/dist/web-components/MapView-duA5WGsu.mjs +3 -0
- package/dist/web-components/Markup-D-kioDf9.mjs +2 -0
- package/dist/web-components/MediaBody-CoOiVXcv.mjs +1 -0
- package/dist/web-components/MediaBody-d8ErTuwT.mjs +1 -0
- package/dist/web-components/NavDate-BQHuyLOC.mjs +1 -0
- package/dist/web-components/{Navigator-BSJbEbuJ.mjs → Navigator-B3U21_ti.mjs} +1 -1
- package/dist/web-components/Pager-DnJknq92.mjs +1 -0
- package/dist/web-components/PagerLayout-CvOmKtSW.mjs +1 -0
- package/dist/web-components/Panel-CIdjOznL.mjs +1 -0
- package/dist/web-components/{PanelToggle-mUDw73zI.mjs → PanelToggle-CFtWIeWv.mjs} +1 -1
- package/dist/web-components/PartOfManifest-F87jIrf9.mjs +1 -0
- package/dist/web-components/{Pending-BPOQ2z1L.mjs → Pending-CYAQajKu.mjs} +1 -1
- package/dist/web-components/PlaceBox-BtIbIotm.mjs +1 -0
- package/dist/web-components/Placeholder-TIyj4ZjR.mjs +1 -0
- package/dist/web-components/Position-BkWBRBfW.mjs +1 -0
- package/dist/web-components/Primitives-BmODPlnK.mjs +1 -0
- package/dist/web-components/Provider-C8se8i4I.mjs +1 -0
- package/dist/web-components/ReadMore-BwGFsLS2.mjs +1 -0
- package/dist/web-components/Root-CAJB0-Mh.mjs +1 -0
- package/dist/web-components/Scene-Ctcdt7CD.mjs +1 -0
- package/dist/web-components/SceneView-B6bEx_7x.mjs +1 -0
- package/dist/web-components/Search-CbmK9vLp.mjs +1 -0
- package/dist/web-components/Sections-Dy5_pkyQ.mjs +2 -0
- package/dist/web-components/StandaloneItems-BmUnBp0H.mjs +1 -0
- package/dist/web-components/Status-Dww3Pyf4.mjs +1 -0
- package/dist/web-components/Steps-o_UprQfZ.mjs +1 -0
- package/dist/web-components/TargetItems-BBOGDubv.mjs +1 -0
- package/dist/web-components/Timeline-CfIF4APc.mjs +1 -0
- package/dist/web-components/Tip-BbexILXs.mjs +1 -0
- package/dist/web-components/Transcript-ZVXM3ZDA.mjs +1 -0
- package/dist/web-components/annotation-collection-7SS1ELcO.mjs +1 -0
- package/dist/web-components/annotation-name-CYkZopdd.mjs +1 -0
- package/dist/web-components/annotations-content-Bdtn50sf.mjs +1 -0
- package/dist/web-components/body-CkOBHlJ0.mjs +1 -0
- package/dist/web-components/canvas-CWf_Fag8.mjs +1 -0
- package/dist/web-components/choice-key-BUNebLKe.mjs +1 -0
- package/dist/web-components/{cloverEngine-B4LinbSt.mjs → cloverEngine-6djEHNCD.mjs} +2 -2
- package/dist/web-components/content-state-reader-Ahh6artg.mjs +1 -0
- package/dist/web-components/{controls-Dj2BybWb.mjs → controls-BJrZVQkS.mjs} +1 -1
- package/dist/web-components/custom-elements.json +109 -13
- package/dist/web-components/dates-DR3gfcON.mjs +1 -0
- package/dist/web-components/downloads-CqVWo-yn.mjs +1 -0
- package/dist/web-components/{engine-BSt8LTso.mjs → engine-B-sscpLa.mjs} +1 -1
- package/dist/web-components/{engines-CC0OEsVE.mjs → engines-DfCHjbt3.mjs} +1 -1
- package/dist/web-components/es-BYfHUZ7P.mjs +1 -0
- package/dist/web-components/fetchManifest-BIzne1Pj.mjs +1 -0
- package/dist/web-components/fi-B5y2qr8T.mjs +1 -0
- package/dist/web-components/fr-ChezCx6V.mjs +1 -0
- package/dist/web-components/fromManifest-gg5Wx14y.mjs +1 -0
- package/dist/web-components/glyphs-JYl2STEr.mjs +1 -0
- package/dist/web-components/hooks-x7rO95CS.mjs +1 -0
- package/dist/web-components/image-layers-BjbeyHBS.mjs +1 -0
- package/dist/web-components/{imageService-dsdmcegU.mjs → imageService-0eTvQ-3h.mjs} +1 -1
- package/dist/web-components/index-BZ7b9k0N.mjs +1 -0
- package/dist/web-components/index.d.mts +95 -10
- package/dist/web-components/index.mjs +1 -1
- package/dist/web-components/items-CnAIl9fS.mjs +1 -0
- package/dist/web-components/items-F6hJgdAS.mjs +1 -0
- package/dist/web-components/label-CI88KH2_.mjs +1 -0
- package/dist/web-components/layout-De1MOSYe.mjs +1 -0
- package/dist/web-components/link-GEdiEwlR.mjs +1 -0
- package/dist/web-components/logo-Ckwj7FlP.mjs +1 -0
- package/dist/web-components/models-59cEeiAA.mjs +1 -0
- package/dist/web-components/nb-8J22f9Td.mjs +1 -0
- package/dist/web-components/nn-Dv1EvzI1.mjs +1 -0
- package/dist/web-components/no-8J22f9Td.mjs +1 -0
- package/dist/web-components/{nodes-B7JRwBgl.mjs → nodes-CTw9OqlA.mjs} +1 -1
- package/dist/web-components/{overlayImage-0OgQl1TL.mjs → overlayImage-BMt4UTlR.mjs} +1 -1
- package/dist/web-components/{panel-CjXfre-g.mjs → panel-C17Rl9Ya.mjs} +1 -1
- package/dist/web-components/part-CXts97_M.mjs +1 -0
- package/dist/web-components/playerSurface-HYwEwPK6.mjs +1 -0
- package/dist/web-components/presentation-2-C-U79S_T.mjs +1 -0
- package/dist/web-components/{provider-C1wKfdjb.mjs → provider-BpxorEiq.mjs} +1 -1
- package/dist/web-components/pt-DWYQkATt.mjs +1 -0
- package/dist/web-components/range-regions-BGQy4E9U.mjs +1 -0
- package/dist/web-components/read-more-BDM_6CVc.mjs +1 -0
- package/dist/web-components/readingLanguages-fs_HqvqQ.mjs +1 -0
- package/dist/web-components/rendererSurface-C0aKlE0v.mjs +22 -0
- package/dist/web-components/{renderers-BMSWEFUR.mjs → renderers-CiB74bQh.mjs} +1 -1
- package/dist/web-components/{resource-DLHocQ1C.mjs → resource-CRbpf9pX.mjs} +1 -1
- package/dist/web-components/sanitize-qIOeyIww.mjs +3 -0
- package/dist/web-components/save-file-CCuZEuQr.mjs +1 -0
- package/dist/web-components/search-CkM0O0Z1.mjs +1 -0
- package/dist/web-components/sequence-C28xoNmD.mjs +1 -0
- package/dist/web-components/shared-MTsMddHx.mjs +1 -0
- package/dist/web-components/{show-link-CyzYE1eS.mjs → show-link-BXm7SNIC.mjs} +1 -1
- package/dist/web-components/{sizedImage-uv_NlE0l.mjs → sizedImage-k4Q-eyOB.mjs} +1 -1
- package/dist/web-components/{split-CYuMjp89.mjs → split-Hp6z-v4h.mjs} +1 -1
- package/dist/web-components/{status-Ms5L0ghK.mjs → status-BmtuKfAG.mjs} +1 -1
- package/dist/web-components/styles-CZV1nbBQ.mjs +1 -0
- package/dist/web-components/three.mjs +1 -1
- package/dist/web-components/thumbnail-Dp7a8oom.mjs +1 -0
- package/dist/web-components/{tip-dWhupWSr.mjs → tip-C-oovDZK.mjs} +1 -1
- package/dist/web-components/{toggle-BQTjR1I3.mjs → toggle-C7ODWDEZ.mjs} +1 -1
- package/dist/web-components/upgrade-eNW0DPXq.mjs +1 -0
- package/dist/web-components/upgrader-BlbMUEH6.mjs +1 -0
- package/dist/web-components/useContainerName-CrOmY-km.mjs +1 -0
- package/dist/web-components/useNearViewport-BqXi9Gn4.mjs +1 -0
- package/dist/web-components/{useScrollTrack-WbG28FPD.mjs → useScrollTrack-CEsOU2yT.mjs} +1 -1
- package/dist/web-components/viewer/AnnotationItems-CyhVcRFc.mjs +1 -0
- package/dist/web-components/viewer/AnnotationMenu-DPOSehBo.mjs +1 -0
- package/dist/web-components/viewer/AnnotationState-Bjztkobn.mjs +1 -0
- package/dist/web-components/viewer/Annotations-Dh_8Tzi0.mjs +2 -0
- package/dist/web-components/viewer/Annotations-wwuOCxzI.mjs +1 -0
- package/dist/web-components/viewer/{Canvas2DBackend-CAmzJD5P.mjs → Canvas2DBackend-BTK6ZJh0.mjs} +1 -1
- package/dist/web-components/viewer/CaptionDetails-BwCTovy_.mjs +1 -0
- package/dist/web-components/viewer/ChoiceMenu-DQ1x572Y.mjs +1 -0
- package/dist/web-components/viewer/Collection-DSBxCmXw.mjs +1 -0
- package/dist/web-components/viewer/Connected-CL3N8F2J.mjs +1 -0
- package/dist/web-components/viewer/Connected-DTk1jlyI.mjs +1 -0
- package/dist/web-components/viewer/Contents-DrXckx7d.mjs +1 -0
- package/dist/web-components/viewer/ControlMenu-Bp91s-g_.mjs +1 -0
- package/dist/web-components/viewer/CountMenu-4u6U6yqb.mjs +1 -0
- package/dist/web-components/viewer/Cue-C-aF8peC.mjs +1 -0
- package/dist/web-components/viewer/Document-BN1rICu3.mjs +1 -0
- package/dist/web-components/viewer/DocumentPanel-CEesxdeY.mjs +1 -0
- package/dist/web-components/viewer/{DomLayers-DRdQSEtN.mjs → DomLayers-CGkDtemL.mjs} +1 -1
- package/dist/web-components/viewer/Download-CawEl9MN.mjs +1 -0
- package/dist/web-components/viewer/EntryBodies-nYHMwSSM.mjs +1 -0
- package/dist/web-components/viewer/EntryThumbnail-DrO_0SzR.mjs +1 -0
- package/dist/web-components/viewer/FieldPill-DFXGWrvB.mjs +1 -0
- package/dist/web-components/viewer/FrameAnimation-CZfzpxaD.mjs +1 -0
- package/dist/web-components/viewer/Gallery-MWHtvjti.mjs +1 -0
- package/dist/web-components/viewer/HideToggle-DP5kHzWM.mjs +1 -0
- package/dist/web-components/viewer/LanguageChoice-C50T7dPI.mjs +1 -0
- package/dist/web-components/viewer/{LightboxBody-CXMc1xOH.mjs → LightboxBody-C2T7IC29.mjs} +1 -1
- package/dist/web-components/viewer/ListEnd-BDuOx__m.mjs +1 -0
- package/dist/web-components/viewer/MapView-BN9wXQKV.mjs +3 -0
- package/dist/web-components/viewer/MediaBody-CEyswliX.mjs +1 -0
- package/dist/web-components/viewer/MediaBody-Dw3DWDjc.mjs +1 -0
- package/dist/web-components/viewer/NavDate-C2-wwLuB.mjs +1 -0
- package/dist/web-components/viewer/{Navigator-CKwDgG2x.mjs → Navigator-C3jghOd3.mjs} +1 -1
- package/dist/web-components/viewer/PagerLayout-Cg2NpqoD.mjs +1 -0
- package/dist/web-components/viewer/PartOfManifest-D22yMgCf.mjs +1 -0
- package/dist/web-components/viewer/PlaceBox-Dckw4Sfk.mjs +1 -0
- package/dist/web-components/viewer/Placeholder-NYVWYg5Q.mjs +1 -0
- package/dist/web-components/viewer/Search-DC259m4f.mjs +1 -0
- package/dist/web-components/viewer/StandaloneItems-E4kpMne9.mjs +1 -0
- package/dist/web-components/viewer/Steps-Bw32X5xO.mjs +1 -0
- package/dist/web-components/viewer/TargetItems-DLhUH1Gq.mjs +1 -0
- package/dist/web-components/viewer/Transcript-D_VGJQxn.mjs +1 -0
- package/dist/web-components/viewer/annotation-collection-DZHa18ir.mjs +1 -0
- package/dist/web-components/viewer/annotation-name-BaNdW2Xk.mjs +1 -0
- package/dist/web-components/viewer/annotations-content-CbA3eOIC.mjs +1 -0
- package/dist/web-components/viewer/{cloverEngine-CynoKdta.mjs → cloverEngine-C04bCSFR.mjs} +2 -2
- package/dist/web-components/viewer/content-state-reader-C7UBMOq3.mjs +1 -0
- package/dist/web-components/viewer/fetchManifest-C2Yxg3x9.mjs +1 -0
- package/dist/web-components/viewer/{host-DlCltI_c.mjs → host-CZeyjCKR.mjs} +1 -1
- package/dist/web-components/viewer/image-layers-B09fporZ.mjs +1 -0
- package/dist/web-components/viewer/index.mjs +1 -1
- package/dist/web-components/viewer/link-DssZ0Z2N.mjs +1 -0
- package/dist/web-components/viewer/overlayImage-BR3eJCKq.mjs +1 -0
- package/dist/web-components/viewer/range-regions-By6L5JOK.mjs +1 -0
- package/dist/web-components/viewer/{renderers-C_wdmw9v.mjs → renderers-DLoqv3QO.mjs} +1 -1
- package/dist/web-components/viewer/save-file-CJT5p5Hg.mjs +1 -0
- package/dist/web-components/viewer/{search-BHLyNxZ6.mjs → search-PhOwMKHi.mjs} +1 -1
- package/dist/web-components/viewer/styles-NZLnZPAC.mjs +1 -0
- package/dist/web-components/viewer/viewer-D30YHqyF.mjs +29 -0
- package/dist/web-components/viewer/{vtt-XiS_-5Ao.mjs → vtt-1Pk7Dhsj.mjs} +1 -1
- package/dist/web-components/viewer-CH7re5OO.mjs +1 -0
- package/dist/web-components/{vtt-DYAOuQoK.mjs → vtt-CacHieeN.mjs} +1 -1
- package/package.json +8 -4
- package/dist/i18n/reader.mjs +0 -13
- package/dist/web-components/About-DbrFSVBm.mjs +0 -1
- package/dist/web-components/AnnotationMenu-EBjIQpQl.mjs +0 -1
- package/dist/web-components/AnnotationState-DQTaO6Gz.mjs +0 -1
- package/dist/web-components/Annotations-Cb9U7HJ_.mjs +0 -2
- package/dist/web-components/Annotations-Dl0SgHBS.mjs +0 -1
- package/dist/web-components/Body-DxSz3iST.mjs +0 -1
- package/dist/web-components/BodyAlert-C8EOXz24.mjs +0 -1
- package/dist/web-components/Button-uWgfvqsL.mjs +0 -1
- package/dist/web-components/CanvasView-BI3YzNdK.mjs +0 -1
- package/dist/web-components/CaptionDetails-B80ZhZ7v.mjs +0 -1
- package/dist/web-components/ChoiceMenu-DCp7-co7.mjs +0 -1
- package/dist/web-components/Collection-B1Le2_TU.mjs +0 -1
- package/dist/web-components/CollectionSelect-BL_jQog-.mjs +0 -1
- package/dist/web-components/Connected-BxqaRL9o.mjs +0 -1
- package/dist/web-components/Connected-DCBI-j9H.mjs +0 -1
- package/dist/web-components/Connected-DkhfVWxd.mjs +0 -1
- package/dist/web-components/Contents-zYEGHLfe.mjs +0 -1
- package/dist/web-components/ControlMenu-CAHiLAtl.mjs +0 -1
- package/dist/web-components/Cue-BT2V9VAq.mjs +0 -1
- package/dist/web-components/Document-BdCjGnJN.mjs +0 -1
- package/dist/web-components/DocumentPanel-X_Rta0Wu.mjs +0 -1
- package/dist/web-components/Download-DqU-goFi.mjs +0 -1
- package/dist/web-components/EntryBodies-DXAQH0vR.mjs +0 -1
- package/dist/web-components/ErrorBoundary-chQaO-Up.mjs +0 -1
- package/dist/web-components/FieldPill-CyEssPVm.mjs +0 -1
- package/dist/web-components/FrameAnimation-Bb0pOoRl.mjs +0 -1
- package/dist/web-components/Gallery-BXU3TcT3.mjs +0 -1
- package/dist/web-components/HideToggle-BwMrOBMu.mjs +0 -1
- package/dist/web-components/Items-DRj1UEpC.mjs +0 -1
- package/dist/web-components/Label-D6aVJB9s.mjs +0 -1
- package/dist/web-components/LightboxBody-BzXQGMDn.mjs +0 -1
- package/dist/web-components/LoadedCanvas-DOjtxLSe.mjs +0 -1
- package/dist/web-components/LoadedMap-DouDS2lO.mjs +0 -1
- package/dist/web-components/MapView-CD5zkTs8.mjs +0 -1
- package/dist/web-components/Markup-C1hMA8wk.mjs +0 -2
- package/dist/web-components/MediaBody-B_Gii4we.mjs +0 -1
- package/dist/web-components/MediaBody-BfrKIPte.mjs +0 -1
- package/dist/web-components/Pager-Di_2hHM3.mjs +0 -1
- package/dist/web-components/Panel-DbsC8A9V.mjs +0 -1
- package/dist/web-components/PartOfManifest-7eOwURrF.mjs +0 -1
- package/dist/web-components/Primitives-XQO3m1wG.mjs +0 -1
- package/dist/web-components/Provider-B61118lU.mjs +0 -1
- package/dist/web-components/ReadMore-BJH-qqte.mjs +0 -1
- package/dist/web-components/Root-Dj277K6p.mjs +0 -1
- package/dist/web-components/Scene-BTWpLeec.mjs +0 -1
- package/dist/web-components/SceneView-BYo7WmPt.mjs +0 -1
- package/dist/web-components/Search-ZV8FFN4p.mjs +0 -1
- package/dist/web-components/Sections-ejwu1_Sm.mjs +0 -2
- package/dist/web-components/StandaloneItems-BYaiyCca.mjs +0 -1
- package/dist/web-components/Status-YbQK2KzY.mjs +0 -1
- package/dist/web-components/Timeline-ByyVSd7B.mjs +0 -1
- package/dist/web-components/Tip-IO11xX4x.mjs +0 -1
- package/dist/web-components/Transcript-D0gUxUoA.mjs +0 -1
- package/dist/web-components/annotation-collection-Csv7WIlm.mjs +0 -1
- package/dist/web-components/annotations-content-BS_OFz5Z.mjs +0 -1
- package/dist/web-components/body-CKjwwFep.mjs +0 -1
- package/dist/web-components/canvas-CIzpp-Uz.mjs +0 -1
- package/dist/web-components/content-state-reader-D1BkpICh.mjs +0 -1
- package/dist/web-components/es-BwMkoRod.mjs +0 -1
- package/dist/web-components/fi-gPFOn9RK.mjs +0 -1
- package/dist/web-components/fr-DUHmgdJo.mjs +0 -1
- package/dist/web-components/fromManifest-BhemHaoA.mjs +0 -1
- package/dist/web-components/glyphs-drROkef9.mjs +0 -1
- package/dist/web-components/hooks-BXzQSllm.mjs +0 -1
- package/dist/web-components/index-B7nZdqLg.mjs +0 -1
- package/dist/web-components/items-CB2Uk7ts.mjs +0 -1
- package/dist/web-components/items-jfQ5XzEj.mjs +0 -1
- package/dist/web-components/keep-fragments-B5nlv2ck.mjs +0 -1
- package/dist/web-components/label-Vbg_cMOJ.mjs +0 -1
- package/dist/web-components/layout-mMHI0lsj.mjs +0 -1
- package/dist/web-components/link-ZRnv5NFR.mjs +0 -1
- package/dist/web-components/logo-Boy6u4m2.mjs +0 -1
- package/dist/web-components/models-D1EE_CmH.mjs +0 -1
- package/dist/web-components/nb-BSvnQ6jd.mjs +0 -1
- package/dist/web-components/nn-Dg2_HdZu.mjs +0 -1
- package/dist/web-components/no-BSvnQ6jd.mjs +0 -1
- package/dist/web-components/part-cUiPs2-y.mjs +0 -1
- package/dist/web-components/playerSurface-CU5XxI1j.mjs +0 -1
- package/dist/web-components/pt-B3J80JgO.mjs +0 -1
- package/dist/web-components/read-more-DNHNtG-a.mjs +0 -1
- package/dist/web-components/rendererSurface-DhIlOjGT.mjs +0 -22
- package/dist/web-components/sanitize-Dc7nOsgO.mjs +0 -3
- package/dist/web-components/search-CLy2Wj01.mjs +0 -1
- package/dist/web-components/shared-YUjOSBKO.mjs +0 -1
- package/dist/web-components/styles-CyuM_fB1.mjs +0 -1
- package/dist/web-components/thumbnail-c2K_iQsD.mjs +0 -1
- package/dist/web-components/time-B9GZoYcm.mjs +0 -1
- package/dist/web-components/upgrader-XNxI-5jo.mjs +0 -1
- package/dist/web-components/useContainerName-BpJ3IWY0.mjs +0 -1
- package/dist/web-components/useNearViewport-CtLyYg9n.mjs +0 -1
- package/dist/web-components/viewer/AnnotationMenu-ZKyBeyUU.mjs +0 -1
- package/dist/web-components/viewer/AnnotationState-DO33zokc.mjs +0 -1
- package/dist/web-components/viewer/Annotations-BOjhr5ks.mjs +0 -1
- package/dist/web-components/viewer/Annotations-DkLueFLK.mjs +0 -2
- package/dist/web-components/viewer/CaptionDetails-DOJlUtOn.mjs +0 -1
- package/dist/web-components/viewer/ChoiceMenu-BDq6H34G.mjs +0 -1
- package/dist/web-components/viewer/Collection-By3puO0V.mjs +0 -1
- package/dist/web-components/viewer/Connected-DZNO2CPf.mjs +0 -1
- package/dist/web-components/viewer/Connected-ESg5y49m.mjs +0 -1
- package/dist/web-components/viewer/Contents-B_FqDwTW.mjs +0 -1
- package/dist/web-components/viewer/ControlMenu-DdQl-dTf.mjs +0 -1
- package/dist/web-components/viewer/Cue-BTRHfiWQ.mjs +0 -1
- package/dist/web-components/viewer/Document-B9_PyD2w.mjs +0 -1
- package/dist/web-components/viewer/DocumentPanel-CtEJVPoE.mjs +0 -1
- package/dist/web-components/viewer/EntryBodies-CJuTRcTq.mjs +0 -1
- package/dist/web-components/viewer/FieldPill-06uwrNwE.mjs +0 -1
- package/dist/web-components/viewer/FrameAnimation-3dcDHf5q.mjs +0 -1
- package/dist/web-components/viewer/Gallery-BYasTqZc.mjs +0 -1
- package/dist/web-components/viewer/HideToggle-BxkNMX-T.mjs +0 -1
- package/dist/web-components/viewer/MapView-DCerrRRV.mjs +0 -1
- package/dist/web-components/viewer/MediaBody-BdkJcyGy.mjs +0 -1
- package/dist/web-components/viewer/MediaBody-waF4KvHp.mjs +0 -1
- package/dist/web-components/viewer/PartOfManifest-DalHJFwC.mjs +0 -1
- package/dist/web-components/viewer/Search-Di_QQfDb.mjs +0 -1
- package/dist/web-components/viewer/StandaloneItems-B9J6nnWn.mjs +0 -1
- package/dist/web-components/viewer/Transcript-aHOixfna.mjs +0 -1
- package/dist/web-components/viewer/annotation-collection-I2UkdobR.mjs +0 -1
- package/dist/web-components/viewer/annotations-content-D-i4j9pD.mjs +0 -1
- package/dist/web-components/viewer/content-state-reader-D7GIMcKK.mjs +0 -1
- package/dist/web-components/viewer/link-BX-wzj1u.mjs +0 -1
- package/dist/web-components/viewer/overlayImage-CHqn1fG8.mjs +0 -1
- package/dist/web-components/viewer/styles-BRCkEU3w.mjs +0 -1
- package/dist/web-components/viewer/viewer-ipqAA-xQ.mjs +0 -28
- package/dist/web-components/viewer-DEHIsIHd.mjs +0 -1
- /package/dist/{ui → i18n}/languageCode.mjs +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { readPage } from "./annotation-sets.mjs";
|
|
3
|
+
import { parseAnnotationTarget } from "./annotations.mjs";
|
|
4
|
+
import { choiceKey } from "./choice-key.mjs";
|
|
5
|
+
import { isPainting } from "./painting.mjs";
|
|
6
|
+
import { selectSequence } from "./selectors.mjs";
|
|
7
|
+
import { asArray } from "../lib/asArray.mjs";
|
|
8
|
+
function imageLayers(manifest) {
|
|
9
|
+
const byId = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const canvas of selectSequence(manifest).canvases)
|
|
11
|
+
readLayers(canvas, byId);
|
|
12
|
+
return [...byId.values()];
|
|
13
|
+
}
|
|
14
|
+
function readLayers(canvas, byId) {
|
|
15
|
+
asArray(canvas.items).forEach(
|
|
16
|
+
(page, p) => asArray(page == null ? void 0 : page.items).forEach((painting, a) => {
|
|
17
|
+
if (!isPainting(painting)) return;
|
|
18
|
+
const at = parseAnnotationTarget(asArray(painting.target)[0]).rect ?? {
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
w: Number(canvas.width) || 0,
|
|
22
|
+
h: Number(canvas.height) || 0
|
|
23
|
+
};
|
|
24
|
+
asArray(painting.body).forEach((body, b) => {
|
|
25
|
+
const choice = (body == null ? void 0 : body.type) === "Choice";
|
|
26
|
+
const items = choice ? asArray(body.items) : [body];
|
|
27
|
+
items.forEach((image, i) => {
|
|
28
|
+
for (const own of asArray(image == null ? void 0 : image.annotations)) {
|
|
29
|
+
if (!Array.isArray(own == null ? void 0 : own.items) || typeof (image == null ? void 0 : image.id) !== "string")
|
|
30
|
+
continue;
|
|
31
|
+
const id = own.id ?? `${image.id}#annotations`;
|
|
32
|
+
const layer = choice ? {
|
|
33
|
+
key: choiceKey(canvas.id, painting.id, p, a, b),
|
|
34
|
+
item: i,
|
|
35
|
+
image: image.id
|
|
36
|
+
} : void 0;
|
|
37
|
+
const entries = readPage(own, id, canvas.id).map((entry) => {
|
|
38
|
+
const region = imageRegion(entry.annotation, image);
|
|
39
|
+
const x = Math.round(at.x + region.x * (at.w / region.width));
|
|
40
|
+
const y = Math.round(at.y + region.y * (at.h / region.height));
|
|
41
|
+
const w = Math.round(region.w * (at.w / region.width));
|
|
42
|
+
const h = Math.round(region.h * (at.h / region.height));
|
|
43
|
+
const target = `${canvas.id}#xywh=${x},${y},${w},${h}`;
|
|
44
|
+
return {
|
|
45
|
+
...entry,
|
|
46
|
+
canvasId: canvas.id,
|
|
47
|
+
target: parseAnnotationTarget(target),
|
|
48
|
+
annotation: { ...entry.annotation, target },
|
|
49
|
+
...layer ? { layer } : {}
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
if (!entries.length) continue;
|
|
53
|
+
let set = byId.get(id);
|
|
54
|
+
if (!set) {
|
|
55
|
+
set = {
|
|
56
|
+
id,
|
|
57
|
+
label: own.label ?? image.label,
|
|
58
|
+
source: "manifest",
|
|
59
|
+
entries: []
|
|
60
|
+
};
|
|
61
|
+
byId.set(id, set);
|
|
62
|
+
}
|
|
63
|
+
set.entries.push(...entries);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function imageRegion(annotation, image) {
|
|
71
|
+
const width = Number(image.width) || 1;
|
|
72
|
+
const height = Number(image.height) || 1;
|
|
73
|
+
const all = { x: 0, y: 0, w: width, h: height, width, height };
|
|
74
|
+
const target = asArray(annotation == null ? void 0 : annotation.target)[0];
|
|
75
|
+
const selectors = typeof target === "object" ? asArray(target == null ? void 0 : target.selector) : [];
|
|
76
|
+
const api = selectors.find((each) => (each == null ? void 0 : each.type) === "ImageApiSelector");
|
|
77
|
+
const value = typeof (api == null ? void 0 : api.region) === "string" ? api.region : void 0;
|
|
78
|
+
if (value) {
|
|
79
|
+
const match = /^(pct:)?([\d.]+),([\d.]+),([\d.]+),([\d.]+)$/.exec(value);
|
|
80
|
+
if (!match) return all;
|
|
81
|
+
const [x, y, w, h] = match.slice(2).map(Number);
|
|
82
|
+
return match[1] ? {
|
|
83
|
+
x: x / 100 * width,
|
|
84
|
+
y: y / 100 * height,
|
|
85
|
+
w: w / 100 * width,
|
|
86
|
+
h: h / 100 * height,
|
|
87
|
+
width,
|
|
88
|
+
height
|
|
89
|
+
} : { x, y, w, h, width, height };
|
|
90
|
+
}
|
|
91
|
+
const rect = parseAnnotationTarget(target).rect;
|
|
92
|
+
return rect ? { ...rect, width, height } : all;
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
imageLayers
|
|
96
|
+
};
|
package/dist/core/items.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { selectSequence } from "./selectors.mjs";
|
|
3
|
-
import { localize } from "./value.mjs";
|
|
3
|
+
import { hrefLangOf, localize } from "./value.mjs";
|
|
4
4
|
import { paintedBodies } from "./painted-bodies.mjs";
|
|
5
5
|
import { asArray } from "../lib/asArray.mjs";
|
|
6
6
|
function paintedType(container) {
|
|
@@ -53,7 +53,9 @@ function itemsOfCollection(collection) {
|
|
|
53
53
|
parts: [part(member)],
|
|
54
54
|
label: member.label,
|
|
55
55
|
summary: member.summary,
|
|
56
|
-
|
|
56
|
+
...typeof member.navDate === "string" ? { navDate: member.navDate } : {},
|
|
57
|
+
href: ((_a = asArray(member.homepage)[0]) == null ? void 0 : _a.id) ?? member.id,
|
|
58
|
+
...hrefLangOf(asArray(member.homepage)[0]) ? { hrefLang: hrefLangOf(asArray(member.homepage)[0]) } : {}
|
|
57
59
|
};
|
|
58
60
|
});
|
|
59
61
|
memberItems.set(collection, items);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { languageToRead } from "../i18n/languages.mjs";
|
|
3
|
+
import { localize } from "./value.mjs";
|
|
4
|
+
function startingLanguage(languages, language, picked) {
|
|
5
|
+
if (picked && languages.includes(picked)) return picked;
|
|
6
|
+
if (!languages.length) return void 0;
|
|
7
|
+
const tag = languageToRead(languages, language);
|
|
8
|
+
return tag === "none" ? languages[0] : tag;
|
|
9
|
+
}
|
|
10
|
+
const keysOf = (value) => value && typeof value === "object" && !Array.isArray(value) ? Object.keys(value).filter(
|
|
11
|
+
(tag) => tag !== "none" && tag !== "@none" && localize({ [tag]: value[tag] }).text
|
|
12
|
+
) : [];
|
|
13
|
+
function descriptionLanguages(manifest) {
|
|
14
|
+
if (!manifest) return [];
|
|
15
|
+
const pairs = [
|
|
16
|
+
...Array.isArray(manifest.metadata) ? manifest.metadata : [],
|
|
17
|
+
manifest.requiredStatement
|
|
18
|
+
].filter(Boolean);
|
|
19
|
+
const maps = [
|
|
20
|
+
manifest.label,
|
|
21
|
+
manifest.summary,
|
|
22
|
+
...pairs.flatMap((pair) => [pair == null ? void 0 : pair.label, pair == null ? void 0 : pair.value])
|
|
23
|
+
];
|
|
24
|
+
const tags = maps.map(keysOf).filter((each) => each.length > 1);
|
|
25
|
+
return [...new Set(tags.flat())];
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
descriptionLanguages,
|
|
29
|
+
startingLanguage
|
|
30
|
+
};
|
package/dist/core/link.mjs
CHANGED
|
@@ -23,6 +23,20 @@ function readLink(annotation) {
|
|
|
23
23
|
}
|
|
24
24
|
return void 0;
|
|
25
25
|
}
|
|
26
|
+
function readTagSource(annotation) {
|
|
27
|
+
const motivation = asArray(annotation == null ? void 0 : annotation.motivation);
|
|
28
|
+
if (!motivation.includes("tagging") && !motivation.includes("identifying"))
|
|
29
|
+
return void 0;
|
|
30
|
+
for (const body of bodiesOf(annotation)) {
|
|
31
|
+
if ((body == null ? void 0 : body.type) === "TextualBody" || typeof (body == null ? void 0 : body.value) === "string")
|
|
32
|
+
continue;
|
|
33
|
+
const source = (body == null ? void 0 : body.type) === "SpecificResource" ? body.source : body;
|
|
34
|
+
const id = typeof source === "string" ? source : source == null ? void 0 : source.id;
|
|
35
|
+
if (typeof id === "string" && /^https?:\/\//i.test(id)) return { id };
|
|
36
|
+
}
|
|
37
|
+
return void 0;
|
|
38
|
+
}
|
|
26
39
|
export {
|
|
27
|
-
readLink
|
|
40
|
+
readLink,
|
|
41
|
+
readTagSource
|
|
28
42
|
};
|
package/dist/core/load.mjs
CHANGED
|
@@ -110,6 +110,7 @@ async function loadContent(input, options = {}) {
|
|
|
110
110
|
let target;
|
|
111
111
|
let member;
|
|
112
112
|
let annotation;
|
|
113
|
+
let targets;
|
|
113
114
|
let json;
|
|
114
115
|
const followContentState = async (state) => {
|
|
115
116
|
const { resolveContentState } = await readContentState();
|
|
@@ -118,6 +119,7 @@ async function loadContent(input, options = {}) {
|
|
|
118
119
|
target = resolved.target ?? target;
|
|
119
120
|
member = resolved.manifestId ?? member;
|
|
120
121
|
annotation = resolved.annotation ?? annotation;
|
|
122
|
+
targets = resolved.targets ?? targets;
|
|
121
123
|
return fetchJson(request, resolved.id, signal);
|
|
122
124
|
};
|
|
123
125
|
if (typeof input === "string") {
|
|
@@ -143,7 +145,7 @@ async function loadContent(input, options = {}) {
|
|
|
143
145
|
(_a = signal == null ? void 0 : signal.throwIfAborted) == null ? void 0 : _a.call(signal);
|
|
144
146
|
switch (resource.type) {
|
|
145
147
|
case "Manifest":
|
|
146
|
-
return { manifest: resource, target, annotation };
|
|
148
|
+
return { manifest: resource, target, annotation, targets };
|
|
147
149
|
case "Collection": {
|
|
148
150
|
const collection = await withMembers(
|
|
149
151
|
resource,
|
|
@@ -157,7 +159,7 @@ async function loadContent(input, options = {}) {
|
|
|
157
159
|
if (!manifest) {
|
|
158
160
|
throw new CloverContentError("The Collection holds no Manifest");
|
|
159
161
|
}
|
|
160
|
-
return { manifest, collection, target, annotation };
|
|
162
|
+
return { manifest, collection, target, annotation, targets };
|
|
161
163
|
}
|
|
162
164
|
case "Canvas":
|
|
163
165
|
case "Timeline":
|
package/dist/core/pages.mjs
CHANGED
|
@@ -28,6 +28,25 @@ async function upgradePage(json, canvasId = "urn:clover:annotation-page") {
|
|
|
28
28
|
});
|
|
29
29
|
return ((_a = canvas.items) == null ? void 0 : _a[0]) ?? page;
|
|
30
30
|
}
|
|
31
|
+
function withReference(page, reference) {
|
|
32
|
+
const own = page;
|
|
33
|
+
const given = reference;
|
|
34
|
+
const listed = (value) => Array.isArray(value) ? value : value ? [value] : [];
|
|
35
|
+
const parts = listed(own.partOf);
|
|
36
|
+
const told = listed(given.partOf);
|
|
37
|
+
const partOf = [
|
|
38
|
+
...parts.map((part) => ({
|
|
39
|
+
...told.find((each) => each.id && each.id === part.id),
|
|
40
|
+
...part
|
|
41
|
+
})),
|
|
42
|
+
...told.filter((each) => !parts.some((part) => part.id === each.id))
|
|
43
|
+
];
|
|
44
|
+
return {
|
|
45
|
+
...page,
|
|
46
|
+
...own.label === void 0 && given.label !== void 0 && { label: given.label },
|
|
47
|
+
...partOf.length && { partOf }
|
|
48
|
+
};
|
|
49
|
+
}
|
|
31
50
|
function embedPage(manifest, canvasId, list, page) {
|
|
32
51
|
let changed = false;
|
|
33
52
|
const items = (manifest.items ?? []).map(
|
|
@@ -36,7 +55,7 @@ function embedPage(manifest, canvasId, list, page) {
|
|
|
36
55
|
const pages = canvas[list].map((existing) => {
|
|
37
56
|
if (existing.id !== page.id || !isReference(existing)) return existing;
|
|
38
57
|
changed = true;
|
|
39
|
-
return page;
|
|
58
|
+
return withReference(page, existing);
|
|
40
59
|
});
|
|
41
60
|
return changed ? { ...canvas, [list]: pages } : canvas;
|
|
42
61
|
}
|
|
@@ -9,16 +9,18 @@ function isPresentation4(resource) {
|
|
|
9
9
|
}
|
|
10
10
|
let upgrader = null;
|
|
11
11
|
function preloadUpgrader() {
|
|
12
|
-
upgrader ?? (upgrader = import("@iiif/parser/presentation-4/upgrader")
|
|
12
|
+
upgrader ?? (upgrader = import("@iiif/parser/presentation-4/upgrader").then(
|
|
13
|
+
({ upgradePresentation3To4 }) => upgradePresentation3To4
|
|
14
|
+
));
|
|
13
15
|
return upgrader;
|
|
14
16
|
}
|
|
15
17
|
async function toPresentation4(resource) {
|
|
16
18
|
if (isPresentation4(resource)) return resource;
|
|
17
|
-
const [
|
|
19
|
+
const [toFour, { upgrade }] = await Promise.all([
|
|
18
20
|
preloadUpgrader(),
|
|
19
|
-
import("./
|
|
21
|
+
import("./upgrade.mjs")
|
|
20
22
|
]);
|
|
21
|
-
return
|
|
23
|
+
return await upgrade(resource, toFour);
|
|
22
24
|
}
|
|
23
25
|
export {
|
|
24
26
|
isPresentation4,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { CONTENTS_SET_ID, regionEntryId } from "./annotation-sets.mjs";
|
|
3
|
+
import { parseAnnotationTarget } from "./annotations.mjs";
|
|
4
|
+
import { rangeItemTarget } from "./ranges.mjs";
|
|
5
|
+
import { asArray } from "../lib/asArray.mjs";
|
|
6
|
+
const bodiesOf = (label) => label && typeof label === "object" ? Object.entries(label).flatMap(
|
|
7
|
+
([language, values]) => asArray(values).filter((value) => typeof value === "string").map((value) => ({
|
|
8
|
+
value,
|
|
9
|
+
...language !== "none" ? { language } : {}
|
|
10
|
+
}))
|
|
11
|
+
) : typeof label === "string" ? [{ value: label }] : [];
|
|
12
|
+
const regionSets = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
function contentsSet(manifest) {
|
|
14
|
+
if (!manifest) return null;
|
|
15
|
+
if (regionSets.has(manifest)) return regionSets.get(manifest);
|
|
16
|
+
const entries = [];
|
|
17
|
+
const visited = /* @__PURE__ */ new Set();
|
|
18
|
+
const walk = (range) => {
|
|
19
|
+
if (!range || visited.has(range.id ?? range)) return;
|
|
20
|
+
visited.add(range.id ?? range);
|
|
21
|
+
const drawn = typeof range.id === "string" && !asArray(range.behavior).includes("no-nav");
|
|
22
|
+
const bodies = bodiesOf(range.label);
|
|
23
|
+
const total = asArray(range.items).filter(
|
|
24
|
+
(item) => (item == null ? void 0 : item.type) !== "Range" && parseAnnotationTarget(rangeItemTarget(item)).id
|
|
25
|
+
).length;
|
|
26
|
+
let index = 0;
|
|
27
|
+
for (const item of asArray(range.items)) {
|
|
28
|
+
if ((item == null ? void 0 : item.type) === "Range") {
|
|
29
|
+
walk(item);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const parsed = parseAnnotationTarget(rangeItemTarget(item));
|
|
33
|
+
if (!parsed.id) continue;
|
|
34
|
+
const at = index++;
|
|
35
|
+
if (!drawn || !parsed.rect) continue;
|
|
36
|
+
const { x, y, w, h } = parsed.rect;
|
|
37
|
+
const id = regionEntryId(range.id, at);
|
|
38
|
+
entries.push({
|
|
39
|
+
id,
|
|
40
|
+
setId: CONTENTS_SET_ID,
|
|
41
|
+
canvasId: parsed.id,
|
|
42
|
+
target: { id: parsed.id, rect: parsed.rect },
|
|
43
|
+
motivation: ["highlighting"],
|
|
44
|
+
bodies,
|
|
45
|
+
...total > 1 ? { place: { index: at + 1, total } } : {},
|
|
46
|
+
annotation: {
|
|
47
|
+
id,
|
|
48
|
+
type: "Annotation",
|
|
49
|
+
motivation: ["highlighting"],
|
|
50
|
+
// Its text in each language its Range names it in, as the hotspot reads one.
|
|
51
|
+
...bodies.length && {
|
|
52
|
+
body: bodies.map(({ value, language }) => ({
|
|
53
|
+
type: "TextualBody",
|
|
54
|
+
value,
|
|
55
|
+
...language ? { language } : {}
|
|
56
|
+
}))
|
|
57
|
+
},
|
|
58
|
+
target: `${parsed.id}#xywh=${x},${y},${w},${h}`
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
asArray(manifest.structures).forEach(walk);
|
|
64
|
+
const set = entries.length ? { id: CONTENTS_SET_ID, source: "contents", entries } : null;
|
|
65
|
+
regionSets.set(manifest, set);
|
|
66
|
+
return set;
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
contentsSet
|
|
70
|
+
};
|
package/dist/core/ranges.mjs
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { parseAnnotationTarget } from "./annotations.mjs";
|
|
3
3
|
import { asArray } from "../lib/asArray.mjs";
|
|
4
|
-
|
|
5
|
-
if (!t) return void 0;
|
|
6
|
-
const [rawStart, rawEnd] = t.split(",");
|
|
7
|
-
const start = Number(rawStart);
|
|
8
|
-
if (rawStart === "" || Number.isNaN(start)) return void 0;
|
|
9
|
-
if (rawEnd === void 0 || rawEnd === "") return { start };
|
|
10
|
-
const end = Number(rawEnd);
|
|
11
|
-
return Number.isNaN(end) ? { start } : { start, end };
|
|
12
|
-
}
|
|
4
|
+
import { parseTime } from "../lib/time.mjs";
|
|
13
5
|
function rangeItemTarget(item) {
|
|
14
6
|
if (typeof item === "string") return restoreFragment(item);
|
|
15
7
|
const json = item;
|
|
@@ -17,6 +9,10 @@ function rangeItemTarget(item) {
|
|
|
17
9
|
return typeof (json == null ? void 0 : json.id) === "string" ? restoreFragment(json.id) : json;
|
|
18
10
|
}
|
|
19
11
|
const restoreFragment = (id) => id.replace(/\/((?:t|xywh)=[^/#]*)$/, "#$1");
|
|
12
|
+
function rangeThumbnail(range) {
|
|
13
|
+
const first = asArray(range.thumbnail)[0];
|
|
14
|
+
return first && typeof first === "object" ? { thumbnail: first } : {};
|
|
15
|
+
}
|
|
20
16
|
const memo = /* @__PURE__ */ new WeakMap();
|
|
21
17
|
const NONE = [];
|
|
22
18
|
function chaptersOf(manifest, canvasId, duration) {
|
|
@@ -31,11 +27,13 @@ function chaptersOf(manifest, canvasId, duration) {
|
|
|
31
27
|
const walk = (range) => {
|
|
32
28
|
if (!range || visited.has(range.id ?? range)) return;
|
|
33
29
|
visited.add(range.id ?? range);
|
|
30
|
+
const listed = !asArray(range.behavior).includes("no-nav");
|
|
34
31
|
for (const item of asArray(range.items)) {
|
|
35
32
|
if ((item == null ? void 0 : item.type) === "Range") {
|
|
36
33
|
walk(item);
|
|
37
34
|
continue;
|
|
38
35
|
}
|
|
36
|
+
if (!listed) continue;
|
|
39
37
|
const parsed = parseAnnotationTarget(rangeItemTarget(item));
|
|
40
38
|
if (parsed.id.split("#")[0] !== canvasId) continue;
|
|
41
39
|
const time = parseTime(parsed.t);
|
|
@@ -43,7 +41,8 @@ function chaptersOf(manifest, canvasId, duration) {
|
|
|
43
41
|
found.push({
|
|
44
42
|
...range.id ? { id: range.id } : {},
|
|
45
43
|
label: range.label,
|
|
46
|
-
...time
|
|
44
|
+
...time,
|
|
45
|
+
...rangeThumbnail(range)
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
};
|
|
@@ -67,6 +66,12 @@ function tableOfContents(manifest) {
|
|
|
67
66
|
if (!manifest) return NO_TOC;
|
|
68
67
|
const cached = tocs.get(manifest);
|
|
69
68
|
if (cached) return cached;
|
|
69
|
+
const order = new Map(
|
|
70
|
+
asArray(manifest.items).map((canvas, index) => [
|
|
71
|
+
canvas == null ? void 0 : canvas.id,
|
|
72
|
+
index
|
|
73
|
+
])
|
|
74
|
+
);
|
|
70
75
|
const visited = /* @__PURE__ */ new Set();
|
|
71
76
|
const build = (range) => {
|
|
72
77
|
var _a, _b;
|
|
@@ -74,6 +79,7 @@ function tableOfContents(manifest) {
|
|
|
74
79
|
visited.add(range.id ?? range);
|
|
75
80
|
const children = [];
|
|
76
81
|
const canvasIds = [];
|
|
82
|
+
const parts = [];
|
|
77
83
|
let first;
|
|
78
84
|
for (const item of asArray(range.items)) {
|
|
79
85
|
if ((item == null ? void 0 : item.type) === "Range") {
|
|
@@ -85,6 +91,7 @@ function tableOfContents(manifest) {
|
|
|
85
91
|
if (!parsed.id) continue;
|
|
86
92
|
first ?? (first = parsed);
|
|
87
93
|
canvasIds.push(parsed.id);
|
|
94
|
+
parts.push(parsed);
|
|
88
95
|
}
|
|
89
96
|
}
|
|
90
97
|
const behavior = asArray(range.behavior);
|
|
@@ -95,12 +102,20 @@ function tableOfContents(manifest) {
|
|
|
95
102
|
label: range.label,
|
|
96
103
|
canvasId: (start == null ? void 0 : start.id) ?? ((_a = children[0]) == null ? void 0 : _a.canvasId),
|
|
97
104
|
canvasIds: [...new Set(canvasIds)],
|
|
105
|
+
...behavior.includes("sequence") ? { sequence: true } : {},
|
|
106
|
+
...rangeThumbnail(range),
|
|
98
107
|
children
|
|
99
108
|
};
|
|
100
109
|
const time = parseTime(start == null ? void 0 : start.t);
|
|
101
110
|
if (time) node.time = time;
|
|
102
111
|
else if (!start && ((_b = children[0]) == null ? void 0 : _b.time)) node.time = children[0].time;
|
|
103
112
|
if (start == null ? void 0 : start.rect) node.region = start.rect;
|
|
113
|
+
const ordered = behavior.includes("sequence") && parts.length > 1 && !parts.some((part) => part.t);
|
|
114
|
+
if (ordered || worthStepping(parts, order))
|
|
115
|
+
node.parts = parts.map((part) => ({
|
|
116
|
+
canvasId: part.id,
|
|
117
|
+
...part.rect ? { region: part.rect } : {}
|
|
118
|
+
}));
|
|
104
119
|
return [node];
|
|
105
120
|
};
|
|
106
121
|
const roots = asArray(manifest.structures).flatMap(
|
|
@@ -111,18 +126,37 @@ function tableOfContents(manifest) {
|
|
|
111
126
|
tocs.set(manifest, result);
|
|
112
127
|
return result;
|
|
113
128
|
}
|
|
114
|
-
function
|
|
129
|
+
function worthStepping(parts, order) {
|
|
130
|
+
if (!parts.length || parts.some((part) => part.t)) return false;
|
|
131
|
+
if (parts.some((part) => part.rect)) return true;
|
|
132
|
+
return parts.some(
|
|
133
|
+
(part, index) => index > 0 && order.get(part.id) !== (order.get(parts[index - 1].id) ?? NaN) + 1
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
function currentContents(nodes, canvasId, time, chosen) {
|
|
115
137
|
let best = null;
|
|
116
|
-
|
|
138
|
+
let inChosen = null;
|
|
139
|
+
const deeper = (than, node, depth) => !than || depth > than.depth || // The later of two alike; of two sequences, the first, the default.
|
|
140
|
+
depth === than.depth && !(than.sequence && node.sequence);
|
|
141
|
+
const walk = (node, depth, within) => {
|
|
142
|
+
const under = within || node.id === chosen;
|
|
117
143
|
if (canvasId && node.canvasIds.includes(canvasId)) {
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
|
|
144
|
+
const covers = !node.time || time !== void 0 && time >= node.time.start && (node.time.end === void 0 || time < node.time.end);
|
|
145
|
+
if (covers) {
|
|
146
|
+
const found = {
|
|
147
|
+
id: node.id,
|
|
148
|
+
depth,
|
|
149
|
+
...node.sequence ? { sequence: true } : {}
|
|
150
|
+
};
|
|
151
|
+
if (deeper(best, node, depth)) best = found;
|
|
152
|
+
if (under && deeper(inChosen, node, depth)) inChosen = found;
|
|
153
|
+
}
|
|
121
154
|
}
|
|
122
|
-
node.children.forEach((child) => walk(child, depth + 1));
|
|
155
|
+
node.children.forEach((child) => walk(child, depth + 1, under));
|
|
123
156
|
};
|
|
124
|
-
nodes.forEach((node) => walk(node, 0));
|
|
125
|
-
|
|
157
|
+
nodes.forEach((node) => walk(node, 0, false));
|
|
158
|
+
const result = inChosen ?? best;
|
|
159
|
+
return result ? result.id : null;
|
|
126
160
|
}
|
|
127
161
|
export {
|
|
128
162
|
chaptersOf,
|
package/dist/core/region.mjs
CHANGED
|
@@ -3,11 +3,16 @@ import { parseAnnotationTarget } from "./annotations.mjs";
|
|
|
3
3
|
import { findImageServiceId } from "../lib/renderer/sources/imageService.mjs";
|
|
4
4
|
import { isPainting } from "./painting.mjs";
|
|
5
5
|
import { asArray } from "../lib/asArray.mjs";
|
|
6
|
-
function regionSource(canvas, rect) {
|
|
6
|
+
function regionSource(canvas, rect, image) {
|
|
7
7
|
for (const page of asArray(canvas == null ? void 0 : canvas.items)) {
|
|
8
8
|
for (const annotation of asArray(page == null ? void 0 : page.items)) {
|
|
9
9
|
if (!isPainting(annotation)) continue;
|
|
10
|
-
|
|
10
|
+
const bodies = asArray(annotation == null ? void 0 : annotation.body).flatMap(
|
|
11
|
+
(body) => (body == null ? void 0 : body.type) === "Choice" ? asArray(body.items).filter(
|
|
12
|
+
(item, index) => image ? (item == null ? void 0 : item.id) === image : index === 0
|
|
13
|
+
) : image && (body == null ? void 0 : body.id) !== image ? [] : [body]
|
|
14
|
+
);
|
|
15
|
+
for (const body of bodies) {
|
|
11
16
|
if ((body == null ? void 0 : body.type) !== "Image" || !body.width || !body.height) continue;
|
|
12
17
|
const service = findImageServiceId(body.service);
|
|
13
18
|
if (!service) continue;
|
package/dist/core/sanitize.mjs
CHANGED
|
@@ -43,12 +43,97 @@ const MARKDOWN_VALUES = {
|
|
|
43
43
|
id: [["P", GROUP_ID]],
|
|
44
44
|
"aria-labelledby": [["DIV", GROUP_ID]]
|
|
45
45
|
};
|
|
46
|
+
const BLOCKS = /* @__PURE__ */ new Set([
|
|
47
|
+
"address",
|
|
48
|
+
"article",
|
|
49
|
+
"aside",
|
|
50
|
+
"blockquote",
|
|
51
|
+
"dd",
|
|
52
|
+
"details",
|
|
53
|
+
"div",
|
|
54
|
+
"dl",
|
|
55
|
+
"dt",
|
|
56
|
+
"fieldset",
|
|
57
|
+
"figcaption",
|
|
58
|
+
"figure",
|
|
59
|
+
"footer",
|
|
60
|
+
"form",
|
|
61
|
+
"h1",
|
|
62
|
+
"h2",
|
|
63
|
+
"h3",
|
|
64
|
+
"h4",
|
|
65
|
+
"h5",
|
|
66
|
+
"h6",
|
|
67
|
+
"header",
|
|
68
|
+
"hr",
|
|
69
|
+
"li",
|
|
70
|
+
"main",
|
|
71
|
+
"nav",
|
|
72
|
+
"ol",
|
|
73
|
+
"p",
|
|
74
|
+
"pre",
|
|
75
|
+
"section",
|
|
76
|
+
"summary",
|
|
77
|
+
"table",
|
|
78
|
+
"tbody",
|
|
79
|
+
"td",
|
|
80
|
+
"tfoot",
|
|
81
|
+
"th",
|
|
82
|
+
"thead",
|
|
83
|
+
"tr",
|
|
84
|
+
"ul"
|
|
85
|
+
]);
|
|
86
|
+
function tidy(html) {
|
|
87
|
+
var _a;
|
|
88
|
+
if (!html) return html;
|
|
89
|
+
const box = document.createElement("template");
|
|
90
|
+
box.innerHTML = html;
|
|
91
|
+
for (const image of box.content.querySelectorAll("img:not([src])"))
|
|
92
|
+
image.remove();
|
|
93
|
+
for (const paragraph of box.content.querySelectorAll("p"))
|
|
94
|
+
if (!((_a = paragraph.textContent) == null ? void 0 : _a.trim()) && !paragraph.querySelector("img, br"))
|
|
95
|
+
paragraph.remove();
|
|
96
|
+
const walker = document.createTreeWalker(box.content, NodeFilter.SHOW_TEXT);
|
|
97
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode())
|
|
98
|
+
node.nodeValue = node.nodeValue.replace(/[ \t\n\r\f]{2,}/g, " ");
|
|
99
|
+
return box.innerHTML.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g, "");
|
|
100
|
+
}
|
|
46
101
|
let purify = null;
|
|
102
|
+
const titles = /* @__PURE__ */ new WeakMap();
|
|
103
|
+
function nameOfLink(image) {
|
|
104
|
+
var _a;
|
|
105
|
+
const link = image.closest("a");
|
|
106
|
+
if (!(link == null ? void 0 : link.getAttribute("href"))) return void 0;
|
|
107
|
+
const named = ((_a = link.textContent) == null ? void 0 : _a.trim()) || [...link.querySelectorAll("img")].some(
|
|
108
|
+
(other) => other.getAttribute("alt")
|
|
109
|
+
);
|
|
110
|
+
if (named) return void 0;
|
|
111
|
+
const title = titles.get(link);
|
|
112
|
+
if (title) return title;
|
|
113
|
+
try {
|
|
114
|
+
const url = new URL(link.getAttribute("href"));
|
|
115
|
+
return (url.protocol === "mailto:" ? url.pathname : url.host) || void 0;
|
|
116
|
+
} catch {
|
|
117
|
+
return void 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
47
120
|
function purifier() {
|
|
48
121
|
if (purify) return purify;
|
|
49
122
|
purify = DOMPurify(window);
|
|
123
|
+
purify.addHook("uponSanitizeAttribute", (node, data) => {
|
|
124
|
+
if (node.nodeName === "A" && data.attrName === "title" && data.attrValue.trim())
|
|
125
|
+
titles.set(node, data.attrValue.trim());
|
|
126
|
+
});
|
|
127
|
+
purify.addHook("uponSanitizeElement", (node, data) => {
|
|
128
|
+
if (data.allowedTags[data.tagName] || !BLOCKS.has(data.tagName)) return;
|
|
129
|
+
if (node.nodeType !== 1) return;
|
|
130
|
+
node.prepend(" ");
|
|
131
|
+
node.append(" ");
|
|
132
|
+
});
|
|
50
133
|
purify.addHook("afterSanitizeAttributes", (node) => {
|
|
51
134
|
var _a, _b;
|
|
135
|
+
if (node.nodeName === "IMG" && !node.hasAttribute("alt"))
|
|
136
|
+
node.setAttribute("alt", nameOfLink(node) ?? "");
|
|
52
137
|
for (const name of ["src", "href"]) {
|
|
53
138
|
const value = (_a = node.getAttribute) == null ? void 0 : _a.call(node, name);
|
|
54
139
|
if (value && !URI.test(value.trim())) node.removeAttribute(name);
|
|
@@ -65,7 +150,7 @@ function purifier() {
|
|
|
65
150
|
}
|
|
66
151
|
function sanitizeHTML(html, { markdown = false } = {}) {
|
|
67
152
|
if (typeof window === "undefined") return html;
|
|
68
|
-
return purifier().sanitize(html, markdown ? MARKDOWN_CONFIG : CONFIG);
|
|
153
|
+
return tidy(purifier().sanitize(html, markdown ? MARKDOWN_CONFIG : CONFIG));
|
|
69
154
|
}
|
|
70
155
|
export {
|
|
71
156
|
sanitizeHTML
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cloverFetch } from "./request.mjs";
|
|
3
|
+
function fileName(url) {
|
|
4
|
+
try {
|
|
5
|
+
const last = new URL(url).pathname.split("/").filter(Boolean).pop();
|
|
6
|
+
return last ? decodeURIComponent(last) : "download";
|
|
7
|
+
} catch {
|
|
8
|
+
return "download";
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
async function saveFile(url, request) {
|
|
12
|
+
try {
|
|
13
|
+
const response = await cloverFetch(request, url, {
|
|
14
|
+
referrerPolicy: "no-referrer"
|
|
15
|
+
});
|
|
16
|
+
if (!response.ok) return false;
|
|
17
|
+
const href = URL.createObjectURL(await response.blob());
|
|
18
|
+
const link = document.createElement("a");
|
|
19
|
+
link.href = href;
|
|
20
|
+
link.download = fileName(url);
|
|
21
|
+
document.body.append(link);
|
|
22
|
+
link.click();
|
|
23
|
+
link.remove();
|
|
24
|
+
setTimeout(() => URL.revokeObjectURL(href), 1e4);
|
|
25
|
+
return true;
|
|
26
|
+
} catch {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
fileName,
|
|
32
|
+
saveFile
|
|
33
|
+
};
|
package/dist/core/selectors.mjs
CHANGED
|
@@ -82,6 +82,17 @@ const hasBehavior = (resource, value) => {
|
|
|
82
82
|
return Array.isArray(behavior) ? behavior.includes(value) : behavior === value;
|
|
83
83
|
};
|
|
84
84
|
const partOfCollection = (manifest) => [(manifest == null ? void 0 : manifest.partOf) ?? []].flat().find((part) => (part == null ? void 0 : part.id) && part.type === "Collection");
|
|
85
|
+
function selectTargetIndex(targets, targetIndex, manifest, canvasId) {
|
|
86
|
+
const items = targets == null ? void 0 : targets.items;
|
|
87
|
+
if (!(items == null ? void 0 : items.length) || !manifest) return -1;
|
|
88
|
+
const visible2 = selectVisibleCanvases(manifest, canvasId);
|
|
89
|
+
const here = (index) => {
|
|
90
|
+
const target = items[index];
|
|
91
|
+
return ((target == null ? void 0 : target.manifestId) === manifest.id || (target == null ? void 0 : target.manifestAs) === manifest.id) && (!target.canvasId || visible2.some((canvas) => canvas.id === target.canvasId));
|
|
92
|
+
};
|
|
93
|
+
if (targetIndex !== null && here(targetIndex)) return targetIndex;
|
|
94
|
+
return items.findIndex((_, index) => here(index));
|
|
95
|
+
}
|
|
85
96
|
export {
|
|
86
97
|
canvasOfView,
|
|
87
98
|
hasBehavior,
|
|
@@ -90,5 +101,6 @@ export {
|
|
|
90
101
|
selectPosition,
|
|
91
102
|
selectSequence,
|
|
92
103
|
selectStart,
|
|
104
|
+
selectTargetIndex,
|
|
93
105
|
selectVisibleCanvases
|
|
94
106
|
};
|