react-iiif-vault 0.9.17 → 0.9.20
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/.build/types/hooks/useAnnotationPage.d.ts +8 -0
- package/.build/types/hooks/usePaintables.d.ts +1 -0
- package/.build/types/hooks/usePaintingAnnotations.d.ts +1 -0
- package/.build/types/hooks/useRenderingStrategy.d.ts +1 -0
- package/.build/types/index.d.ts +1 -0
- package/dist/bundle/cjs/index.js +5 -5
- package/dist/bundle/cjs/index.js.map +1 -1
- package/dist/bundle/esm/index.mjs +33 -7
- package/dist/bundle/esm/index.mjs.map +1 -1
- package/dist/canvas-panel/cjs/canvas-panel.js +5 -5
- package/dist/canvas-panel/cjs/canvas-panel.js.map +1 -1
- package/dist/canvas-panel/esm/canvas-panel.mjs +9 -2
- package/dist/canvas-panel/esm/canvas-panel.mjs.map +1 -1
- package/dist/index.umd.js +22 -22
- package/dist/index.umd.js.map +1 -1
- package/dist/react17/cjs/index.js +5 -5
- package/dist/react17/cjs/index.js.map +1 -1
- package/dist/react17/esm/index.mjs +33 -7
- package/dist/react17/esm/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -408,14 +408,18 @@ function getManifestSequence(vault, manifestOrRange, { disablePaging } = {}) {
|
|
|
408
408
|
currentOrdering = [];
|
|
409
409
|
}
|
|
410
410
|
};
|
|
411
|
+
let offset = 0;
|
|
411
412
|
for (let i = 0; i < manifestItems.length; i++) {
|
|
412
413
|
const canvas = vault.get(manifestItems[i]);
|
|
413
|
-
if (
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
if (canvas.behavior.includes("non-paged")) {
|
|
415
|
+
if (i === offset) {
|
|
416
|
+
offset++;
|
|
417
|
+
}
|
|
416
418
|
continue;
|
|
417
419
|
}
|
|
418
|
-
if (canvas.behavior.includes("
|
|
420
|
+
if (i === offset || canvas.behavior.includes("facing-pages")) {
|
|
421
|
+
flush();
|
|
422
|
+
ordering.push([i]);
|
|
419
423
|
continue;
|
|
420
424
|
}
|
|
421
425
|
currentOrdering.push(i);
|
|
@@ -1303,8 +1307,11 @@ function getPaintables(vault, paintingAnnotations, enabledChoices) {
|
|
|
1303
1307
|
let choice = null;
|
|
1304
1308
|
const items = [];
|
|
1305
1309
|
for (const annotation of paintingAnnotations) {
|
|
1306
|
-
const bodies = vault.get(annotation.body);
|
|
1310
|
+
const bodies = vault.get(annotation.body, { skipSelfReturn: false });
|
|
1307
1311
|
for (const unknownBody of bodies) {
|
|
1312
|
+
if (!unknownBody) {
|
|
1313
|
+
continue;
|
|
1314
|
+
}
|
|
1308
1315
|
const [body, { selector }] = parseSpecificResource(unknownBody);
|
|
1309
1316
|
const type = (body.type || "unknown").toLowerCase();
|
|
1310
1317
|
if (type === "choice") {
|
|
@@ -1560,11 +1567,15 @@ function useLoadImageService() {
|
|
|
1560
1567
|
return [loadImageService, imageServiceStatus];
|
|
1561
1568
|
}
|
|
1562
1569
|
function usePaintingAnnotations(options = {}) {
|
|
1570
|
+
const annotation = useAnnotation();
|
|
1563
1571
|
const canvas = useCanvas(options.canvasId ? { id: options.canvasId } : void 0);
|
|
1564
1572
|
return useVaultSelector((state, vault) => {
|
|
1565
1573
|
if (!canvas) {
|
|
1566
1574
|
return [];
|
|
1567
1575
|
}
|
|
1576
|
+
if (annotation && options.enableSingleAnnotation) {
|
|
1577
|
+
return [annotation];
|
|
1578
|
+
}
|
|
1568
1579
|
const annotationPages = vault.get(canvas.items);
|
|
1569
1580
|
const flatAnnotations = [];
|
|
1570
1581
|
for (const page of annotationPages) {
|
|
@@ -1575,7 +1586,7 @@ function usePaintingAnnotations(options = {}) {
|
|
|
1575
1586
|
}
|
|
1576
1587
|
function usePaintables(options, deps = []) {
|
|
1577
1588
|
const vault = useVault();
|
|
1578
|
-
const paintingAnnotations = usePaintingAnnotations();
|
|
1589
|
+
const paintingAnnotations = usePaintingAnnotations({ enableSingleAnnotation: options == null ? void 0 : options.enableSingleAnnotation });
|
|
1579
1590
|
const [enabledChoices, setEnabledChoices] = useState((options == null ? void 0 : options.defaultChoices) || []);
|
|
1580
1591
|
const paintables = useMemo(() => getPaintables(vault, paintingAnnotations, enabledChoices), [vault, paintingAnnotations, enabledChoices, ...deps]);
|
|
1581
1592
|
const makeChoice = useCallback((id, { deselectOthers = true, deselect = false } = {}) => {
|
|
@@ -3031,6 +3042,21 @@ function CollectionContext({
|
|
|
3031
3042
|
children
|
|
3032
3043
|
});
|
|
3033
3044
|
}
|
|
3045
|
+
function useAnnotationPage(options = {}, deps = []) {
|
|
3046
|
+
const { id, selector } = options;
|
|
3047
|
+
const ctx = useResourceContext();
|
|
3048
|
+
const annotationPageId = id ? id : ctx.annotationPage;
|
|
3049
|
+
const annotationPage = useVaultSelector((s) => annotationPageId ? s.iiif.entities.AnnotationPage[annotationPageId] : void 0, [annotationPageId]);
|
|
3050
|
+
return useMemo(() => {
|
|
3051
|
+
if (!annotationPage) {
|
|
3052
|
+
return void 0;
|
|
3053
|
+
}
|
|
3054
|
+
if (selector) {
|
|
3055
|
+
return selector(annotationPage);
|
|
3056
|
+
}
|
|
3057
|
+
return annotationPage;
|
|
3058
|
+
}, [annotationPage, ...deps]);
|
|
3059
|
+
}
|
|
3034
3060
|
function useAnnotationsAtTime(time, options = {}) {
|
|
3035
3061
|
const allAnnotations = usePaintingAnnotations(options);
|
|
3036
3062
|
return allAnnotations;
|
|
@@ -3189,5 +3215,5 @@ function useStyleHelper() {
|
|
|
3189
3215
|
const vault = useVault();
|
|
3190
3216
|
return useMemo(() => createStylesHelper(vault), [vault]);
|
|
3191
3217
|
}
|
|
3192
|
-
export { AnnotationContext, AnnotationPageContext, CanvasContext, CanvasPanel, CanvasPortal, CollectionContext, ContextBridge, ImageServiceLoaderContext, InnerViewerProvider, ManifestContext, MediaPlayerProvider, OverlayPortalContext, PortalContext, RangeContext, ReactVaultContext, ResourceProvider, ResourceReactContext, SimpleViewerProvider, SimpleViewerReactContext, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, emptyActions, emptyStrategy, expandTarget, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getImageStrategy, getManifestSequence, getPaintables, getParsedTargetSelector, getVisibleCanvasesFromCanvasId, parseSelector, parseSpecificResource, unknownResponse, unsupportedStrategy, useAnnotation, useAnnotationPageManager, useAnnotationsAtTime, useCanvas, useCanvasClock, useCanvasSequence, useCanvasSubset, useCollection, useContextBridge, useDispatch, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useImageService, useImageServiceLoader, useImageTile, useLoadImageService, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, useRange, useRenderingStrategy, useResourceContext, useResourceEvents, useResources, useSearchService, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useThumbnail, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
|
3218
|
+
export { AnnotationContext, AnnotationPageContext, CanvasContext, CanvasPanel, CanvasPortal, CollectionContext, ContextBridge, ImageServiceLoaderContext, InnerViewerProvider, ManifestContext, MediaPlayerProvider, OverlayPortalContext, PortalContext, RangeContext, ReactVaultContext, ResourceProvider, ResourceReactContext, SimpleViewerProvider, SimpleViewerReactContext, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, emptyActions, emptyStrategy, expandTarget, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getImageStrategy, getManifestSequence, getPaintables, getParsedTargetSelector, getVisibleCanvasesFromCanvasId, parseSelector, parseSpecificResource, unknownResponse, unsupportedStrategy, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationsAtTime, useCanvas, useCanvasClock, useCanvasSequence, useCanvasSubset, useCollection, useContextBridge, useDispatch, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useImageService, useImageServiceLoader, useImageTile, useLoadImageService, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, useRange, useRenderingStrategy, useResourceContext, useResourceEvents, useResources, useSearchService, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useThumbnail, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
|
3193
3219
|
//# sourceMappingURL=index.mjs.map
|