@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,62 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { preloadLightbox, Lightbox } from "../shared/Lightbox.mjs";
|
|
5
|
+
import { titled } from "../../ui/heading.mjs";
|
|
6
|
+
import { useUniqueId } from "../../ui/useUniqueId.mjs";
|
|
7
|
+
import { Root } from "../../components/Root/Root.mjs";
|
|
8
|
+
import { Label } from "../../components/Label/Label.mjs";
|
|
9
|
+
import { Summary } from "../../components/Primitives/Primitives.mjs";
|
|
10
|
+
import { Status } from "../../components/Status/Status.mjs";
|
|
11
|
+
import { Items } from "../../components/Items/Items.mjs";
|
|
12
|
+
const below = (level) => level + 1;
|
|
13
|
+
function Gallery({
|
|
14
|
+
className,
|
|
15
|
+
size,
|
|
16
|
+
headingLevel = 2,
|
|
17
|
+
style,
|
|
18
|
+
...root
|
|
19
|
+
}) {
|
|
20
|
+
const [open, setOpen] = useState(false);
|
|
21
|
+
const title = titled(
|
|
22
|
+
headingLevel,
|
|
23
|
+
`${useUniqueId().replace(/:/g, "")}-title`
|
|
24
|
+
);
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
Root,
|
|
27
|
+
{
|
|
28
|
+
className: ["clover-template-gallery", className].filter(Boolean).join(" "),
|
|
29
|
+
style: size ? { ...style, "--clover-items-size": size } : style,
|
|
30
|
+
onPointerOver: preloadLightbox,
|
|
31
|
+
onFocus: preloadLightbox,
|
|
32
|
+
...title.group,
|
|
33
|
+
...root,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsxs("header", { className: "clover-template-gallery-header", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
Label,
|
|
38
|
+
{
|
|
39
|
+
as: title.as,
|
|
40
|
+
className: "clover-template-gallery-title",
|
|
41
|
+
...title.title
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsx(Summary, { className: "clover-template-gallery-summary" })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsx(Status, {}),
|
|
47
|
+
/* @__PURE__ */ jsx(Items, { layout: "grid", onSelect: () => setOpen(true) }),
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Lightbox,
|
|
50
|
+
{
|
|
51
|
+
open,
|
|
52
|
+
onClose: () => setOpen(false),
|
|
53
|
+
headingLevel: below(headingLevel)
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
Gallery
|
|
62
|
+
};
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v8.0.1
|
|
2
|
+
|
|
3
|
+
import * as P4 from '@iiif/parser/presentation-4/types';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
export type Presentation4Canvas = P4.Canvas;
|
|
7
|
+
export type Presentation4Scene = P4.Scene;
|
|
8
|
+
export type Presentation4Timeline = P4.Timeline;
|
|
9
|
+
/**
|
|
10
|
+
* A IIIF resource Clover can show directly, a Manifest's item: a Canvas (`Canvas`), a
|
|
11
|
+
* Timeline (`Timeline`, sound) or a Scene (`Scene`, 3D).
|
|
12
|
+
*/
|
|
13
|
+
export type Container = Presentation4Canvas | Presentation4Timeline | Presentation4Scene;
|
|
14
|
+
/**
|
|
15
|
+
* How Clover asks for things: one setting for every request it makes — the IIIF resource,
|
|
16
|
+
* referenced annotation pages, `info.json`, tiles, captions and HLS segments.
|
|
17
|
+
*
|
|
18
|
+
* A `<video>` or `<img>` element cannot send headers, so where Clover must use one (media
|
|
19
|
+
* without HLS, an image served without CORS) only `credentials` applies.
|
|
20
|
+
*/
|
|
21
|
+
export interface CloverRequest {
|
|
22
|
+
/** Cookies and HTTP authentication: `"include"` sends them cross-origin. */
|
|
23
|
+
credentials?: RequestCredentials;
|
|
24
|
+
/** Extra headers, such as `Authorization`. They force a CORS preflight. */
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
/** Your own `fetch`, to sign, log or proxy requests. */
|
|
27
|
+
fetch?: typeof fetch;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Annotations a host adds to what the Manifest carries: an AnnotationPage, an
|
|
31
|
+
* AnnotationCollection (its pages followed from `first` through `next`), or a list of
|
|
32
|
+
* either, as URLs or objects. Each page becomes one set.
|
|
33
|
+
*/
|
|
34
|
+
export type AnnotationsInput = string | Record<string, unknown> | unknown[];
|
|
35
|
+
export interface ContentStateOutput {
|
|
36
|
+
/** The content state annotation. */
|
|
37
|
+
json: Record<string, unknown>;
|
|
38
|
+
/** The same, encoded for a URL. */
|
|
39
|
+
encoded: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Turning whatever a `Root` is handed into a Manifest to show.
|
|
43
|
+
*
|
|
44
|
+
* `iiifContent` may be a URL, a IIIF resource object (Presentation 2, 3 or 4), or a content
|
|
45
|
+
* state (JSON or base64url). The resource may be a Manifest, a Collection (its first
|
|
46
|
+
* Manifest is shown), a lone Canvas (its `partOf` Manifest, or a Manifest made around
|
|
47
|
+
* it), or annotations, an AnnotationPage or AnnotationCollection (the Manifest their first
|
|
48
|
+
* annotation's Canvas is `partOf`, at that Canvas). Everything is fetched once, with the
|
|
49
|
+
* request settings, and upgraded to Presentation 4.
|
|
50
|
+
*/
|
|
51
|
+
export type IIIFContent = string | Record<string, unknown>;
|
|
52
|
+
/**
|
|
53
|
+
* One Clover: what a `Root` owns. Framework-free, so it can be tested — and driven —
|
|
54
|
+
* without React.
|
|
55
|
+
*
|
|
56
|
+
* The store holds only what parts render from. Everything that changes per frame (the
|
|
57
|
+
* viewport) or per tick (media time) goes through channels, so panning or playback
|
|
58
|
+
* re-renders nothing that has not asked to hear about it.
|
|
59
|
+
*/
|
|
60
|
+
export type CloverStatus = "idle" | "loading" | "ready" | "error";
|
|
61
|
+
/**
|
|
62
|
+
* Renderers of your own for some views, drawn by `Body` in place of `Canvas`: a 3D
|
|
63
|
+
* model, a PDF, a map, anything a Canvas paints that Clover does not draw, or draws
|
|
64
|
+
* differently than you want. The successor to 3.x's `customDisplays`.
|
|
65
|
+
*/
|
|
66
|
+
export interface BodyRendererProps {
|
|
67
|
+
/** The view's Canvases, in Presentation 4: one, or two for a spread. */
|
|
68
|
+
canvases: Container[];
|
|
69
|
+
/**
|
|
70
|
+
* The bodies the view's Canvases paint, unwrapped: a `Choice` as its first item, a
|
|
71
|
+
* `SpecificResource` as its `source`, Presentation 4's groups as their items.
|
|
72
|
+
*/
|
|
73
|
+
bodies: Array<Record<string, any>>;
|
|
74
|
+
/** `Body`'s children (its controls), to place if the renderer wants them. */
|
|
75
|
+
children?: React.ReactNode;
|
|
76
|
+
}
|
|
77
|
+
export interface BodyRenderer {
|
|
78
|
+
/** Draws a view showing one of these Canvases… */
|
|
79
|
+
canvasId?: string[];
|
|
80
|
+
/** …or painting a body of one of these formats (`model/gltf-binary`, `application/pdf`)… */
|
|
81
|
+
format?: string[];
|
|
82
|
+
/** …or any view this says yes to. */
|
|
83
|
+
match?: (view: Omit<BodyRendererProps, "children">) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* What draws it. It renders inside the Root, so Clover's hooks work in it
|
|
86
|
+
* (`useActiveCanvas`, `useNavigation`, `useClover`…), as 3.x's `hooks` prop gave.
|
|
87
|
+
*/
|
|
88
|
+
component: React.ComponentType<BodyRendererProps>;
|
|
89
|
+
}
|
|
90
|
+
export interface RootProps extends Omit<React.HTMLAttributes<HTMLElement>, "children"> {
|
|
91
|
+
/**
|
|
92
|
+
* What to show: a URL, a IIIF resource (Presentation 2, 3 or 4: a Manifest, Collection
|
|
93
|
+
* or Canvas), or a content state (JSON or base64url).
|
|
94
|
+
*/
|
|
95
|
+
iiifContent: IIIFContent;
|
|
96
|
+
/** The Canvas to show, controlled: moving asks `onCanvasChange` to change it. */
|
|
97
|
+
canvasId?: string;
|
|
98
|
+
/** The Canvas to start on, uncontrolled. A content state or `start` still wins. */
|
|
99
|
+
defaultCanvasId?: string;
|
|
100
|
+
/** The reader moved to a Canvas (the first of the view that shows it). */
|
|
101
|
+
onCanvasChange?: (canvasId: string) => void;
|
|
102
|
+
/**
|
|
103
|
+
* In a Collection, the member Manifest to show, controlled: choosing another asks
|
|
104
|
+
* `onManifestChange` to change it.
|
|
105
|
+
*/
|
|
106
|
+
manifestId?: string;
|
|
107
|
+
/** In a Collection, the member Manifest to open first, uncontrolled. */
|
|
108
|
+
defaultManifestId?: string;
|
|
109
|
+
/** In a Collection, the reader moved (or, controlled, asks to move) to a Manifest. */
|
|
110
|
+
onManifestChange?: (manifestId: string) => void;
|
|
111
|
+
onStatusChange?: (status: CloverStatus, error: Error | null) => void;
|
|
112
|
+
/**
|
|
113
|
+
* A Content Search query to run once the Manifest is shown, and again whenever it
|
|
114
|
+
* changes (3.x's `iiifContentSearchQuery`). The reader can search on from `Search`.
|
|
115
|
+
*/
|
|
116
|
+
searchQuery?: string;
|
|
117
|
+
/** Credentials, headers and `fetch` for every request any part makes. */
|
|
118
|
+
request?: CloverRequest;
|
|
119
|
+
/** The language to read IIIF text in. The reader's, by default. */
|
|
120
|
+
language?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Renderers of your own for some views — by Canvas id, painting format, or a test —
|
|
123
|
+
* drawn by every `Body` inside in place of `Canvas` (3.x's `customDisplays`).
|
|
124
|
+
*/
|
|
125
|
+
renderers?: BodyRenderer[];
|
|
126
|
+
/**
|
|
127
|
+
* Annotations to show beside the Manifest's own: an AnnotationPage or
|
|
128
|
+
* AnnotationCollection (or a list of them), as URLs or objects.
|
|
129
|
+
*/
|
|
130
|
+
annotations?: AnnotationsInput;
|
|
131
|
+
/**
|
|
132
|
+
* Whose referenced annotation pages to fetch: the view's as the reader moves (default),
|
|
133
|
+
* or every Canvas's at once, for a layout that shows them all.
|
|
134
|
+
*/
|
|
135
|
+
annotationPages?: "view" | "all";
|
|
136
|
+
/**
|
|
137
|
+
* Where the reader is, as a IIIF content state, whenever it settles: after a move, a
|
|
138
|
+
* pan or zoom, or a pause or seek in media. Debounced, and only when it changed.
|
|
139
|
+
*/
|
|
140
|
+
onContentStateChange?: (state: ContentStateOutput) => void;
|
|
141
|
+
/** The element to render. Default `div`. */
|
|
142
|
+
as?: React.ElementType;
|
|
143
|
+
children?: React.ReactNode;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* A scrolling row of thumbnails (`slider`), a column, a wrapping grid, or one item at a
|
|
147
|
+
* time (`pager`: Previous, Position and Next).
|
|
148
|
+
*/
|
|
149
|
+
export type ItemsLayout = "slider" | "list" | "grid" | "pager";
|
|
150
|
+
/** How the sections are laid out. */
|
|
151
|
+
export type SectionsLayout = "tabs" | "accordion";
|
|
152
|
+
/** How an information panel lays out its sections. */
|
|
153
|
+
export type PanelLayout = SectionsLayout;
|
|
154
|
+
export type DefaultProps = Omit<RootProps, "children"> & {
|
|
155
|
+
/** The header over the Body: the resource's title and provider. Default `true`. */
|
|
156
|
+
header?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* The title's heading level, to fit the outline of the page around the layout (under
|
|
159
|
+
* an `h2`, 3). The panel's sections are a level below it, or at it with no header,
|
|
160
|
+
* taking the title's place. Default 2.
|
|
161
|
+
*/
|
|
162
|
+
headingLevel?: number;
|
|
163
|
+
/** The information panel beside the Body, with its toggle. Default `true`. */
|
|
164
|
+
panel?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Whether the panel starts open beside the Body. Default `true`. Where it has no room
|
|
167
|
+
* there and would slide over the Body, it starts closed.
|
|
168
|
+
*/
|
|
169
|
+
defaultPanelOpen?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* How the information panel lays out its sections: `"accordion"` (the default),
|
|
172
|
+
* stacked boxes each opened by its heading, or `"tabs"`.
|
|
173
|
+
*/
|
|
174
|
+
panelLayout?: PanelLayout;
|
|
175
|
+
/** The downloads in the panel's About, as links. Default `true`. */
|
|
176
|
+
download?: boolean;
|
|
177
|
+
/** The thumbnails under the Body: a layout, or `false` for none. Default `slider`. */
|
|
178
|
+
items?: Exclude<ItemsLayout, "pager"> | false;
|
|
179
|
+
/**
|
|
180
|
+
* Where the panel's width is remembered once the reader drags its bar
|
|
181
|
+
* (`localStorage`). Default `"clover-template-default"`; `false` forgets it.
|
|
182
|
+
*/
|
|
183
|
+
storageKey?: string | false;
|
|
184
|
+
/**
|
|
185
|
+
* Fill the box it sits in: as tall as that box, the Body taking what the header and
|
|
186
|
+
* the strip leave, so nothing runs below it. For a box of a set height, the window
|
|
187
|
+
* under a page's own header say. Default `false`: the Body is
|
|
188
|
+
* `--clover-body-height` tall, and the layout as tall as it needs.
|
|
189
|
+
*/
|
|
190
|
+
fill?: boolean;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* The Viewer's own layout, drawn when no `template` is given: Clover 3.x's Viewer, built
|
|
194
|
+
* from 4.x parts. Copy this file to start a layout of your own.
|
|
195
|
+
*
|
|
196
|
+
* The title and its actions over the Body, and under the Body the thumbnail strip,
|
|
197
|
+
* headed by the position and a pair of arrows; the information panel to the right of all
|
|
198
|
+
* three, the layout's full height. The panel has its own space, as in 3.x, and a bar
|
|
199
|
+
* between it and the rest shares the width (drag it, or use the arrow keys on it). Where there is no room for both
|
|
200
|
+
* (a phone), the panel slides over the Body instead, and a strip of the page stays
|
|
201
|
+
* uncovered: a click there, Escape or the panel's close button puts it away. Size it with
|
|
202
|
+
* `--clover-body-height`.
|
|
203
|
+
*/
|
|
204
|
+
export declare function Default({ className, header, headingLevel, panel, defaultPanelOpen, panelLayout, download, items, storageKey, fill, ...root }: DefaultProps): React.JSX.Element;
|
|
205
|
+
export type DocumentProps = Omit<RootProps, "children"> & {
|
|
206
|
+
/**
|
|
207
|
+
* Whether the page thumbnails start shown beside the page. Default `true`. On a phone,
|
|
208
|
+
* where they would float over the page, they start put away.
|
|
209
|
+
*/
|
|
210
|
+
defaultSidebarOpen?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Whether the information panel starts open beside the page. Default `false`. Where it
|
|
213
|
+
* has no room there and would slide over the page, it starts closed.
|
|
214
|
+
*/
|
|
215
|
+
defaultPanelOpen?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* How the information panel lays out its sections: `"accordion"` (the default, as
|
|
218
|
+
* Default's), stacked boxes each opened by its heading, or `"tabs"`.
|
|
219
|
+
*/
|
|
220
|
+
panelLayout?: PanelLayout;
|
|
221
|
+
/** The downloads in the toolbar, as links: the page's and the Manifest's `rendering`. Default `true`. */
|
|
222
|
+
download?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* The title's heading level, to fit the outline of the page around the layout (under
|
|
225
|
+
* an `h2`, 3). The panel's sections, and the downloads' groups, are a level below
|
|
226
|
+
* it. Default 2.
|
|
227
|
+
*/
|
|
228
|
+
headingLevel?: number;
|
|
229
|
+
/**
|
|
230
|
+
* Where the thumbnails' width is remembered once the reader drags the bar beside them
|
|
231
|
+
* (`localStorage`). Default `"clover-template-document"`; `false` forgets it.
|
|
232
|
+
*/
|
|
233
|
+
storageKey?: string | false;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* A layout that reads like a PDF viewer: a toolbar, page thumbnails down the left, and
|
|
237
|
+
* the pages down one column, a spread to a sheet, the top of the next always showing:
|
|
238
|
+
* scrolling moves through them as a PDF reader's continuous view does, coming to rest on
|
|
239
|
+
* a sheet near its top, and PageUp and PageDown go a sheet at a time (`Sheets.tsx`). A
|
|
240
|
+
* bar between the thumbnails and the pages widens or narrows them. The information panel sits to the right of the page, with its own bar,
|
|
241
|
+
* where there is room for both, and slides out over the page where there is not. Size
|
|
242
|
+
* it with `--clover-template-document-height`.
|
|
243
|
+
*/
|
|
244
|
+
export declare function Document({ className, defaultSidebarOpen, defaultPanelOpen, panelLayout, download, headingLevel, storageKey, ...root }: DocumentProps): React.JSX.Element;
|
|
245
|
+
export type GalleryProps = Omit<RootProps, "children"> & {
|
|
246
|
+
/** The size of a grid cell. Default `10rem`, through `--clover-items-size`. */
|
|
247
|
+
size?: string;
|
|
248
|
+
/**
|
|
249
|
+
* The title's heading level, to fit the outline of the page around the layout (under
|
|
250
|
+
* an `h2`, 3). The lightbox's title is a level below it. Default 2.
|
|
251
|
+
*/
|
|
252
|
+
headingLevel?: number;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* A grid of the Manifest's views — a spread is one cell — that opens one in a lightbox
|
|
256
|
+
* with the Body and the pager. Escape, the close button, or a press outside closes it,
|
|
257
|
+
* and focus returns to the cell.
|
|
258
|
+
*/
|
|
259
|
+
export declare function Gallery({ className, size, headingLevel, style, ...root }: GalleryProps): React.JSX.Element;
|
|
260
|
+
export interface LightboxProps {
|
|
261
|
+
open: boolean;
|
|
262
|
+
onClose: () => void;
|
|
263
|
+
/** The level of its title, a level under the layout's. Default 3. */
|
|
264
|
+
headingLevel?: number;
|
|
265
|
+
className?: string;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The current Canvas in a modal `<dialog>`: its label, the Body, and the pager (with the
|
|
269
|
+
* position). A native dialog keeps focus inside, closes on Escape, and returns focus to
|
|
270
|
+
* whatever opened it. The Body mounts only while open, so it is sized when drawn, and its
|
|
271
|
+
* code loads the first time (`preloadLightbox` starts it sooner): until then its box holds
|
|
272
|
+
* its place, busy, while the title, Close and the pager are already there.
|
|
273
|
+
*/
|
|
274
|
+
export declare function Lightbox({ open, onClose, headingLevel, className, }: LightboxProps): React.JSX.Element;
|
|
275
|
+
|
|
276
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Default } from "./default/Default.mjs";
|
|
3
|
+
import { Document } from "./document/Document.mjs";
|
|
4
|
+
import { Gallery } from "./gallery/Gallery.mjs";
|
|
5
|
+
import { Lightbox } from "./shared/Lightbox.mjs";
|
|
6
|
+
export {
|
|
7
|
+
Default,
|
|
8
|
+
Document,
|
|
9
|
+
Gallery,
|
|
10
|
+
Lightbox
|
|
11
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useEffect, Suspense, lazy } from "react";
|
|
4
|
+
import { useT, useLangOf, useLocalized, useActiveCanvas } from "../../react/hooks.mjs";
|
|
5
|
+
import { useUniqueId } from "../../ui/useUniqueId.mjs";
|
|
6
|
+
import { Label } from "../../components/Label/Label.mjs";
|
|
7
|
+
import { titled } from "../../ui/heading.mjs";
|
|
8
|
+
import { Tip } from "../../ui/Tip.mjs";
|
|
9
|
+
import { Items } from "../../components/Items/Items.mjs";
|
|
10
|
+
const load = () => import("./LightboxBody.mjs");
|
|
11
|
+
const LightboxBody = lazy(load);
|
|
12
|
+
const preloadLightbox = () => void load();
|
|
13
|
+
function Lightbox({
|
|
14
|
+
open,
|
|
15
|
+
onClose,
|
|
16
|
+
headingLevel = 3,
|
|
17
|
+
className
|
|
18
|
+
}) {
|
|
19
|
+
var _a;
|
|
20
|
+
const t = useT();
|
|
21
|
+
const langOf = useLangOf();
|
|
22
|
+
const dialog = useRef(null);
|
|
23
|
+
const baseId = useUniqueId().replace(/:/g, "");
|
|
24
|
+
const titleId = `${baseId}-title`;
|
|
25
|
+
const manifestTitleId = `${baseId}-manifest`;
|
|
26
|
+
const canvasLabel = useLocalized((_a = useActiveCanvas()) == null ? void 0 : _a.label);
|
|
27
|
+
const named = canvasLabel.text ? titleId : manifestTitleId;
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
var _a2;
|
|
30
|
+
const element = dialog.current;
|
|
31
|
+
if (!element) return;
|
|
32
|
+
if (open && !element.open) (_a2 = element.showModal) == null ? void 0 : _a2.call(element);
|
|
33
|
+
if (!open && element.open) element.close();
|
|
34
|
+
}, [open]);
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"dialog",
|
|
37
|
+
{
|
|
38
|
+
ref: dialog,
|
|
39
|
+
className: ["clover-template-lightbox", className].filter(Boolean).join(" "),
|
|
40
|
+
"aria-labelledby": named,
|
|
41
|
+
onClose,
|
|
42
|
+
onClick: (event) => {
|
|
43
|
+
if (event.target === dialog.current) onClose();
|
|
44
|
+
},
|
|
45
|
+
children: open && /* @__PURE__ */ jsxs("div", { className: "clover-template-lightbox-content", children: [
|
|
46
|
+
/* @__PURE__ */ jsxs("header", { className: "clover-template-lightbox-header", children: [
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
Label,
|
|
49
|
+
{
|
|
50
|
+
of: "canvas",
|
|
51
|
+
as: titled(headingLevel, titleId).as,
|
|
52
|
+
id: titleId,
|
|
53
|
+
className: "clover-template-lightbox-title"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
named === manifestTitleId && /* @__PURE__ */ jsx(Label, { id: manifestTitleId, hidden: true }),
|
|
57
|
+
/* @__PURE__ */ jsxs(
|
|
58
|
+
"button",
|
|
59
|
+
{
|
|
60
|
+
type: "button",
|
|
61
|
+
className: "clover-template-lightbox-close",
|
|
62
|
+
"aria-label": t("commonClose"),
|
|
63
|
+
lang: langOf("commonClose"),
|
|
64
|
+
onClick: onClose,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
"svg",
|
|
68
|
+
{
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
focusable: "false",
|
|
71
|
+
width: "16",
|
|
72
|
+
height: "16",
|
|
73
|
+
viewBox: "0 0 16 16",
|
|
74
|
+
children: /* @__PURE__ */ jsx(
|
|
75
|
+
"path",
|
|
76
|
+
{
|
|
77
|
+
d: "M3 3l10 10M13 3L3 13",
|
|
78
|
+
stroke: "currentColor",
|
|
79
|
+
strokeWidth: "2",
|
|
80
|
+
strokeLinecap: "round"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsx(Tip, { label: t("commonClose") })
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
Suspense,
|
|
92
|
+
{
|
|
93
|
+
fallback: /* @__PURE__ */ jsx(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
className: "clover-template-lightbox-body clover-template-lightbox-pending",
|
|
97
|
+
"aria-busy": "true"
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
children: /* @__PURE__ */ jsx(LightboxBody, {})
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsx(Items, { layout: "pager" })
|
|
104
|
+
] })
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
Lightbox,
|
|
110
|
+
preloadLightbox
|
|
111
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Body } from "../../components/Body/Body.mjs";
|
|
4
|
+
function LightboxBody() {
|
|
5
|
+
return /* @__PURE__ */ jsx(Body, { className: "clover-template-lightbox-body" });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
LightboxBody as default
|
|
9
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const CLOSE_SHARE = 1 / 3;
|
|
3
|
+
const FLICK = 0.5;
|
|
4
|
+
const SLOP = 8;
|
|
5
|
+
const SPRING = "translate 240ms cubic-bezier(0.16, 1, 0.3, 1)";
|
|
6
|
+
function attach(element, latest) {
|
|
7
|
+
let id = null;
|
|
8
|
+
let state = "idle";
|
|
9
|
+
let startX = 0;
|
|
10
|
+
let startY = 0;
|
|
11
|
+
let offset = 0;
|
|
12
|
+
let width = 1;
|
|
13
|
+
let toward = 1;
|
|
14
|
+
let samples = [];
|
|
15
|
+
const moving = () => {
|
|
16
|
+
var _a;
|
|
17
|
+
return [element, (_a = latest.current.alongside) == null ? void 0 : _a.current];
|
|
18
|
+
};
|
|
19
|
+
const onDown = (event) => {
|
|
20
|
+
if (event.pointerType === "mouse" || !event.isPrimary || !latest.current.enabled)
|
|
21
|
+
return;
|
|
22
|
+
id = event.pointerId;
|
|
23
|
+
state = "pending";
|
|
24
|
+
startX = event.clientX;
|
|
25
|
+
startY = event.clientY;
|
|
26
|
+
offset = 0;
|
|
27
|
+
width = element.getBoundingClientRect().width || 1;
|
|
28
|
+
const rtl = getComputedStyle(element).direction === "rtl";
|
|
29
|
+
toward = latest.current.side === "end" !== rtl ? 1 : -1;
|
|
30
|
+
samples = [[event.timeStamp, 0]];
|
|
31
|
+
};
|
|
32
|
+
const onMove = (event) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if (event.pointerId !== id || state === "idle" || state === "scroll")
|
|
35
|
+
return;
|
|
36
|
+
const dx = (event.clientX - startX) * toward;
|
|
37
|
+
const dy = event.clientY - startY;
|
|
38
|
+
if (state === "pending") {
|
|
39
|
+
if (Math.abs(dy) > SLOP && Math.abs(dy) > Math.abs(dx)) {
|
|
40
|
+
state = "scroll";
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (dx < SLOP) return;
|
|
44
|
+
state = "drag";
|
|
45
|
+
try {
|
|
46
|
+
(_a = element.setPointerCapture) == null ? void 0 : _a.call(element, event.pointerId);
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
move(moving(), void 0, "none");
|
|
50
|
+
}
|
|
51
|
+
offset = Math.max(0, dx);
|
|
52
|
+
move(moving(), `${offset * toward}px 0`);
|
|
53
|
+
const wash = (_b = latest.current.scrim) == null ? void 0 : _b.current;
|
|
54
|
+
if (wash) {
|
|
55
|
+
wash.style.transition = "none";
|
|
56
|
+
wash.style.opacity = String(1 - offset / width);
|
|
57
|
+
}
|
|
58
|
+
samples.push([event.timeStamp, offset]);
|
|
59
|
+
if (samples.length > 5) samples.shift();
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
};
|
|
62
|
+
const onUp = (event) => {
|
|
63
|
+
var _a;
|
|
64
|
+
if (event.pointerId !== id) return;
|
|
65
|
+
const dragged = state === "drag";
|
|
66
|
+
state = "idle";
|
|
67
|
+
id = null;
|
|
68
|
+
if (!dragged) return;
|
|
69
|
+
element.addEventListener("click", swallow, { capture: true, once: true });
|
|
70
|
+
setTimeout(() => element.removeEventListener("click", swallow, true), 0);
|
|
71
|
+
const [t0, x0] = samples[0];
|
|
72
|
+
const [t1, x1] = samples[samples.length - 1];
|
|
73
|
+
const speed = t1 > t0 ? (x1 - x0) / (t1 - t0) : 0;
|
|
74
|
+
const wash = (_a = latest.current.scrim) == null ? void 0 : _a.current;
|
|
75
|
+
if (offset > width * CLOSE_SHARE || speed > FLICK) {
|
|
76
|
+
if (wash) {
|
|
77
|
+
wash.style.transition = "opacity 240ms ease";
|
|
78
|
+
wash.style.opacity = "0";
|
|
79
|
+
}
|
|
80
|
+
if (latest.current.exits) {
|
|
81
|
+
move(moving(), `${width * toward}px 0`, "translate 200ms ease-out");
|
|
82
|
+
setTimeout(() => latest.current.onClose(), 200);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
move(moving(), void 0, "");
|
|
86
|
+
latest.current.onClose();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
move(moving(), "", SPRING);
|
|
90
|
+
if (wash) {
|
|
91
|
+
wash.style.transition = "opacity 240ms ease";
|
|
92
|
+
wash.style.opacity = "";
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const swallow = (event) => {
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
};
|
|
99
|
+
element.addEventListener("pointerdown", onDown);
|
|
100
|
+
element.addEventListener("pointermove", onMove, { passive: false });
|
|
101
|
+
element.addEventListener("pointerup", onUp);
|
|
102
|
+
element.addEventListener("pointercancel", onUp);
|
|
103
|
+
return () => {
|
|
104
|
+
element.removeEventListener("pointerdown", onDown);
|
|
105
|
+
element.removeEventListener("pointermove", onMove);
|
|
106
|
+
element.removeEventListener("pointerup", onUp);
|
|
107
|
+
element.removeEventListener("pointercancel", onUp);
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function reset(element, latest) {
|
|
111
|
+
var _a, _b;
|
|
112
|
+
move([element, (_a = latest.current.alongside) == null ? void 0 : _a.current], "", "");
|
|
113
|
+
const wash = (_b = latest.current.scrim) == null ? void 0 : _b.current;
|
|
114
|
+
if (wash) {
|
|
115
|
+
wash.style.opacity = "";
|
|
116
|
+
wash.style.transition = "";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function move(elements, translate, transition) {
|
|
120
|
+
for (const element of elements) {
|
|
121
|
+
if (!element) continue;
|
|
122
|
+
if (transition !== void 0) element.style.transition = transition;
|
|
123
|
+
if (translate !== void 0) element.style.translate = translate;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
attach,
|
|
128
|
+
reset
|
|
129
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useRef, useEffect } from "react";
|
|
3
|
+
let drag;
|
|
4
|
+
let loaded;
|
|
5
|
+
function useDragToClose(pane, {
|
|
6
|
+
enabled,
|
|
7
|
+
side,
|
|
8
|
+
onClose,
|
|
9
|
+
scrim,
|
|
10
|
+
alongside,
|
|
11
|
+
exits = false
|
|
12
|
+
}) {
|
|
13
|
+
const latest = useRef({ enabled, side, onClose, scrim, alongside, exits });
|
|
14
|
+
latest.current = { enabled, side, onClose, scrim, alongside, exits };
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const element = pane.current;
|
|
17
|
+
if (!element) return;
|
|
18
|
+
loaded == null ? void 0 : loaded.reset(element, latest);
|
|
19
|
+
if (!enabled) return;
|
|
20
|
+
let live = true;
|
|
21
|
+
let detach;
|
|
22
|
+
void (drag ?? (drag = import("./dragToClose.mjs").then(
|
|
23
|
+
(module) => loaded = module
|
|
24
|
+
))).then((module) => {
|
|
25
|
+
if (live) detach = module.attach(element, latest);
|
|
26
|
+
});
|
|
27
|
+
return () => {
|
|
28
|
+
live = false;
|
|
29
|
+
detach == null ? void 0 : detach();
|
|
30
|
+
};
|
|
31
|
+
}, [pane, enabled]);
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
useDragToClose
|
|
35
|
+
};
|