@canopy-iiif/app 1.9.7 → 1.9.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/mdx.js +0 -16
- package/lib/build/pages.js +0 -10
- package/lib/components/navigation.js +0 -7
- package/lib/default-locale.js +76 -0
- package/lib/locales.js +3 -1
- package/package.json +1 -1
- package/ui/dist/index.mjs +3 -6
- package/ui/dist/index.mjs.map +2 -2
- package/ui/dist/server.mjs +3 -6
- package/ui/dist/server.mjs.map +2 -2
package/lib/build/mdx.js
CHANGED
|
@@ -117,21 +117,6 @@ function parseFrontmatter(src) {
|
|
|
117
117
|
return {data, content};
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
function isRoadmapEntry(frontmatterData) {
|
|
121
|
-
if (!frontmatterData || typeof frontmatterData !== "object") return false;
|
|
122
|
-
if (!Object.prototype.hasOwnProperty.call(frontmatterData, "roadmap")) return false;
|
|
123
|
-
const raw = frontmatterData.roadmap;
|
|
124
|
-
if (typeof raw === "boolean") return raw;
|
|
125
|
-
if (typeof raw === "number") return raw !== 0;
|
|
126
|
-
if (typeof raw === "string") {
|
|
127
|
-
const normalized = raw.trim().toLowerCase();
|
|
128
|
-
if (!normalized) return false;
|
|
129
|
-
if (["false", "0", "no", "off", "none"].includes(normalized)) return false;
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
return !!raw;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
120
|
// ESM-only in v3; load dynamically from CJS
|
|
136
121
|
let MDXProviderCached = null;
|
|
137
122
|
async function getMdxProvider() {
|
|
@@ -1958,7 +1943,6 @@ module.exports = {
|
|
|
1958
1943
|
extractMarkdownSummary,
|
|
1959
1944
|
isReservedFile,
|
|
1960
1945
|
parseFrontmatter,
|
|
1961
|
-
isRoadmapEntry,
|
|
1962
1946
|
compileMdxFile,
|
|
1963
1947
|
compileMdxToComponent,
|
|
1964
1948
|
loadCustomLayout,
|
package/lib/build/pages.js
CHANGED
|
@@ -388,16 +388,6 @@ async function processContentEntry(absPath, pagesMetadata = []) {
|
|
|
388
388
|
? mdx.parseFrontmatter(source)
|
|
389
389
|
: { data: null };
|
|
390
390
|
const frontmatterData = frontmatter && isPlainObject(frontmatter.data) ? frontmatter.data : null;
|
|
391
|
-
const isRoadmap = frontmatterData && typeof mdx.isRoadmapEntry === 'function'
|
|
392
|
-
? mdx.isRoadmapEntry(frontmatterData)
|
|
393
|
-
: false;
|
|
394
|
-
if (isRoadmap) {
|
|
395
|
-
try { await fsp.rm(outPath, { force: true }); } catch (_) {}
|
|
396
|
-
try {
|
|
397
|
-
log(`• Skipped roadmap page ${path.relative(process.cwd(), absPath)}\n`, 'yellow', { dim: true });
|
|
398
|
-
} catch (_) {}
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
391
|
ensureDirSync(path.dirname(outPath));
|
|
402
392
|
try { log(`• Processing MDX ${absPath}\n`, 'blue'); } catch (_) {}
|
|
403
393
|
const base = path.basename(absPath);
|
|
@@ -100,9 +100,6 @@ function collectPagesSync() {
|
|
|
100
100
|
frontmatterData = null;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
const isRoadmap = frontmatterData && typeof mdx.isRoadmapEntry === "function"
|
|
104
|
-
? mdx.isRoadmapEntry(frontmatterData)
|
|
105
|
-
: false;
|
|
106
103
|
const {
|
|
107
104
|
slug,
|
|
108
105
|
segments: slugSegments,
|
|
@@ -129,7 +126,6 @@ function collectPagesSync() {
|
|
|
129
126
|
fallbackTitle,
|
|
130
127
|
sortKey: pageSortKey(normalizedRel),
|
|
131
128
|
topSegment: slugSegments[0] || firstSegment || "",
|
|
132
|
-
isRoadmap,
|
|
133
129
|
};
|
|
134
130
|
pages.push(page);
|
|
135
131
|
}
|
|
@@ -154,7 +150,6 @@ function createNode(slug) {
|
|
|
154
150
|
sortKey: slug || name,
|
|
155
151
|
sourcePage: null,
|
|
156
152
|
children: [],
|
|
157
|
-
isRoadmap: false,
|
|
158
153
|
};
|
|
159
154
|
}
|
|
160
155
|
|
|
@@ -190,7 +185,6 @@ function getNavigationCache() {
|
|
|
190
185
|
node.relativePath = page.relativePath;
|
|
191
186
|
node.sortKey = page.sortKey || node.sortKey;
|
|
192
187
|
node.hasContent = true;
|
|
193
|
-
node.isRoadmap = !!page.isRoadmap;
|
|
194
188
|
}
|
|
195
189
|
}
|
|
196
190
|
|
|
@@ -258,7 +252,6 @@ function cloneNode(node, currentSlug) {
|
|
|
258
252
|
hasContent: node.hasContent,
|
|
259
253
|
relativePath: node.relativePath,
|
|
260
254
|
children,
|
|
261
|
-
isRoadmap: !!node.isRoadmap,
|
|
262
255
|
};
|
|
263
256
|
}
|
|
264
257
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
common: {
|
|
3
|
+
actions: {
|
|
4
|
+
open: 'Open',
|
|
5
|
+
close: 'Close',
|
|
6
|
+
clear: 'Clear',
|
|
7
|
+
clear_all: 'Clear all',
|
|
8
|
+
done: 'Done',
|
|
9
|
+
show: 'Show',
|
|
10
|
+
hide: 'Hide',
|
|
11
|
+
},
|
|
12
|
+
nouns: {
|
|
13
|
+
search: 'Search',
|
|
14
|
+
filters: 'Filters',
|
|
15
|
+
results: 'results',
|
|
16
|
+
values: 'values',
|
|
17
|
+
types: 'types',
|
|
18
|
+
items: 'items',
|
|
19
|
+
navigation: 'navigation',
|
|
20
|
+
section_navigation: 'section navigation',
|
|
21
|
+
content_navigation: 'content navigation',
|
|
22
|
+
gallery: 'gallery',
|
|
23
|
+
gallery_thumbnails: 'gallery thumbnails',
|
|
24
|
+
map: 'map',
|
|
25
|
+
map_data: 'map data',
|
|
26
|
+
map_locations: 'map locations',
|
|
27
|
+
item_label: 'Item',
|
|
28
|
+
details: 'details',
|
|
29
|
+
breadcrumb: 'Breadcrumb',
|
|
30
|
+
home: 'Home',
|
|
31
|
+
},
|
|
32
|
+
types: {
|
|
33
|
+
work: 'Works',
|
|
34
|
+
page: 'Pages',
|
|
35
|
+
docs: 'Docs',
|
|
36
|
+
},
|
|
37
|
+
statuses: {
|
|
38
|
+
loading: 'Loading…',
|
|
39
|
+
empty_short: 'No {content}',
|
|
40
|
+
empty_detail: 'No {content} available.',
|
|
41
|
+
unavailable: '{content} unavailable.',
|
|
42
|
+
unavailable_detail: '{content} is unavailable.',
|
|
43
|
+
failed: 'Unable to load {content}.',
|
|
44
|
+
loading_content: 'Loading {content}…',
|
|
45
|
+
summary_content: 'Showing {shown} of {total} {content}',
|
|
46
|
+
search_summary: 'Found {shown} of {total} in {type} for "{query}"',
|
|
47
|
+
no_matches: 'No matches found.',
|
|
48
|
+
},
|
|
49
|
+
phrases: {
|
|
50
|
+
placeholder_search: 'Search…',
|
|
51
|
+
results_label: 'Search results',
|
|
52
|
+
open_content: 'Open {content}',
|
|
53
|
+
close_content: 'Close {content}',
|
|
54
|
+
show_content: 'Show {content}',
|
|
55
|
+
hide_content: 'Hide {content}',
|
|
56
|
+
nav_label: '{content} navigation',
|
|
57
|
+
search_content: 'Search {content}',
|
|
58
|
+
filter_values: 'Filter {content} values',
|
|
59
|
+
clear_content_search: 'Clear {content} search',
|
|
60
|
+
none_applied: 'No {content} applied',
|
|
61
|
+
scroll_direction_content: 'Scroll {direction} through {content}',
|
|
62
|
+
step_content: '{direction} {content}',
|
|
63
|
+
item_numbered: '{content} {index}',
|
|
64
|
+
content_key: '{content} key',
|
|
65
|
+
},
|
|
66
|
+
directions: {
|
|
67
|
+
left: 'left',
|
|
68
|
+
right: 'right',
|
|
69
|
+
previous: 'Previous',
|
|
70
|
+
next: 'Next',
|
|
71
|
+
},
|
|
72
|
+
misc: {
|
|
73
|
+
referenced_by: 'Referenced by',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
};
|
package/lib/locales.js
CHANGED
|
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const yaml = require('js-yaml');
|
|
4
4
|
const {resolveCanopyConfigPath} = require('./config-path');
|
|
5
|
+
const DEFAULT_LOCALE_MESSAGES = require('./default-locale');
|
|
5
6
|
|
|
6
7
|
const CONTENT_DIR = path.resolve('content');
|
|
7
8
|
|
|
@@ -102,7 +103,8 @@ function deepMerge(base, override) {
|
|
|
102
103
|
|
|
103
104
|
function readLocaleMessages(lang) {
|
|
104
105
|
const basePath = path.join(CONTENT_DIR, 'locale.yml');
|
|
105
|
-
const
|
|
106
|
+
const userMessages = readYamlFile(basePath);
|
|
107
|
+
const defaultMessages = deepMerge(DEFAULT_LOCALE_MESSAGES, userMessages) || {};
|
|
106
108
|
if (!lang) return defaultMessages;
|
|
107
109
|
const langPath = path.join(CONTENT_DIR, lang, 'locale.yml');
|
|
108
110
|
const override = readYamlFile(langPath);
|
package/package.json
CHANGED
package/ui/dist/index.mjs
CHANGED
|
@@ -43561,13 +43561,11 @@ function NavigationTreeList({ nodes, depth, parentKey }) {
|
|
|
43561
43561
|
function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
43562
43562
|
if (!node) return null;
|
|
43563
43563
|
const hasChildren = Array.isArray(node.children) && node.children.length > 0;
|
|
43564
|
-
const
|
|
43565
|
-
const isInteractive = !!(node.href && !isRoadmap);
|
|
43564
|
+
const isInteractive = !!node.href;
|
|
43566
43565
|
const Tag = isInteractive ? "a" : "span";
|
|
43567
43566
|
const depthClass = `depth-${normalizeDepth(depth + 1)}`;
|
|
43568
43567
|
const classes = ["canopy-nav-tree__link", depthClass];
|
|
43569
|
-
if (!isInteractive
|
|
43570
|
-
if (isRoadmap) classes.push("is-disabled");
|
|
43568
|
+
if (!isInteractive) classes.push("is-label");
|
|
43571
43569
|
if (node.isActive) classes.push("is-active");
|
|
43572
43570
|
const isRootLevel = depth < 0;
|
|
43573
43571
|
const panelId = hasChildren ? `canopy-section-${nodeKey}` : null;
|
|
@@ -43591,8 +43589,7 @@ function NavigationTreeItem({ node, depth, nodeKey }) {
|
|
|
43591
43589
|
"aria-current": node.isActive ? "page" : void 0,
|
|
43592
43590
|
tabIndex: isInteractive ? void 0 : -1
|
|
43593
43591
|
},
|
|
43594
|
-
node.title || node.slug
|
|
43595
|
-
isRoadmap ? /* @__PURE__ */ React14.createElement("span", { className: "canopy-nav-tree__badge" }, "Roadmap") : null
|
|
43592
|
+
node.title || node.slug
|
|
43596
43593
|
)), allowToggle ? /* @__PURE__ */ React14.createElement(
|
|
43597
43594
|
"button",
|
|
43598
43595
|
{
|