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
|
@@ -1308,8 +1308,11 @@ function getPaintables(vault, paintingAnnotations, enabledChoices) {
|
|
|
1308
1308
|
let choice = null;
|
|
1309
1309
|
const items = [];
|
|
1310
1310
|
for (const annotation of paintingAnnotations) {
|
|
1311
|
-
const bodies = vault.get(annotation.body);
|
|
1311
|
+
const bodies = vault.get(annotation.body, { skipSelfReturn: false });
|
|
1312
1312
|
for (const unknownBody of bodies) {
|
|
1313
|
+
if (!unknownBody) {
|
|
1314
|
+
continue;
|
|
1315
|
+
}
|
|
1313
1316
|
const [body, { selector }] = parseSpecificResource(unknownBody);
|
|
1314
1317
|
const type = (body.type || "unknown").toLowerCase();
|
|
1315
1318
|
if (type === "choice") {
|
|
@@ -1565,11 +1568,15 @@ function useLoadImageService() {
|
|
|
1565
1568
|
return [loadImageService, imageServiceStatus];
|
|
1566
1569
|
}
|
|
1567
1570
|
function usePaintingAnnotations(options = {}) {
|
|
1571
|
+
const annotation = useAnnotation();
|
|
1568
1572
|
const canvas = useCanvas(options.canvasId ? { id: options.canvasId } : void 0);
|
|
1569
1573
|
return useVaultSelector((state, vault) => {
|
|
1570
1574
|
if (!canvas) {
|
|
1571
1575
|
return [];
|
|
1572
1576
|
}
|
|
1577
|
+
if (annotation && options.enableSingleAnnotation) {
|
|
1578
|
+
return [annotation];
|
|
1579
|
+
}
|
|
1573
1580
|
const annotationPages = vault.get(canvas.items);
|
|
1574
1581
|
const flatAnnotations = [];
|
|
1575
1582
|
for (const page of annotationPages) {
|
|
@@ -1580,7 +1587,7 @@ function usePaintingAnnotations(options = {}) {
|
|
|
1580
1587
|
}
|
|
1581
1588
|
function usePaintables(options, deps = []) {
|
|
1582
1589
|
const vault = useVault();
|
|
1583
|
-
const paintingAnnotations = usePaintingAnnotations();
|
|
1590
|
+
const paintingAnnotations = usePaintingAnnotations({ enableSingleAnnotation: options == null ? void 0 : options.enableSingleAnnotation });
|
|
1584
1591
|
const [enabledChoices, setEnabledChoices] = useState((options == null ? void 0 : options.defaultChoices) || []);
|
|
1585
1592
|
const paintables = useMemo(() => getPaintables(vault, paintingAnnotations, enabledChoices), [vault, paintingAnnotations, enabledChoices, ...deps]);
|
|
1586
1593
|
const makeChoice = useCallback((id, { deselectOthers = true, deselect = false } = {}) => {
|