@canopy-iiif/app 1.6.3 → 1.6.5
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/mdx.js +3 -0
- package/lib/common.js +20 -0
- package/package.json +1 -1
- package/ui/dist/index.mjs +3 -2
- package/ui/dist/index.mjs.map +2 -2
- package/ui/dist/server.mjs +3 -2
- package/ui/dist/server.mjs.map +2 -2
package/lib/build/mdx.js
CHANGED
|
@@ -12,6 +12,7 @@ const {
|
|
|
12
12
|
ensureDirSync,
|
|
13
13
|
withBase,
|
|
14
14
|
readSiteMetadata,
|
|
15
|
+
readPrimaryNavigation,
|
|
15
16
|
} = require("../common");
|
|
16
17
|
let remarkGfm = null;
|
|
17
18
|
try {
|
|
@@ -1045,11 +1046,13 @@ async function compileMdxFile(filePath, outPath, Layout, extraProps = {}) {
|
|
|
1045
1046
|
const withApp = React.createElement(app.App, null, withLayout);
|
|
1046
1047
|
const PageContext = getPageContext();
|
|
1047
1048
|
const siteMeta = readSiteMetadata();
|
|
1049
|
+
const primaryNav = readPrimaryNavigation();
|
|
1048
1050
|
const contextValue = {
|
|
1049
1051
|
navigation:
|
|
1050
1052
|
extraProps && extraProps.navigation ? extraProps.navigation : null,
|
|
1051
1053
|
page: extraProps && extraProps.page ? extraProps.page : null,
|
|
1052
1054
|
site: siteMeta ? {...siteMeta} : null,
|
|
1055
|
+
primaryNavigation: Array.isArray(primaryNav) ? primaryNav : [],
|
|
1053
1056
|
};
|
|
1054
1057
|
const withContext = PageContext
|
|
1055
1058
|
? React.createElement(PageContext.Provider, {value: contextValue}, withApp)
|
package/lib/common.js
CHANGED
|
@@ -116,6 +116,25 @@ function readSearchPageMetadata() {
|
|
|
116
116
|
return cachedSearchPageMetadata;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
let cachedPrimaryNavigation = null;
|
|
120
|
+
|
|
121
|
+
function readPrimaryNavigation() {
|
|
122
|
+
if (cachedPrimaryNavigation) return cachedPrimaryNavigation;
|
|
123
|
+
cachedPrimaryNavigation = [];
|
|
124
|
+
try {
|
|
125
|
+
const navPath = path.resolve(CONTENT_DIR, 'navigation.yml');
|
|
126
|
+
if (!fs.existsSync(navPath)) return cachedPrimaryNavigation;
|
|
127
|
+
const raw = fs.readFileSync(navPath, 'utf8');
|
|
128
|
+
const data = yaml.load(raw) || {};
|
|
129
|
+
if (Array.isArray(data.navigation)) {
|
|
130
|
+
cachedPrimaryNavigation = data.navigation.filter(
|
|
131
|
+
(item) => item && typeof item === 'object' && typeof item.href === 'string'
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
} catch (_) {}
|
|
135
|
+
return cachedPrimaryNavigation;
|
|
136
|
+
}
|
|
137
|
+
|
|
119
138
|
// Determine the absolute site origin (scheme + host[:port])
|
|
120
139
|
// Priority:
|
|
121
140
|
// 1) CANOPY_BASE_URL env
|
|
@@ -288,4 +307,5 @@ module.exports = {
|
|
|
288
307
|
readSearchPageMetadata,
|
|
289
308
|
DEFAULT_SEARCH_PAGE_TITLE,
|
|
290
309
|
DEFAULT_SEARCH_PAGE_DESCRIPTION,
|
|
310
|
+
readPrimaryNavigation,
|
|
291
311
|
};
|
package/package.json
CHANGED
package/ui/dist/index.mjs
CHANGED
|
@@ -1281,9 +1281,10 @@ function CanopyHeader(props = {}) {
|
|
|
1281
1281
|
title: titleProp,
|
|
1282
1282
|
logo: SiteLogo
|
|
1283
1283
|
} = props;
|
|
1284
|
-
const navLinks = ensureArray(navLinksProp);
|
|
1285
1284
|
const PageContext = getSafePageContext();
|
|
1286
1285
|
const context = React15.useContext(PageContext);
|
|
1286
|
+
const contextPrimaryNav = context && Array.isArray(context.primaryNavigation) ? context.primaryNavigation : [];
|
|
1287
|
+
const navLinks = navLinksProp && navLinksProp.length ? ensureArray(navLinksProp) : ensureArray(contextPrimaryNav);
|
|
1287
1288
|
const contextNavigation = context && context.navigation ? context.navigation : null;
|
|
1288
1289
|
const contextSite = context && context.site ? context.site : null;
|
|
1289
1290
|
const contextSiteTitle = contextSite && typeof contextSite.title === "string" ? contextSite.title.trim() : "";
|
|
@@ -2435,7 +2436,7 @@ function MarkdownTable({ className = "", ...rest }) {
|
|
|
2435
2436
|
// ui/src/docs/Diagram.jsx
|
|
2436
2437
|
import React34 from "react";
|
|
2437
2438
|
function CanopyDiagram() {
|
|
2438
|
-
return /* @__PURE__ */ React34.createElement("div", { className: "canopy-diagram" }, /* @__PURE__ */ React34.createElement("section", { className: "canopy-diagram__section canopy-diagram__section--collections" }, /* @__PURE__ */ React34.createElement("h3", null, "IIIF
|
|
2439
|
+
return /* @__PURE__ */ React34.createElement("div", { className: "canopy-diagram" }, /* @__PURE__ */ React34.createElement("section", { className: "canopy-diagram__section canopy-diagram__section--collections" }, /* @__PURE__ */ React34.createElement("h3", null, "IIIF Providers"), /* @__PURE__ */ React34.createElement("span", { className: "canopy-diagram__section-summary" }, "Source collections contribute 45 manifests while 5 manifests are directly retrieved as-is via IIIF endpoints."), /* @__PURE__ */ React34.createElement("div", { className: "canopy-diagram__grid" }, /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Collection A"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "30 Manifests"), /* @__PURE__ */ React34.createElement("li", null, /* @__PURE__ */ React34.createElement("em", null, "Manuscripts")))), /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Collection B"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "15 Manifests"), /* @__PURE__ */ React34.createElement("li", null, /* @__PURE__ */ React34.createElement("em", null, "Portraits")))), /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Manifests (direct)"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "5 Manifests"), /* @__PURE__ */ React34.createElement("li", null, /* @__PURE__ */ React34.createElement("em", null, "Scrapbooks")))))), /* @__PURE__ */ React34.createElement("div", { className: "canopy-diagram__arrow", "aria-hidden": "true" }, /* @__PURE__ */ React34.createElement("span", { className: "canopy-diagram__arrow-line" }), /* @__PURE__ */ React34.createElement("span", { className: "canopy-diagram__arrow-head" })), /* @__PURE__ */ React34.createElement("section", { className: "canopy-diagram__section canopy-diagram__section--build" }, /* @__PURE__ */ React34.createElement("h3", null, "Canopy Build Process"), /* @__PURE__ */ React34.createElement("span", { className: "canopy-diagram__section-summary" }, "Canopy retrieves collections and syncs all manifests, page content, and annotations before bundling the site."), /* @__PURE__ */ React34.createElement("div", { className: "canopy-diagram__grid" }, /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Automated content"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "50 manifests \u2192 50 work pages"), /* @__PURE__ */ React34.createElement("li", null, "One page per manifest"), /* @__PURE__ */ React34.createElement("li", null, "Customize page layout"))), /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Contextual content"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "Markdown & MDX pages"), /* @__PURE__ */ React34.createElement("li", null, "Author narratives"), /* @__PURE__ */ React34.createElement("li", null, "Reference manifests inline"))), /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Search index"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "Combines works + pages"), /* @__PURE__ */ React34.createElement("li", null, "Customize result layout"), /* @__PURE__ */ React34.createElement("li", null, "Optional annotations"))))), /* @__PURE__ */ React34.createElement("div", { className: "canopy-diagram__arrow", "aria-hidden": "true" }, /* @__PURE__ */ React34.createElement("span", { className: "canopy-diagram__arrow-line" }), /* @__PURE__ */ React34.createElement("span", { className: "canopy-diagram__arrow-head" })), /* @__PURE__ */ React34.createElement("section", { className: "canopy-diagram__section canopy-diagram__section--output" }, /* @__PURE__ */ React34.createElement("h3", null, "Static Digital Project"), /* @__PURE__ */ React34.createElement("span", { className: "canopy-diagram__section-summary" }, "The output is a lightweight bundle of HTML, CSS, JS, and JSON assets that can deploy anywhere."), /* @__PURE__ */ React34.createElement("div", { className: "canopy-diagram__grid" }, /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Work pages"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "50 generated HTML pages"), /* @__PURE__ */ React34.createElement("li", null, "Each links back to source manifests"), /* @__PURE__ */ React34.createElement("li", null, "Styled with Canopy components"))), /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Custom pages"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "Markdown & MDX-authored content"), /* @__PURE__ */ React34.createElement("li", null, "Reusable layouts for narratives"), /* @__PURE__ */ React34.createElement("li", null, "Embed IIIF media & interstitials"))), /* @__PURE__ */ React34.createElement("article", null, /* @__PURE__ */ React34.createElement("h4", null, "Search bundle"), /* @__PURE__ */ React34.createElement("ul", null, /* @__PURE__ */ React34.createElement("li", null, "Static FlexSearch index"), /* @__PURE__ */ React34.createElement("li", null, "Works + pages share records"), /* @__PURE__ */ React34.createElement("li", null, "Optional annotation dataset"))))));
|
|
2439
2440
|
}
|
|
2440
2441
|
|
|
2441
2442
|
// ui/src/content/timeline/Timeline.jsx
|