react-iiif-vault 0.9.18 → 0.9.19
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/usePaintables.d.ts +1 -0
- package/.build/types/hooks/usePaintingAnnotations.d.ts +1 -0
- package/.build/types/hooks/useRenderingStrategy.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 +9 -2
- 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 +20 -20
- 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 +9 -2
- package/dist/react17/esm/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1303,8 +1303,11 @@ function getPaintables(vault, paintingAnnotations, enabledChoices) {
|
|
|
1303
1303
|
let choice = null;
|
|
1304
1304
|
const items = [];
|
|
1305
1305
|
for (const annotation of paintingAnnotations) {
|
|
1306
|
-
const bodies = vault.get(annotation.body);
|
|
1306
|
+
const bodies = vault.get(annotation.body, { skipSelfReturn: false });
|
|
1307
1307
|
for (const unknownBody of bodies) {
|
|
1308
|
+
if (!unknownBody) {
|
|
1309
|
+
continue;
|
|
1310
|
+
}
|
|
1308
1311
|
const [body, { selector }] = parseSpecificResource(unknownBody);
|
|
1309
1312
|
const type = (body.type || "unknown").toLowerCase();
|
|
1310
1313
|
if (type === "choice") {
|
|
@@ -1560,11 +1563,15 @@ function useLoadImageService() {
|
|
|
1560
1563
|
return [loadImageService, imageServiceStatus];
|
|
1561
1564
|
}
|
|
1562
1565
|
function usePaintingAnnotations(options = {}) {
|
|
1566
|
+
const annotation = useAnnotation();
|
|
1563
1567
|
const canvas = useCanvas(options.canvasId ? { id: options.canvasId } : void 0);
|
|
1564
1568
|
return useVaultSelector((state, vault) => {
|
|
1565
1569
|
if (!canvas) {
|
|
1566
1570
|
return [];
|
|
1567
1571
|
}
|
|
1572
|
+
if (annotation && options.enableSingleAnnotation) {
|
|
1573
|
+
return [annotation];
|
|
1574
|
+
}
|
|
1568
1575
|
const annotationPages = vault.get(canvas.items);
|
|
1569
1576
|
const flatAnnotations = [];
|
|
1570
1577
|
for (const page of annotationPages) {
|
|
@@ -1575,7 +1582,7 @@ function usePaintingAnnotations(options = {}) {
|
|
|
1575
1582
|
}
|
|
1576
1583
|
function usePaintables(options, deps = []) {
|
|
1577
1584
|
const vault = useVault();
|
|
1578
|
-
const paintingAnnotations = usePaintingAnnotations();
|
|
1585
|
+
const paintingAnnotations = usePaintingAnnotations({ enableSingleAnnotation: options == null ? void 0 : options.enableSingleAnnotation });
|
|
1579
1586
|
const [enabledChoices, setEnabledChoices] = useState((options == null ? void 0 : options.defaultChoices) || []);
|
|
1580
1587
|
const paintables = useMemo(() => getPaintables(vault, paintingAnnotations, enabledChoices), [vault, paintingAnnotations, enabledChoices, ...deps]);
|
|
1581
1588
|
const makeChoice = useCallback((id, { deselectOthers = true, deselect = false } = {}) => {
|