@canopy-iiif/app 1.5.0 → 1.5.2
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/package.json +1 -1
- package/ui/styles/base/_markdown.scss +6 -0
- package/ui/styles/index.css +6 -0
package/lib/build/iiif.js
CHANGED
|
@@ -711,6 +711,15 @@ const MEMO_ID_TO_SLUG = new Map();
|
|
|
711
711
|
// collections/manifests share the same base title but mappings aren't yet saved.
|
|
712
712
|
const RESERVED_SLUGS = {Manifest: new Set(), Collection: new Set()};
|
|
713
713
|
|
|
714
|
+
function resetReservedSlugs() {
|
|
715
|
+
try {
|
|
716
|
+
Object.keys(RESERVED_SLUGS).forEach((key) => {
|
|
717
|
+
const set = RESERVED_SLUGS[key];
|
|
718
|
+
if (set && typeof set.clear === "function") set.clear();
|
|
719
|
+
});
|
|
720
|
+
} catch (_) {}
|
|
721
|
+
}
|
|
722
|
+
|
|
714
723
|
function computeUniqueSlug(index, baseSlug, id, type) {
|
|
715
724
|
const byId = Array.isArray(index && index.byId) ? index.byId : [];
|
|
716
725
|
const normId = normalizeIiifId(String(id || ""));
|
|
@@ -2186,6 +2195,38 @@ module.exports = {
|
|
|
2186
2195
|
rebuildManifestIndexFromCache,
|
|
2187
2196
|
};
|
|
2188
2197
|
|
|
2198
|
+
// Expose a stable set of pure helper utilities for unit testing.
|
|
2199
|
+
module.exports.__TESTING__ = {
|
|
2200
|
+
resolvePositiveInteger,
|
|
2201
|
+
formatDurationMs,
|
|
2202
|
+
resolveBoolean,
|
|
2203
|
+
normalizeCollectionUris,
|
|
2204
|
+
clampSlugLength,
|
|
2205
|
+
isSlugTooLong,
|
|
2206
|
+
normalizeSlugBase,
|
|
2207
|
+
buildSlugWithSuffix,
|
|
2208
|
+
normalizeStringList,
|
|
2209
|
+
ensureThumbnailValue,
|
|
2210
|
+
extractSummaryValues,
|
|
2211
|
+
truncateSummary,
|
|
2212
|
+
extractMetadataValues,
|
|
2213
|
+
extractAnnotationText,
|
|
2214
|
+
normalizeIiifId,
|
|
2215
|
+
normalizeIiifType,
|
|
2216
|
+
resolveParentFromPartOf,
|
|
2217
|
+
computeUniqueSlug,
|
|
2218
|
+
ensureBaseSlugFor,
|
|
2219
|
+
resetReservedSlugs,
|
|
2220
|
+
resolveThumbnailPreferences,
|
|
2221
|
+
loadManifestIndex,
|
|
2222
|
+
saveManifestIndex,
|
|
2223
|
+
paths: {
|
|
2224
|
+
IIIF_CACHE_INDEX,
|
|
2225
|
+
IIIF_CACHE_INDEX_LEGACY,
|
|
2226
|
+
IIIF_CACHE_INDEX_MANIFESTS,
|
|
2227
|
+
},
|
|
2228
|
+
};
|
|
2229
|
+
|
|
2189
2230
|
// Debug: list collections cache after traversal
|
|
2190
2231
|
try {
|
|
2191
2232
|
if (process.env.CANOPY_IIIF_DEBUG === "1") {
|
package/package.json
CHANGED
package/ui/styles/index.css
CHANGED