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);
|
|
@@ -1308,8 +1312,11 @@ function getPaintables(vault, paintingAnnotations, enabledChoices) {
|
|
|
1308
1312
|
let choice = null;
|
|
1309
1313
|
const items = [];
|
|
1310
1314
|
for (const annotation of paintingAnnotations) {
|
|
1311
|
-
const bodies = vault.get(annotation.body);
|
|
1315
|
+
const bodies = vault.get(annotation.body, { skipSelfReturn: false });
|
|
1312
1316
|
for (const unknownBody of bodies) {
|
|
1317
|
+
if (!unknownBody) {
|
|
1318
|
+
continue;
|
|
1319
|
+
}
|
|
1313
1320
|
const [body, { selector }] = parseSpecificResource(unknownBody);
|
|
1314
1321
|
const type = (body.type || "unknown").toLowerCase();
|
|
1315
1322
|
if (type === "choice") {
|
|
@@ -1565,11 +1572,15 @@ function useLoadImageService() {
|
|
|
1565
1572
|
return [loadImageService, imageServiceStatus];
|
|
1566
1573
|
}
|
|
1567
1574
|
function usePaintingAnnotations(options = {}) {
|
|
1575
|
+
const annotation = useAnnotation();
|
|
1568
1576
|
const canvas = useCanvas(options.canvasId ? { id: options.canvasId } : void 0);
|
|
1569
1577
|
return useVaultSelector((state, vault) => {
|
|
1570
1578
|
if (!canvas) {
|
|
1571
1579
|
return [];
|
|
1572
1580
|
}
|
|
1581
|
+
if (annotation && options.enableSingleAnnotation) {
|
|
1582
|
+
return [annotation];
|
|
1583
|
+
}
|
|
1573
1584
|
const annotationPages = vault.get(canvas.items);
|
|
1574
1585
|
const flatAnnotations = [];
|
|
1575
1586
|
for (const page of annotationPages) {
|
|
@@ -1580,7 +1591,7 @@ function usePaintingAnnotations(options = {}) {
|
|
|
1580
1591
|
}
|
|
1581
1592
|
function usePaintables(options, deps = []) {
|
|
1582
1593
|
const vault = useVault();
|
|
1583
|
-
const paintingAnnotations = usePaintingAnnotations();
|
|
1594
|
+
const paintingAnnotations = usePaintingAnnotations({ enableSingleAnnotation: options == null ? void 0 : options.enableSingleAnnotation });
|
|
1584
1595
|
const [enabledChoices, setEnabledChoices] = useState((options == null ? void 0 : options.defaultChoices) || []);
|
|
1585
1596
|
const paintables = useMemo(() => getPaintables(vault, paintingAnnotations, enabledChoices), [vault, paintingAnnotations, enabledChoices, ...deps]);
|
|
1586
1597
|
const makeChoice = useCallback((id, { deselectOthers = true, deselect = false } = {}) => {
|
|
@@ -3036,6 +3047,21 @@ function CollectionContext({
|
|
|
3036
3047
|
children
|
|
3037
3048
|
});
|
|
3038
3049
|
}
|
|
3050
|
+
function useAnnotationPage(options = {}, deps = []) {
|
|
3051
|
+
const { id, selector } = options;
|
|
3052
|
+
const ctx = useResourceContext();
|
|
3053
|
+
const annotationPageId = id ? id : ctx.annotationPage;
|
|
3054
|
+
const annotationPage = useVaultSelector((s) => annotationPageId ? s.iiif.entities.AnnotationPage[annotationPageId] : void 0, [annotationPageId]);
|
|
3055
|
+
return useMemo(() => {
|
|
3056
|
+
if (!annotationPage) {
|
|
3057
|
+
return void 0;
|
|
3058
|
+
}
|
|
3059
|
+
if (selector) {
|
|
3060
|
+
return selector(annotationPage);
|
|
3061
|
+
}
|
|
3062
|
+
return annotationPage;
|
|
3063
|
+
}, [annotationPage, ...deps]);
|
|
3064
|
+
}
|
|
3039
3065
|
function useAnnotationsAtTime(time, options = {}) {
|
|
3040
3066
|
const allAnnotations = usePaintingAnnotations(options);
|
|
3041
3067
|
return allAnnotations;
|
|
@@ -3194,5 +3220,5 @@ function useStyleHelper() {
|
|
|
3194
3220
|
const vault = useVault();
|
|
3195
3221
|
return useMemo(() => createStylesHelper(vault), [vault]);
|
|
3196
3222
|
}
|
|
3197
|
-
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 };
|
|
3223
|
+
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 };
|
|
3198
3224
|
//# sourceMappingURL=index.mjs.map
|