@canopy-iiif/app 0.9.14 → 0.10.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 +1 -0
- package/lib/build/build.js +1 -0
- package/lib/build/dev.js +17 -4
- package/lib/build/iiif.js +234 -12
- package/lib/build/mdx.js +2 -0
- package/lib/build/pages.js +17 -1
- package/lib/build/styles.js +4 -8
- package/lib/components/featured.js +6 -0
- package/lib/components/hero-slider-runtime.js +9 -2
- package/lib/iiif/thumbnail.js +262 -4
- package/package.json +14 -1
- package/ui/dist/index.mjs +191 -99
- package/ui/dist/index.mjs.map +4 -4
- package/ui/dist/server.mjs +295 -187
- package/ui/dist/server.mjs.map +4 -4
- package/ui/styles/base/_common.scss +33 -33
- package/ui/styles/base/_heading.scss +26 -19
- package/ui/styles/base/index.scss +0 -1
- package/ui/styles/components/_buttons.scss +53 -46
- package/ui/styles/components/_interstitial-hero.scss +13 -18
- package/ui/styles/components/_sub-navigation.scss +1 -0
- package/ui/styles/components/header/_header.scss +10 -3
- package/ui/styles/components/header/_logo.scss +32 -33
- package/ui/styles/components/search/_form.scss +4 -9
- package/ui/styles/index.css +161 -171
- package/ui/tailwind-canopy-iiif-preset.js +5 -15
- package/ui/tailwind-config.d.ts +21 -0
- package/ui/tailwind-config.js +134 -0
- package/ui/tailwind-default.config.mjs +3 -0
- package/ui/theme.js +4 -4
- package/ui/styles/_variables.scss +0 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const {fileURLToPath} = require("node:url");
|
|
3
|
+
|
|
4
|
+
const canopyPreset = require("./tailwind-canopy-iiif-preset.js");
|
|
5
|
+
const canopyPlugin = require("./tailwind-canopy-iiif-plugin.js");
|
|
6
|
+
|
|
7
|
+
const DEFAULT_SAFELIST = ["canopy-footer", "canopy-footer__inner"];
|
|
8
|
+
const canopyUiDist = path.join(__dirname, "dist");
|
|
9
|
+
const canopyLibRoot = path.join(__dirname, "..");
|
|
10
|
+
|
|
11
|
+
const toArray = (value) => {
|
|
12
|
+
if (!value && value !== 0) return [];
|
|
13
|
+
return Array.isArray(value) ? value : [value];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const normalizeGlob = (filepath) => filepath.replace(/\\+/g, "/");
|
|
17
|
+
|
|
18
|
+
const mergeTheme = (baseTheme = {}, overrideTheme = {}) => {
|
|
19
|
+
if (!overrideTheme || typeof overrideTheme !== "object") return baseTheme;
|
|
20
|
+
const result = {...baseTheme, ...overrideTheme};
|
|
21
|
+
if (baseTheme.extend || overrideTheme.extend) {
|
|
22
|
+
result.extend = {
|
|
23
|
+
...(baseTheme.extend || {}),
|
|
24
|
+
...(overrideTheme.extend || {}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const resolveProjectRoot = (metaUrl, explicitRoot) => {
|
|
31
|
+
if (explicitRoot) return path.resolve(explicitRoot);
|
|
32
|
+
if (metaUrl) {
|
|
33
|
+
const href = typeof metaUrl === "string" ? metaUrl : metaUrl.href;
|
|
34
|
+
if (href) {
|
|
35
|
+
const fromUrl = fileURLToPath(href);
|
|
36
|
+
return path.join(path.dirname(fromUrl), "..", "..");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return process.cwd();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const buildBaseContent = (root, includeCanopySources = true) => {
|
|
43
|
+
const content = [
|
|
44
|
+
normalizeGlob(path.join(root, "content/**/*.{mdx,html}")),
|
|
45
|
+
normalizeGlob(path.join(root, "app/**/*.{js,ts,jsx,tsx}")),
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
if (includeCanopySources) {
|
|
49
|
+
content.push(
|
|
50
|
+
normalizeGlob(path.join(canopyUiDist, "**/*.{js,mjs,jsx,tsx}")),
|
|
51
|
+
normalizeGlob(path.join(canopyLibRoot, "iiif/components/**/*.{js,jsx}"))
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return content;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const isUrlLike = (value) => {
|
|
59
|
+
if (!value) return false;
|
|
60
|
+
if (typeof value === "string") return true;
|
|
61
|
+
return typeof value.href === "string" && typeof value.protocol === "string";
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
function defineCanopyTailwindConfig(metaUrlOrOptions, maybeOptions) {
|
|
65
|
+
const hasMetaArgument = isUrlLike(metaUrlOrOptions);
|
|
66
|
+
const metaUrl = hasMetaArgument ? metaUrlOrOptions : undefined;
|
|
67
|
+
const options = (hasMetaArgument ? maybeOptions : metaUrlOrOptions) || {};
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
root,
|
|
71
|
+
content,
|
|
72
|
+
presets,
|
|
73
|
+
plugins,
|
|
74
|
+
safelist,
|
|
75
|
+
theme,
|
|
76
|
+
includeCanopyPreset = true,
|
|
77
|
+
includeCanopyPlugin = true,
|
|
78
|
+
includeCanopySafelist = true,
|
|
79
|
+
includeCanopySources = true,
|
|
80
|
+
...rest
|
|
81
|
+
} = options;
|
|
82
|
+
|
|
83
|
+
const projectRoot = resolveProjectRoot(metaUrl, root);
|
|
84
|
+
const baseContent = buildBaseContent(projectRoot, includeCanopySources);
|
|
85
|
+
const basePresets = includeCanopyPreset ? [canopyPreset] : [];
|
|
86
|
+
const basePlugins = includeCanopyPlugin ? [canopyPlugin] : [];
|
|
87
|
+
const baseSafelist = includeCanopySafelist ? DEFAULT_SAFELIST.slice() : [];
|
|
88
|
+
|
|
89
|
+
const config = {
|
|
90
|
+
content: baseContent.slice(),
|
|
91
|
+
safelist: baseSafelist.slice(),
|
|
92
|
+
theme: {extend: {}},
|
|
93
|
+
...rest,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
if (content !== undefined) {
|
|
97
|
+
config.content = baseContent.concat(toArray(content));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (presets !== undefined) {
|
|
101
|
+
if (presets === false) {
|
|
102
|
+
config.presets = [];
|
|
103
|
+
} else {
|
|
104
|
+
config.presets = toArray(presets);
|
|
105
|
+
}
|
|
106
|
+
} else if (includeCanopyPreset) {
|
|
107
|
+
config.presets = basePresets.slice();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (plugins !== undefined) {
|
|
111
|
+
if (plugins === false) {
|
|
112
|
+
config.plugins = [];
|
|
113
|
+
} else {
|
|
114
|
+
config.plugins = toArray(plugins);
|
|
115
|
+
}
|
|
116
|
+
} else if (includeCanopyPlugin) {
|
|
117
|
+
config.plugins = basePlugins.slice();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (safelist !== undefined) {
|
|
121
|
+
config.safelist =
|
|
122
|
+
safelist === false ? [] : baseSafelist.concat(toArray(safelist));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (theme) {
|
|
126
|
+
config.theme = mergeTheme(config.theme, theme);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return config;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
module.exports = defineCanopyTailwindConfig;
|
|
133
|
+
module.exports.defineCanopyTailwindConfig = defineCanopyTailwindConfig;
|
|
134
|
+
module.exports.default = defineCanopyTailwindConfig;
|
package/ui/theme.js
CHANGED
|
@@ -56,7 +56,7 @@ const LEVELS = [
|
|
|
56
56
|
"900",
|
|
57
57
|
];
|
|
58
58
|
const STEP_MAP = {
|
|
59
|
-
50:
|
|
59
|
+
50: 1,
|
|
60
60
|
100: 3,
|
|
61
61
|
200: 4,
|
|
62
62
|
300: 6,
|
|
@@ -183,7 +183,7 @@ function buildVariablesMap(brandScale, grayScale, options = {}) {
|
|
|
183
183
|
const value = brandScale[lvl];
|
|
184
184
|
if (value) vars[`--color-brand-${lvl}`] = value;
|
|
185
185
|
}
|
|
186
|
-
if (brandScale["
|
|
186
|
+
if (brandScale["700"]) vars["--color-brand-default"] = brandScale["700"];
|
|
187
187
|
}
|
|
188
188
|
if (grayScale) {
|
|
189
189
|
for (const lvl of LEVELS) {
|
|
@@ -194,8 +194,8 @@ function buildVariablesMap(brandScale, grayScale, options = {}) {
|
|
|
194
194
|
if (grayScale["600"]) vars["--color-gray-muted"] = grayScale["600"];
|
|
195
195
|
}
|
|
196
196
|
if (brandScale && grayScale) {
|
|
197
|
-
if (brandScale["
|
|
198
|
-
vars["--colors-accent"] = `${brandScale["
|
|
197
|
+
if (brandScale["700"])
|
|
198
|
+
vars["--colors-accent"] = `${brandScale["700"]} !important`;
|
|
199
199
|
if (brandScale["800"])
|
|
200
200
|
vars["--colors-accentAlt"] = `${brandScale["800"]} !important`;
|
|
201
201
|
if (brandScale["400"])
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$max-w-content: 1080px !default;
|