@canopy-iiif/app 0.8.6 → 0.9.0
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/AGENTS.md +5 -0
- package/lib/build/build.js +2 -13
- package/lib/build/dev.js +9 -2
- package/lib/build/iiif.js +6 -7
- package/lib/build/mdx.js +21 -57
- package/lib/build/pages.js +7 -1
- package/lib/build/runtimes.js +1 -5
- package/lib/components/hero-slider-runtime.js +78 -0
- package/lib/orchestrator.js +0 -30
- package/package.json +1 -1
- package/types/orchestrator.d.ts +0 -1
- package/ui/dist/server.mjs +241 -132
- package/ui/dist/server.mjs.map +4 -4
- package/ui/styles/components/_buttons.scss +50 -0
- package/ui/styles/components/_interstitial-hero.scss +411 -0
- package/ui/styles/components/index.scss +2 -1
- package/ui/styles/index.css +364 -22
- package/ui/theme.js +41 -5
- package/lib/build/verify.js +0 -60
- package/ui/styles/components/_hero.scss +0 -21
package/ui/dist/server.mjs
CHANGED
|
@@ -1,41 +1,8 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
5
|
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// ui/src/iiif/hero-utils.js
|
|
28
|
-
var require_hero_utils = __commonJS({
|
|
29
|
-
"ui/src/iiif/hero-utils.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
function computeHeroHeightStyle2(height) {
|
|
32
|
-
const h = typeof height === "number" ? `${height}px` : String(height || "").trim();
|
|
33
|
-
const val = h || "360px";
|
|
34
|
-
return { width: "100%", height: val };
|
|
35
|
-
}
|
|
36
|
-
module.exports = { computeHeroHeightStyle: computeHeroHeightStyle2 };
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
6
|
|
|
40
7
|
// ui/src/HelloWorld.jsx
|
|
41
8
|
import React from "react";
|
|
@@ -198,10 +165,25 @@ function MdxRelatedItems(props) {
|
|
|
198
165
|
return /* @__PURE__ */ React5.createElement("div", { "data-canopy-related-items": "1", className: "not-prose" }, /* @__PURE__ */ React5.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
|
|
199
166
|
}
|
|
200
167
|
|
|
201
|
-
// ui/src/
|
|
202
|
-
var
|
|
168
|
+
// ui/src/interstitials/index.js
|
|
169
|
+
var interstitials_exports = {};
|
|
170
|
+
__export(interstitials_exports, {
|
|
171
|
+
Hero: () => Hero,
|
|
172
|
+
computeHeroHeightStyle: () => computeHeroHeightStyle
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// ui/src/interstitials/Hero.jsx
|
|
203
176
|
import React6 from "react";
|
|
204
177
|
import helpers from "@canopy-iiif/app/lib/components/featured.js";
|
|
178
|
+
|
|
179
|
+
// ui/src/interstitials/hero-utils.js
|
|
180
|
+
function computeHeroHeightStyle(height) {
|
|
181
|
+
const h = typeof height === "number" ? `${height}px` : String(height || "").trim();
|
|
182
|
+
const val = h || "360px";
|
|
183
|
+
return { width: "100%", height: val };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// ui/src/interstitials/Hero.jsx
|
|
205
187
|
var basePath = (() => {
|
|
206
188
|
try {
|
|
207
189
|
const raw = typeof process !== "undefined" && process && process.env ? String(process.env.CANOPY_BASE_PATH || "") : "";
|
|
@@ -221,68 +203,196 @@ function applyBasePath(href) {
|
|
|
221
203
|
}
|
|
222
204
|
return href;
|
|
223
205
|
}
|
|
206
|
+
function resolveFeaturedItem({ item, index, random }) {
|
|
207
|
+
if (item) return item;
|
|
208
|
+
const list = helpers && helpers.readFeaturedFromCacheSync ? helpers.readFeaturedFromCacheSync() : [];
|
|
209
|
+
if (!list.length) return null;
|
|
210
|
+
if (typeof index === "number") {
|
|
211
|
+
const idx = Math.max(0, Math.min(list.length - 1, Math.floor(index)));
|
|
212
|
+
return list[idx];
|
|
213
|
+
}
|
|
214
|
+
if (random === true || random === "true") {
|
|
215
|
+
const idx = Math.floor(Math.random() * Math.max(1, list.length));
|
|
216
|
+
return list[idx];
|
|
217
|
+
}
|
|
218
|
+
return list[0];
|
|
219
|
+
}
|
|
220
|
+
function normalizeLinks(links) {
|
|
221
|
+
if (!Array.isArray(links)) return [];
|
|
222
|
+
return links.map((link) => {
|
|
223
|
+
if (!link) return null;
|
|
224
|
+
const href = applyBasePath(link.href || "");
|
|
225
|
+
const title = link.title ? String(link.title) : "";
|
|
226
|
+
if (!href || !title) return null;
|
|
227
|
+
const type = link.type === "secondary" ? "secondary" : "primary";
|
|
228
|
+
return { href, title, type };
|
|
229
|
+
}).filter(Boolean);
|
|
230
|
+
}
|
|
231
|
+
function sanitizeRest(rest) {
|
|
232
|
+
const clone = { ...rest };
|
|
233
|
+
try {
|
|
234
|
+
delete clone.random;
|
|
235
|
+
delete clone.index;
|
|
236
|
+
delete clone.item;
|
|
237
|
+
delete clone.links;
|
|
238
|
+
delete clone.overlay;
|
|
239
|
+
delete clone.variant;
|
|
240
|
+
delete clone.background;
|
|
241
|
+
} catch (_) {
|
|
242
|
+
}
|
|
243
|
+
return clone;
|
|
244
|
+
}
|
|
245
|
+
function normalizeBackground(value) {
|
|
246
|
+
try {
|
|
247
|
+
const allowed = /* @__PURE__ */ new Set(["theme", "transparent"]);
|
|
248
|
+
const raw = value == null ? "" : String(value);
|
|
249
|
+
const normalized = raw.trim().toLowerCase();
|
|
250
|
+
return allowed.has(normalized) ? normalized : "theme";
|
|
251
|
+
} catch (_) {
|
|
252
|
+
return "theme";
|
|
253
|
+
}
|
|
254
|
+
}
|
|
224
255
|
function Hero({
|
|
225
|
-
height =
|
|
256
|
+
height = 520,
|
|
226
257
|
item,
|
|
227
258
|
index,
|
|
228
|
-
random,
|
|
259
|
+
random = true,
|
|
260
|
+
headline,
|
|
261
|
+
description,
|
|
262
|
+
links = [],
|
|
229
263
|
className = "",
|
|
230
264
|
style = {},
|
|
265
|
+
background = "theme",
|
|
231
266
|
...rest
|
|
232
267
|
}) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
268
|
+
const resolved = resolveFeaturedItem({ item, index, random });
|
|
269
|
+
const helpersList = helpers && helpers.readFeaturedFromCacheSync ? helpers.readFeaturedFromCacheSync() : [];
|
|
270
|
+
const slides = [];
|
|
271
|
+
const pushUnique = (entry) => {
|
|
272
|
+
if (!entry) return;
|
|
273
|
+
const key = String(entry.href || entry.id || entry.title || "");
|
|
274
|
+
const hasKey = slides.some(
|
|
275
|
+
(item2) => String(item2 && (item2.href || item2.id || item2.title || "")) === key
|
|
276
|
+
);
|
|
277
|
+
if (!hasKey) {
|
|
278
|
+
slides.push(entry);
|
|
241
279
|
}
|
|
242
|
-
resolved = list[idx] || list[0] || null;
|
|
243
|
-
}
|
|
244
|
-
const hStyle = (0, import_hero_utils.computeHeroHeightStyle)(height);
|
|
245
|
-
const title = resolved && resolved.title || "";
|
|
246
|
-
const href = resolved && resolved.href || "#";
|
|
247
|
-
const thumbnail = resolved && resolved.thumbnail || "";
|
|
248
|
-
const mediaStyles = {
|
|
249
|
-
position: "relative",
|
|
250
|
-
...hStyle,
|
|
251
|
-
overflow: "hidden",
|
|
252
|
-
backgroundColor: "var(--color-gray-muted)"
|
|
253
280
|
};
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
281
|
+
if (resolved) pushUnique(resolved);
|
|
282
|
+
helpersList.forEach(pushUnique);
|
|
283
|
+
if (!slides.length) return null;
|
|
284
|
+
let orderedSlides = slides.slice();
|
|
285
|
+
if (typeof index === "number" && orderedSlides.length > 1) {
|
|
286
|
+
const clamp = Math.max(
|
|
287
|
+
0,
|
|
288
|
+
Math.min(orderedSlides.length - 1, Math.floor(index))
|
|
289
|
+
);
|
|
290
|
+
if (clamp > 0) {
|
|
291
|
+
orderedSlides = orderedSlides.slice(clamp).concat(orderedSlides.slice(0, clamp));
|
|
292
|
+
}
|
|
293
|
+
} else if (random === true || random === "true") {
|
|
294
|
+
const rand = Math.floor(Math.random() * orderedSlides.length);
|
|
295
|
+
if (rand > 0) {
|
|
296
|
+
orderedSlides = orderedSlides.slice(rand).concat(orderedSlides.slice(0, rand));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
const heroHeight = computeHeroHeightStyle(height);
|
|
300
|
+
const heroStyles = { ...style || {} };
|
|
301
|
+
if (heroHeight && heroHeight.height) {
|
|
302
|
+
heroStyles["--hero-height"] = heroHeight.height;
|
|
303
|
+
}
|
|
304
|
+
const derivedDescription = description ? String(description) : "";
|
|
305
|
+
const normalizedLinks = normalizeLinks(links);
|
|
306
|
+
const primarySlide = orderedSlides[0] || null;
|
|
307
|
+
const overlayTitle = headline || primarySlide && primarySlide.title || "";
|
|
308
|
+
const defaultLinkHref = applyBasePath(
|
|
309
|
+
primarySlide && primarySlide.href ? primarySlide.href : "#"
|
|
310
|
+
);
|
|
311
|
+
const overlayLinks = normalizedLinks.length ? normalizedLinks : [
|
|
312
|
+
{
|
|
313
|
+
href: defaultLinkHref,
|
|
314
|
+
title: "View work",
|
|
315
|
+
type: "primary"
|
|
316
|
+
}
|
|
317
|
+
];
|
|
318
|
+
const normalizedBackground = normalizeBackground(background);
|
|
319
|
+
const backgroundClassName = normalizedBackground === "transparent" ? "canopy-interstitial--bg-transparent" : "";
|
|
320
|
+
const containerClassName = [
|
|
321
|
+
"canopy-interstitial",
|
|
322
|
+
"canopy-interstitial--hero",
|
|
323
|
+
backgroundClassName,
|
|
324
|
+
className
|
|
325
|
+
].filter(Boolean).join(" ");
|
|
326
|
+
const renderSlide = (slide, idx, { showVeil = true, captionVariant = "overlay" } = {}) => {
|
|
327
|
+
const safeHref = applyBasePath(slide.href || "#");
|
|
328
|
+
const isStaticCaption = captionVariant === "static";
|
|
329
|
+
const paneClassName = [
|
|
330
|
+
"canopy-interstitial__pane",
|
|
331
|
+
showVeil ? "" : "canopy-interstitial__pane--flat",
|
|
332
|
+
isStaticCaption ? "canopy-interstitial__pane--static" : ""
|
|
333
|
+
].filter(Boolean).join(" ");
|
|
334
|
+
if (isStaticCaption) {
|
|
335
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "swiper-slide", key: safeHref || idx }, /* @__PURE__ */ React6.createElement("article", { className: paneClassName }, slide.thumbnail ? /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__media-frame" }, /* @__PURE__ */ React6.createElement(
|
|
336
|
+
"img",
|
|
337
|
+
{
|
|
338
|
+
src: slide.thumbnail,
|
|
339
|
+
alt: "",
|
|
340
|
+
"aria-hidden": "true",
|
|
341
|
+
className: "canopy-interstitial__media canopy-interstitial__media--static",
|
|
342
|
+
loading: idx === 0 ? "eager" : "lazy"
|
|
343
|
+
}
|
|
344
|
+
)) : null, slide.title ? /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__caption canopy-interstitial__caption--static" }, /* @__PURE__ */ React6.createElement("a", { href: safeHref, className: "canopy-interstitial__caption-link" }, slide.title)) : null));
|
|
345
|
+
}
|
|
346
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "swiper-slide", key: safeHref || idx }, /* @__PURE__ */ React6.createElement("article", { className: paneClassName }, slide.thumbnail ? /* @__PURE__ */ React6.createElement(
|
|
347
|
+
"img",
|
|
348
|
+
{
|
|
349
|
+
src: slide.thumbnail,
|
|
350
|
+
alt: "",
|
|
351
|
+
"aria-hidden": "true",
|
|
352
|
+
className: "canopy-interstitial__media",
|
|
353
|
+
loading: idx === 0 ? "eager" : "lazy"
|
|
354
|
+
}
|
|
355
|
+
) : null, showVeil ? /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__veil", "aria-hidden": "true" }) : null, slide.title ? /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__caption" }, /* @__PURE__ */ React6.createElement("a", { href: safeHref, className: "canopy-interstitial__caption-link" }, slide.title)) : null));
|
|
262
356
|
};
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
357
|
+
const renderSlider = (options = {}) => /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__slider swiper" }, /* @__PURE__ */ React6.createElement("div", { className: "swiper-wrapper" }, orderedSlides.map((slide, idx) => renderSlide(slide, idx, options))), /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__nav" }, /* @__PURE__ */ React6.createElement(
|
|
358
|
+
"button",
|
|
359
|
+
{
|
|
360
|
+
type: "button",
|
|
361
|
+
"aria-label": "Previous slide",
|
|
362
|
+
className: "canopy-interstitial__nav-btn canopy-interstitial__nav-btn--prev swiper-button-prev"
|
|
269
363
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
364
|
+
), /* @__PURE__ */ React6.createElement(
|
|
365
|
+
"button",
|
|
366
|
+
{
|
|
367
|
+
type: "button",
|
|
368
|
+
"aria-label": "Next slide",
|
|
369
|
+
className: "canopy-interstitial__nav-btn canopy-interstitial__nav-btn--next swiper-button-next"
|
|
370
|
+
}
|
|
371
|
+
)), /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__pagination swiper-pagination" }));
|
|
372
|
+
const overlayContent = /* @__PURE__ */ React6.createElement(React6.Fragment, null, overlayTitle ? /* @__PURE__ */ React6.createElement("h1", { className: "canopy-interstitial__headline" }, overlayTitle) : null, derivedDescription ? /* @__PURE__ */ React6.createElement("p", { className: "canopy-interstitial__description" }, derivedDescription) : null, overlayLinks.length ? /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__actions" }, overlayLinks.map((link) => /* @__PURE__ */ React6.createElement(
|
|
373
|
+
"a",
|
|
374
|
+
{
|
|
375
|
+
key: `${link.href}-${link.title}`,
|
|
376
|
+
href: link.href,
|
|
377
|
+
className: link.type === "secondary" ? "canopy-button canopy-button--secondary" : "canopy-button canopy-button--primary"
|
|
378
|
+
},
|
|
379
|
+
link.title
|
|
380
|
+
))) : null);
|
|
381
|
+
const cleanedProps = sanitizeRest(rest);
|
|
382
|
+
return /* @__PURE__ */ React6.createElement(
|
|
383
|
+
"section",
|
|
384
|
+
{
|
|
385
|
+
className: containerClassName,
|
|
386
|
+
"data-canopy-hero-slider": "1",
|
|
387
|
+
style: heroStyles,
|
|
388
|
+
...cleanedProps
|
|
389
|
+
},
|
|
390
|
+
/* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__layout" }, /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__panel" }, /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__body" }, overlayContent)), /* @__PURE__ */ React6.createElement("div", { className: "canopy-interstitial__media-group" }, renderSlider({ showVeil: false, captionVariant: "static" })))
|
|
391
|
+
);
|
|
282
392
|
}
|
|
283
393
|
|
|
284
394
|
// ui/src/layout/SubNavigation.jsx
|
|
285
|
-
import
|
|
395
|
+
import React7 from "react";
|
|
286
396
|
import navigationHelpers from "@canopy-iiif/app/lib/components/navigation.js";
|
|
287
397
|
function resolveRelativeCandidate(page, current) {
|
|
288
398
|
if (page && typeof page.relativePath === "string" && page.relativePath) return page.relativePath;
|
|
@@ -307,14 +417,14 @@ function renderNodes(nodes, parentKey = "node") {
|
|
|
307
417
|
if (node.isActive) classes.push("is-active");
|
|
308
418
|
const linkClass = classes.join(" ");
|
|
309
419
|
const Tag = node.href ? "a" : "span";
|
|
310
|
-
return /* @__PURE__ */
|
|
420
|
+
return /* @__PURE__ */ React7.createElement(
|
|
311
421
|
"li",
|
|
312
422
|
{
|
|
313
423
|
key,
|
|
314
424
|
className: "canopy-sub-navigation__item",
|
|
315
425
|
"data-depth": depth
|
|
316
426
|
},
|
|
317
|
-
/* @__PURE__ */
|
|
427
|
+
/* @__PURE__ */ React7.createElement(
|
|
318
428
|
Tag,
|
|
319
429
|
{
|
|
320
430
|
className: linkClass,
|
|
@@ -323,7 +433,7 @@ function renderNodes(nodes, parentKey = "node") {
|
|
|
323
433
|
},
|
|
324
434
|
node.title || node.slug
|
|
325
435
|
),
|
|
326
|
-
showChildren ? /* @__PURE__ */
|
|
436
|
+
showChildren ? /* @__PURE__ */ React7.createElement("ul", { className: "canopy-sub-navigation__list canopy-sub-navigation__list--nested", role: "list" }, renderNodes(node.children, key)) : null
|
|
327
437
|
);
|
|
328
438
|
});
|
|
329
439
|
}
|
|
@@ -337,12 +447,12 @@ function SubNavigation({
|
|
|
337
447
|
ariaLabel
|
|
338
448
|
}) {
|
|
339
449
|
const PageContext = navigationHelpers && navigationHelpers.getPageContext ? navigationHelpers.getPageContext() : null;
|
|
340
|
-
const context = PageContext ?
|
|
450
|
+
const context = PageContext ? React7.useContext(PageContext) : null;
|
|
341
451
|
const contextNavigation = context && context.navigation ? context.navigation : null;
|
|
342
452
|
const contextPage = context && context.page ? context.page : null;
|
|
343
453
|
const effectiveNavigation = navigationProp || contextNavigation;
|
|
344
454
|
const effectivePage = page || contextPage;
|
|
345
|
-
const resolvedNavigation =
|
|
455
|
+
const resolvedNavigation = React7.useMemo(() => {
|
|
346
456
|
if (effectiveNavigation && effectiveNavigation.root) return effectiveNavigation;
|
|
347
457
|
const candidate = resolveRelativeCandidate(effectivePage, current);
|
|
348
458
|
if (!candidate) return effectiveNavigation || null;
|
|
@@ -366,11 +476,11 @@ function SubNavigation({
|
|
|
366
476
|
if (!Object.prototype.hasOwnProperty.call(inlineStyle, "--sub-nav-indent")) {
|
|
367
477
|
inlineStyle["--sub-nav-indent"] = "0.85rem";
|
|
368
478
|
}
|
|
369
|
-
return /* @__PURE__ */
|
|
479
|
+
return /* @__PURE__ */ React7.createElement("nav", { className: combinedClassName, style: inlineStyle, "aria-label": navLabel }, finalHeading ? /* @__PURE__ */ React7.createElement("div", { className: "canopy-sub-navigation__heading" }, finalHeading) : null, /* @__PURE__ */ React7.createElement("ul", { className: "canopy-sub-navigation__list", role: "list" }, renderNodes([rootNode], rootNode.slug || "root")));
|
|
370
480
|
}
|
|
371
481
|
|
|
372
482
|
// ui/src/search/MdxSearchResults.jsx
|
|
373
|
-
import
|
|
483
|
+
import React8 from "react";
|
|
374
484
|
function MdxSearchResults(props) {
|
|
375
485
|
let json = "{}";
|
|
376
486
|
try {
|
|
@@ -378,11 +488,11 @@ function MdxSearchResults(props) {
|
|
|
378
488
|
} catch (_) {
|
|
379
489
|
json = "{}";
|
|
380
490
|
}
|
|
381
|
-
return /* @__PURE__ */
|
|
491
|
+
return /* @__PURE__ */ React8.createElement("div", { "data-canopy-search-results": "1" }, /* @__PURE__ */ React8.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
|
|
382
492
|
}
|
|
383
493
|
|
|
384
494
|
// ui/src/search/SearchSummary.jsx
|
|
385
|
-
import
|
|
495
|
+
import React9 from "react";
|
|
386
496
|
function SearchSummary(props) {
|
|
387
497
|
let json = "{}";
|
|
388
498
|
try {
|
|
@@ -390,11 +500,11 @@ function SearchSummary(props) {
|
|
|
390
500
|
} catch (_) {
|
|
391
501
|
json = "{}";
|
|
392
502
|
}
|
|
393
|
-
return /* @__PURE__ */
|
|
503
|
+
return /* @__PURE__ */ React9.createElement("div", { "data-canopy-search-summary": "1" }, /* @__PURE__ */ React9.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
|
|
394
504
|
}
|
|
395
505
|
|
|
396
506
|
// ui/src/search/MdxSearchTabs.jsx
|
|
397
|
-
import
|
|
507
|
+
import React10 from "react";
|
|
398
508
|
function MdxSearchTabs(props) {
|
|
399
509
|
let json = "{}";
|
|
400
510
|
try {
|
|
@@ -402,18 +512,18 @@ function MdxSearchTabs(props) {
|
|
|
402
512
|
} catch (_) {
|
|
403
513
|
json = "{}";
|
|
404
514
|
}
|
|
405
|
-
return /* @__PURE__ */
|
|
515
|
+
return /* @__PURE__ */ React10.createElement("div", { "data-canopy-search-tabs": "1" }, /* @__PURE__ */ React10.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
|
|
406
516
|
}
|
|
407
517
|
|
|
408
518
|
// ui/src/search-form/MdxSearchFormModal.jsx
|
|
409
|
-
import
|
|
519
|
+
import React14 from "react";
|
|
410
520
|
|
|
411
521
|
// ui/src/Icons.jsx
|
|
412
|
-
import
|
|
413
|
-
var MagnifyingGlassIcon = (props) => /* @__PURE__ */
|
|
522
|
+
import React11 from "react";
|
|
523
|
+
var MagnifyingGlassIcon = (props) => /* @__PURE__ */ React11.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", ...props }, /* @__PURE__ */ React11.createElement("path", { d: "M456.69 421.39L362.6 327.3a173.81 173.81 0 0034.84-104.58C397.44 126.38 319.06 48 222.72 48S48 126.38 48 222.72s78.38 174.72 174.72 174.72A173.81 173.81 0 00327.3 362.6l94.09 94.09a25 25 0 0035.3-35.3zM97.92 222.72a124.8 124.8 0 11124.8 124.8 124.95 124.95 0 01-124.8-124.8z" }));
|
|
414
524
|
|
|
415
525
|
// ui/src/search/SearchPanelForm.jsx
|
|
416
|
-
import
|
|
526
|
+
import React12 from "react";
|
|
417
527
|
function readBasePath() {
|
|
418
528
|
const normalize = (val) => {
|
|
419
529
|
const raw = typeof val === "string" ? val.trim() : "";
|
|
@@ -476,18 +586,18 @@ function SearchPanelForm(props = {}) {
|
|
|
476
586
|
clearLabel = "Clear search"
|
|
477
587
|
} = props || {};
|
|
478
588
|
const text = typeof label === "string" && label.trim() ? label.trim() : buttonLabel;
|
|
479
|
-
const action =
|
|
589
|
+
const action = React12.useMemo(
|
|
480
590
|
() => resolveSearchPath(searchPath),
|
|
481
591
|
[searchPath]
|
|
482
592
|
);
|
|
483
|
-
const autoId = typeof
|
|
484
|
-
const [fallbackId] =
|
|
593
|
+
const autoId = typeof React12.useId === "function" ? React12.useId() : void 0;
|
|
594
|
+
const [fallbackId] = React12.useState(
|
|
485
595
|
() => `canopy-search-form-${Math.random().toString(36).slice(2, 10)}`
|
|
486
596
|
);
|
|
487
597
|
const inputId = inputIdProp || autoId || fallbackId;
|
|
488
|
-
const inputRef =
|
|
489
|
-
const [hasValue, setHasValue] =
|
|
490
|
-
const focusInput =
|
|
598
|
+
const inputRef = React12.useRef(null);
|
|
599
|
+
const [hasValue, setHasValue] = React12.useState(false);
|
|
600
|
+
const focusInput = React12.useCallback(() => {
|
|
491
601
|
const el = inputRef.current;
|
|
492
602
|
if (!el) return;
|
|
493
603
|
if (document.activeElement === el) return;
|
|
@@ -500,7 +610,7 @@ function SearchPanelForm(props = {}) {
|
|
|
500
610
|
}
|
|
501
611
|
}
|
|
502
612
|
}, []);
|
|
503
|
-
const handlePointerDown =
|
|
613
|
+
const handlePointerDown = React12.useCallback(
|
|
504
614
|
(event) => {
|
|
505
615
|
const target = event.target;
|
|
506
616
|
if (target && typeof target.closest === "function") {
|
|
@@ -512,23 +622,23 @@ function SearchPanelForm(props = {}) {
|
|
|
512
622
|
},
|
|
513
623
|
[focusInput]
|
|
514
624
|
);
|
|
515
|
-
|
|
625
|
+
React12.useEffect(() => {
|
|
516
626
|
const el = inputRef.current;
|
|
517
627
|
if (!el) return;
|
|
518
628
|
if (el.value && el.value.trim()) {
|
|
519
629
|
setHasValue(true);
|
|
520
630
|
}
|
|
521
631
|
}, []);
|
|
522
|
-
const handleInputChange =
|
|
632
|
+
const handleInputChange = React12.useCallback((event) => {
|
|
523
633
|
var _a;
|
|
524
634
|
const nextHasValue = Boolean(
|
|
525
635
|
((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.value) && event.target.value.trim()
|
|
526
636
|
);
|
|
527
637
|
setHasValue(nextHasValue);
|
|
528
638
|
}, []);
|
|
529
|
-
const handleClear =
|
|
639
|
+
const handleClear = React12.useCallback((event) => {
|
|
530
640
|
}, []);
|
|
531
|
-
const handleClearKey =
|
|
641
|
+
const handleClearKey = React12.useCallback(
|
|
532
642
|
(event) => {
|
|
533
643
|
if (event.key === "Enter" || event.key === " ") {
|
|
534
644
|
event.preventDefault();
|
|
@@ -537,7 +647,7 @@ function SearchPanelForm(props = {}) {
|
|
|
537
647
|
},
|
|
538
648
|
[handleClear]
|
|
539
649
|
);
|
|
540
|
-
return /* @__PURE__ */
|
|
650
|
+
return /* @__PURE__ */ React12.createElement(
|
|
541
651
|
"form",
|
|
542
652
|
{
|
|
543
653
|
action,
|
|
@@ -549,7 +659,7 @@ function SearchPanelForm(props = {}) {
|
|
|
549
659
|
onPointerDown: handlePointerDown,
|
|
550
660
|
"data-has-value": hasValue ? "1" : "0"
|
|
551
661
|
},
|
|
552
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ React12.createElement("label", { htmlFor: inputId, className: "canopy-search-form__label" }, /* @__PURE__ */ React12.createElement(MagnifyingGlassIcon, { className: "canopy-search-form__icon" }), /* @__PURE__ */ React12.createElement(
|
|
553
663
|
"input",
|
|
554
664
|
{
|
|
555
665
|
id: inputId,
|
|
@@ -565,7 +675,7 @@ function SearchPanelForm(props = {}) {
|
|
|
565
675
|
onInput: handleInputChange
|
|
566
676
|
}
|
|
567
677
|
)),
|
|
568
|
-
hasValue ? /* @__PURE__ */
|
|
678
|
+
hasValue ? /* @__PURE__ */ React12.createElement(
|
|
569
679
|
"button",
|
|
570
680
|
{
|
|
571
681
|
type: "button",
|
|
@@ -578,32 +688,32 @@ function SearchPanelForm(props = {}) {
|
|
|
578
688
|
},
|
|
579
689
|
"\xD7"
|
|
580
690
|
) : null,
|
|
581
|
-
/* @__PURE__ */
|
|
691
|
+
/* @__PURE__ */ React12.createElement(
|
|
582
692
|
"button",
|
|
583
693
|
{
|
|
584
694
|
type: "submit",
|
|
585
695
|
"data-canopy-search-form-trigger": "submit",
|
|
586
696
|
className: "canopy-search-form__submit"
|
|
587
697
|
},
|
|
588
|
-
/* @__PURE__ */
|
|
589
|
-
/* @__PURE__ */
|
|
698
|
+
/* @__PURE__ */ React12.createElement("span", null, text),
|
|
699
|
+
/* @__PURE__ */ React12.createElement("span", { "aria-hidden": true, className: "canopy-search-form__shortcut" }, /* @__PURE__ */ React12.createElement("span", null, "\u2318"), /* @__PURE__ */ React12.createElement("span", null, "K"))
|
|
590
700
|
)
|
|
591
701
|
);
|
|
592
702
|
}
|
|
593
703
|
|
|
594
704
|
// ui/src/search/SearchPanelTeaserResults.jsx
|
|
595
|
-
import
|
|
705
|
+
import React13 from "react";
|
|
596
706
|
function SearchPanelTeaserResults(props = {}) {
|
|
597
707
|
const { style, className } = props || {};
|
|
598
708
|
const classes = ["canopy-search-teaser", className].filter(Boolean).join(" ");
|
|
599
|
-
return /* @__PURE__ */
|
|
709
|
+
return /* @__PURE__ */ React13.createElement(
|
|
600
710
|
"div",
|
|
601
711
|
{
|
|
602
712
|
"data-canopy-search-form-panel": true,
|
|
603
713
|
className: classes || void 0,
|
|
604
714
|
style
|
|
605
715
|
},
|
|
606
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ React13.createElement("div", { id: "cplist" })
|
|
607
717
|
);
|
|
608
718
|
}
|
|
609
719
|
|
|
@@ -623,11 +733,11 @@ function MdxSearchFormModal(props = {}) {
|
|
|
623
733
|
const text = typeof label === "string" && label.trim() ? label.trim() : buttonLabel;
|
|
624
734
|
const resolvedSearchPath = resolveSearchPath(searchPath);
|
|
625
735
|
const data = { placeholder, hotkey, maxResults, groupOrder, label: text, searchPath: resolvedSearchPath };
|
|
626
|
-
return /* @__PURE__ */
|
|
736
|
+
return /* @__PURE__ */ React14.createElement("div", { "data-canopy-search-form": true, className: "flex-1 min-w-0" }, /* @__PURE__ */ React14.createElement("div", { className: "relative w-full" }, /* @__PURE__ */ React14.createElement(SearchPanelForm, { placeholder, buttonLabel, label, searchPath: resolvedSearchPath }), /* @__PURE__ */ React14.createElement(SearchPanelTeaserResults, null)), /* @__PURE__ */ React14.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: JSON.stringify(data) } }));
|
|
627
737
|
}
|
|
628
738
|
|
|
629
739
|
// ui/src/search/SearchPanel.jsx
|
|
630
|
-
import
|
|
740
|
+
import React15 from "react";
|
|
631
741
|
function SearchPanel(props = {}) {
|
|
632
742
|
const {
|
|
633
743
|
placeholder = "Search\u2026",
|
|
@@ -644,11 +754,11 @@ function SearchPanel(props = {}) {
|
|
|
644
754
|
const text = typeof label === "string" && label.trim() ? label.trim() : buttonLabel;
|
|
645
755
|
const resolvedSearchPath = resolveSearchPath(searchPath);
|
|
646
756
|
const data = { placeholder, hotkey, maxResults, groupOrder, label: text, searchPath: resolvedSearchPath };
|
|
647
|
-
return /* @__PURE__ */
|
|
757
|
+
return /* @__PURE__ */ React15.createElement("div", { "data-canopy-search-form": true, className: "flex-1 min-w-0" }, /* @__PURE__ */ React15.createElement("div", { className: "relative w-full" }, /* @__PURE__ */ React15.createElement(SearchPanelForm, { placeholder, buttonLabel, label, searchPath: resolvedSearchPath }), /* @__PURE__ */ React15.createElement(SearchPanelTeaserResults, null)), /* @__PURE__ */ React15.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: JSON.stringify(data) } }));
|
|
648
758
|
}
|
|
649
759
|
|
|
650
760
|
// ui/src/iiif/ManifestPrimitives.jsx
|
|
651
|
-
import
|
|
761
|
+
import React16 from "react";
|
|
652
762
|
import {
|
|
653
763
|
Label as CloverLabel,
|
|
654
764
|
Metadata as CloverMetadata,
|
|
@@ -673,29 +783,28 @@ function ensureMetadata(items) {
|
|
|
673
783
|
function Label({ manifest, label, ...rest }) {
|
|
674
784
|
const intl = label || manifest && manifest.label;
|
|
675
785
|
if (!hasInternationalValue(intl)) return null;
|
|
676
|
-
return /* @__PURE__ */
|
|
786
|
+
return /* @__PURE__ */ React16.createElement(CloverLabel, { label: intl, ...rest });
|
|
677
787
|
}
|
|
678
788
|
function Summary({ manifest, summary, ...rest }) {
|
|
679
789
|
const intl = summary || manifest && manifest.summary;
|
|
680
790
|
if (!hasInternationalValue(intl)) return null;
|
|
681
|
-
return /* @__PURE__ */
|
|
791
|
+
return /* @__PURE__ */ React16.createElement(CloverSummary, { summary: intl, ...rest });
|
|
682
792
|
}
|
|
683
793
|
function Metadata({ manifest, metadata, ...rest }) {
|
|
684
794
|
const items = ensureMetadata(metadata || manifest && manifest.metadata);
|
|
685
795
|
if (!items.length) return null;
|
|
686
|
-
return /* @__PURE__ */
|
|
796
|
+
return /* @__PURE__ */ React16.createElement(CloverMetadata, { metadata: items, ...rest });
|
|
687
797
|
}
|
|
688
798
|
function RequiredStatement({ manifest, requiredStatement, ...rest }) {
|
|
689
799
|
const stmt = requiredStatement || manifest && manifest.requiredStatement;
|
|
690
800
|
if (!stmt || !hasInternationalValue(stmt.label) || !hasInternationalValue(stmt.value)) {
|
|
691
801
|
return null;
|
|
692
802
|
}
|
|
693
|
-
return /* @__PURE__ */
|
|
803
|
+
return /* @__PURE__ */ React16.createElement(CloverRequiredStatement, { requiredStatement: stmt, ...rest });
|
|
694
804
|
}
|
|
695
805
|
export {
|
|
696
|
-
FeaturedHero,
|
|
697
806
|
HelloWorld,
|
|
698
|
-
|
|
807
|
+
interstitials_exports as Interstitials,
|
|
699
808
|
Label,
|
|
700
809
|
Metadata,
|
|
701
810
|
MdxRelatedItems as RelatedItems,
|