@canopy-iiif/app 1.10.6 → 1.10.8
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/lib/build/iiif.js +41 -0
- package/lib/orchestrator.js +10 -0
- package/package.json +1 -1
- package/ui/dist/index.mjs +1 -1
- package/ui/dist/index.mjs.map +1 -1
package/lib/build/iiif.js
CHANGED
|
@@ -1861,6 +1861,47 @@ async function buildIiifCollectionPages(CONFIG) {
|
|
|
1861
1861
|
await gatherFromCollection(entry.raw || entryId, collectionKey);
|
|
1862
1862
|
}
|
|
1863
1863
|
}
|
|
1864
|
+
// Handle IIIF Presentation 2 paged collections (first/next pattern).
|
|
1865
|
+
// The root of a paged v2 collection carries a `first` link instead of
|
|
1866
|
+
// embedding items; each page carries a `next` link to the following page.
|
|
1867
|
+
const resolvePageUrl = (val) => {
|
|
1868
|
+
if (!val) return "";
|
|
1869
|
+
if (typeof val === "string") return val.trim();
|
|
1870
|
+
const id = val["@id"] || val.id;
|
|
1871
|
+
return typeof id === "string" ? id.trim() : "";
|
|
1872
|
+
};
|
|
1873
|
+
// Start from `first` if present (root collection), otherwise `next` (current is a page).
|
|
1874
|
+
let pageUrl =
|
|
1875
|
+
resolvePageUrl(col && col.first) ||
|
|
1876
|
+
resolvePageUrl(ncol && ncol.first) ||
|
|
1877
|
+
resolvePageUrl(col && col.next) ||
|
|
1878
|
+
resolvePageUrl(ncol && ncol.next);
|
|
1879
|
+
while (pageUrl) {
|
|
1880
|
+
const pageKey = norm(pageUrl) || pageUrl;
|
|
1881
|
+
if (visitedCollections.has(pageKey)) break;
|
|
1882
|
+
visitedCollections.add(pageKey);
|
|
1883
|
+
const page = await readJsonFromUri(pageUrl, {log: true});
|
|
1884
|
+
if (!page) break;
|
|
1885
|
+
const npage = await upgradeIiifResource(page);
|
|
1886
|
+
const pageEntries = extractCollectionEntries(npage);
|
|
1887
|
+
for (const entry of pageEntries) {
|
|
1888
|
+
const entryId = entry && entry.id;
|
|
1889
|
+
if (!entryId) continue;
|
|
1890
|
+
const entryType = normalizeIiifType(entry.type || entry.fallback || "");
|
|
1891
|
+
const dedupeKey = norm(entryId) || String(entryId || "");
|
|
1892
|
+
if (!dedupeKey) continue;
|
|
1893
|
+
if (entryType === "manifest") {
|
|
1894
|
+
if (queuedManifestIds.has(dedupeKey)) continue;
|
|
1895
|
+
queuedManifestIds.add(dedupeKey);
|
|
1896
|
+
tasks.push({id: entryId, parent: collectionKey});
|
|
1897
|
+
manifestTasksFromCollections += 1;
|
|
1898
|
+
} else if (entryType === "collection") {
|
|
1899
|
+
await gatherFromCollection(entry.raw || entryId, collectionKey);
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
// Advance to the next page.
|
|
1903
|
+
pageUrl = resolvePageUrl((page && page.next) || (npage && npage.next));
|
|
1904
|
+
}
|
|
1864
1905
|
// Traverse strictly by parent/child hierarchy (Presentation 3): items → Manifest or Collection
|
|
1865
1906
|
} catch (_) {}
|
|
1866
1907
|
}
|
package/lib/orchestrator.js
CHANGED
|
@@ -185,6 +185,7 @@ async function orchestrate(options = {}) {
|
|
|
185
185
|
await prepareUi(mode, env);
|
|
186
186
|
|
|
187
187
|
const api = loadLibraryApi();
|
|
188
|
+
let exitAfterBuild = false;
|
|
188
189
|
try {
|
|
189
190
|
if (mode === 'dev') {
|
|
190
191
|
attachSignalHandlers();
|
|
@@ -196,12 +197,21 @@ async function orchestrate(options = {}) {
|
|
|
196
197
|
await api.build();
|
|
197
198
|
}
|
|
198
199
|
log('Build complete');
|
|
200
|
+
exitAfterBuild = true;
|
|
199
201
|
}
|
|
200
202
|
} finally {
|
|
201
203
|
if (uiWatcherChild && !uiWatcherChild.killed) {
|
|
202
204
|
try { uiWatcherChild.kill(); } catch (_) {}
|
|
203
205
|
}
|
|
204
206
|
}
|
|
207
|
+
|
|
208
|
+
if (exitAfterBuild) {
|
|
209
|
+
try {
|
|
210
|
+
if (!process.exitCode || process.exitCode === 0) process.exit(0);
|
|
211
|
+
} catch (_) {
|
|
212
|
+
process.exit(0);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
205
215
|
}
|
|
206
216
|
|
|
207
217
|
module.exports = {
|
package/package.json
CHANGED
package/ui/dist/index.mjs
CHANGED
|
@@ -47582,7 +47582,7 @@ function buildClusterOptions(leaflet, maxClusterRadius) {
|
|
|
47582
47582
|
const anchor = CUSTOM_MARKER_RADIUS;
|
|
47583
47583
|
return {
|
|
47584
47584
|
chunkedLoading: true,
|
|
47585
|
-
maxClusterRadius: typeof maxClusterRadius === "number" ? maxClusterRadius :
|
|
47585
|
+
maxClusterRadius: typeof maxClusterRadius === "number" ? maxClusterRadius : 160,
|
|
47586
47586
|
iconCreateFunction: (cluster) => {
|
|
47587
47587
|
const count = cluster && typeof cluster.getChildCount === "function" ? cluster.getChildCount() : 0;
|
|
47588
47588
|
return leaflet.divIcon({
|