@nulib/canopy 2.0.1 → 2.0.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/dev.js +7 -2
- package/lib/build/mdx.js +45 -4
- package/lib/build/upgrade-notices.js +30 -0
- package/lib/common.js +2 -2
- package/lib/components/hero-slider-runtime.js +12 -105
- package/lib/components/viewer-runtime-entry.js +50 -0
- package/lib/default-locale.js +3 -3
- package/package.json +1 -1
- package/ui/dist/index.mjs +154 -18
- package/ui/dist/index.mjs.map +3 -3
- package/ui/dist/server.mjs +288 -158
- package/ui/dist/server.mjs.map +4 -4
- package/ui/styles/base/_common.scss +16 -16
- package/ui/styles/base/_utilities.scss +2 -2
- package/ui/styles/components/_interstitial-hero.scss +16 -51
- package/ui/styles/components/_work.scss +94 -0
- package/ui/styles/components/header/_header.scss +89 -4
- package/ui/styles/components/header/_logo.scss +2 -34
- package/ui/styles/components/iiif/_slider.scss +58 -2
- package/ui/styles/components/index.scss +0 -1
- package/ui/styles/index.css +191 -119
- package/ui/styles/settings/_tokens.scss +6 -10
- package/ui/styles/version-parity.css +33 -0
- package/ui/theme-palette.js +29 -0
- package/ui/theme.js +5 -2
- package/ui/styles/components/_swoosh.scss +0 -50
package/ui/dist/server.mjs
CHANGED
|
@@ -51,6 +51,8 @@ var require_default_locale = __commonJS({
|
|
|
51
51
|
show: "Show",
|
|
52
52
|
hide: "Hide",
|
|
53
53
|
view_work: "View work",
|
|
54
|
+
view_all: "View all",
|
|
55
|
+
widen_viewer: "Widen the viewer",
|
|
54
56
|
copy: "Copy"
|
|
55
57
|
},
|
|
56
58
|
nouns: {
|
|
@@ -139,9 +141,7 @@ var require_default_locale = __commonJS({
|
|
|
139
141
|
slide: "{index} of {total}",
|
|
140
142
|
previous: "Previous slide",
|
|
141
143
|
next: "Next slide",
|
|
142
|
-
go_to: "Go to slide {index}"
|
|
143
|
-
stop: "Pause the slideshow",
|
|
144
|
-
start: "Play the slideshow"
|
|
144
|
+
go_to: "Go to slide {index}"
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
};
|
|
@@ -4283,6 +4283,22 @@ var require_theme_palette = __commonJS({
|
|
|
4283
4283
|
(1 - HOVER_SHARE) * 100
|
|
4284
4284
|
)}%, ${far})`;
|
|
4285
4285
|
}
|
|
4286
|
+
var DOT_SHARE = 0.8;
|
|
4287
|
+
var NON_TEXT_CONTRAST = 3;
|
|
4288
|
+
function srgbOver(fg, bg, share) {
|
|
4289
|
+
const channels = (hex) => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16));
|
|
4290
|
+
const [x, y] = [channels(normalizeHex2(fg)), channels(normalizeHex2(bg))];
|
|
4291
|
+
return `#${x.map((v, i) => Math.round(v * share + y[i] * (1 - share)).toString(16).padStart(2, "0")).join("")}`;
|
|
4292
|
+
}
|
|
4293
|
+
function dotShare(brandScale, grayScale) {
|
|
4294
|
+
const ground = brandScale && brandScale["200"];
|
|
4295
|
+
const dot = grayScale && grayScale["800"];
|
|
4296
|
+
if (!ground || !dot) return 1;
|
|
4297
|
+
for (let pct = Math.round(DOT_SHARE * 100); pct < 100; pct += 1) {
|
|
4298
|
+
if (contrast(srgbOver(dot, ground, pct / 100), ground) >= NON_TEXT_CONTRAST) return pct / 100;
|
|
4299
|
+
}
|
|
4300
|
+
return 1;
|
|
4301
|
+
}
|
|
4286
4302
|
function buildVariablesMap2(brandScale, grayScale, options = {}) {
|
|
4287
4303
|
const appearance = scaleAppearance(options.appearance);
|
|
4288
4304
|
const vars = {};
|
|
@@ -4304,6 +4320,9 @@ var require_theme_palette = __commonJS({
|
|
|
4304
4320
|
if (grayScale["900"]) vars["--color-gray-default"] = grayScale["900"];
|
|
4305
4321
|
if (grayScale["800"]) vars["--color-gray-muted"] = grayScale["800"];
|
|
4306
4322
|
}
|
|
4323
|
+
if (brandScale && grayScale) {
|
|
4324
|
+
vars["--canopy-dot-share"] = `${Math.round(dotShare(brandScale, grayScale) * 100)}%`;
|
|
4325
|
+
}
|
|
4307
4326
|
if (brandScale) {
|
|
4308
4327
|
for (const [prop, token] of Object.entries(CLOVER_ACCENT_TOKENS)) {
|
|
4309
4328
|
vars[prop] = `var(${token})`;
|
|
@@ -4371,6 +4390,8 @@ ${dark}
|
|
|
4371
4390
|
accentHover,
|
|
4372
4391
|
accentHoverCss,
|
|
4373
4392
|
appearanceVariablesToCss,
|
|
4393
|
+
dotShare,
|
|
4394
|
+
srgbOver,
|
|
4374
4395
|
contrast,
|
|
4375
4396
|
normalizePaletteName,
|
|
4376
4397
|
normalizeAccentName,
|
|
@@ -4391,7 +4412,7 @@ var HelloWorld = () => {
|
|
|
4391
4412
|
};
|
|
4392
4413
|
|
|
4393
4414
|
// ui/src/iiif/Viewer.jsx
|
|
4394
|
-
import
|
|
4415
|
+
import React5, { useEffect, useState } from "react";
|
|
4395
4416
|
|
|
4396
4417
|
// ui/src/iiif/clover-compat.js
|
|
4397
4418
|
import React2 from "react";
|
|
@@ -4638,6 +4659,93 @@ function cloverImage(canvas) {
|
|
|
4638
4659
|
};
|
|
4639
4660
|
}
|
|
4640
4661
|
|
|
4662
|
+
// ui/src/locale/index.js
|
|
4663
|
+
import React4 from "react";
|
|
4664
|
+
|
|
4665
|
+
// ui/src/layout/pageContext.js
|
|
4666
|
+
import React3 from "react";
|
|
4667
|
+
var CONTEXT_KEY = typeof Symbol === "function" ? Symbol.for("__CANOPY_PAGE_CONTEXT__") : "__CANOPY_PAGE_CONTEXT__";
|
|
4668
|
+
function getSharedRoot() {
|
|
4669
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
4670
|
+
if (typeof window !== "undefined") return window;
|
|
4671
|
+
if (typeof global !== "undefined") return global;
|
|
4672
|
+
return null;
|
|
4673
|
+
}
|
|
4674
|
+
function getSafePageContext() {
|
|
4675
|
+
const root = getSharedRoot();
|
|
4676
|
+
if (root && root[CONTEXT_KEY]) return root[CONTEXT_KEY];
|
|
4677
|
+
const ctx = React3.createContext({ navigation: null, page: null, site: null });
|
|
4678
|
+
if (root) root[CONTEXT_KEY] = ctx;
|
|
4679
|
+
return ctx;
|
|
4680
|
+
}
|
|
4681
|
+
|
|
4682
|
+
// ui/src/locale/index.js
|
|
4683
|
+
var import_default_locale = __toESM(require_default_locale());
|
|
4684
|
+
function getGlobalScope() {
|
|
4685
|
+
if (typeof globalThis !== "undefined") return globalThis;
|
|
4686
|
+
if (typeof window !== "undefined") return window;
|
|
4687
|
+
if (typeof global !== "undefined") return global;
|
|
4688
|
+
return null;
|
|
4689
|
+
}
|
|
4690
|
+
function readRuntimeMessages() {
|
|
4691
|
+
const scope = getGlobalScope();
|
|
4692
|
+
const candidate = scope && scope.CANOPY_LOCALE_MESSAGES;
|
|
4693
|
+
if (candidate && typeof candidate === "object") return candidate;
|
|
4694
|
+
return import_default_locale.default || {};
|
|
4695
|
+
}
|
|
4696
|
+
function accessPath(obj, path) {
|
|
4697
|
+
if (!obj || typeof obj !== "object" || !path) return void 0;
|
|
4698
|
+
const parts = Array.isArray(path) ? path : String(path).split(".");
|
|
4699
|
+
let current = obj;
|
|
4700
|
+
for (const part of parts) {
|
|
4701
|
+
if (!current || typeof current !== "object") return void 0;
|
|
4702
|
+
const key = String(part).trim();
|
|
4703
|
+
if (!key || !(key in current)) return void 0;
|
|
4704
|
+
current = current[key];
|
|
4705
|
+
}
|
|
4706
|
+
return current;
|
|
4707
|
+
}
|
|
4708
|
+
function formatTemplate(template, replacements = {}) {
|
|
4709
|
+
if (template == null) return template;
|
|
4710
|
+
const str = String(template);
|
|
4711
|
+
if (!replacements || typeof replacements !== "object") return str;
|
|
4712
|
+
return str.replace(/\{([^}]+)\}/g, (match, key) => {
|
|
4713
|
+
if (!Object.prototype.hasOwnProperty.call(replacements, key)) return match;
|
|
4714
|
+
const value = replacements[key];
|
|
4715
|
+
if (value == null) return match;
|
|
4716
|
+
return String(value);
|
|
4717
|
+
});
|
|
4718
|
+
}
|
|
4719
|
+
function useLocaleMessages() {
|
|
4720
|
+
const PageContext3 = getSafePageContext();
|
|
4721
|
+
const context = PageContext3 ? React4.useContext(PageContext3) : null;
|
|
4722
|
+
const siteMessages = context && context.site && context.site.localeMessages && typeof context.site.localeMessages === "object" ? context.site.localeMessages : null;
|
|
4723
|
+
return siteMessages || readRuntimeMessages();
|
|
4724
|
+
}
|
|
4725
|
+
function useLocale() {
|
|
4726
|
+
const messages = useLocaleMessages();
|
|
4727
|
+
const getString = React4.useCallback(
|
|
4728
|
+
(path, fallback) => {
|
|
4729
|
+
const value = path ? accessPath(messages, path) : void 0;
|
|
4730
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
4731
|
+
return value;
|
|
4732
|
+
}
|
|
4733
|
+
return fallback;
|
|
4734
|
+
},
|
|
4735
|
+
[messages]
|
|
4736
|
+
);
|
|
4737
|
+
const formatString = React4.useCallback(
|
|
4738
|
+
(path, fallback, replacements) => {
|
|
4739
|
+
const template = path ? accessPath(messages, path) : void 0;
|
|
4740
|
+
const resolved = template != null ? template : fallback;
|
|
4741
|
+
if (resolved == null) return resolved;
|
|
4742
|
+
return formatTemplate(resolved, replacements);
|
|
4743
|
+
},
|
|
4744
|
+
[messages]
|
|
4745
|
+
);
|
|
4746
|
+
return { messages, getString, formatString };
|
|
4747
|
+
}
|
|
4748
|
+
|
|
4641
4749
|
// ui/src/iiif/Viewer.jsx
|
|
4642
4750
|
var DEFAULT_VIEWER_OPTIONS = {
|
|
4643
4751
|
showDownload: false,
|
|
@@ -4666,6 +4774,7 @@ function deepMerge(base, override) {
|
|
|
4666
4774
|
}
|
|
4667
4775
|
var Viewer = (props) => {
|
|
4668
4776
|
const [CloverViewer, setCloverViewer] = useState(null);
|
|
4777
|
+
const { getString } = useLocale();
|
|
4669
4778
|
const mergedOptions = deepMerge(
|
|
4670
4779
|
DEFAULT_VIEWER_OPTIONS,
|
|
4671
4780
|
props && props.options
|
|
@@ -4705,20 +4814,30 @@ var Viewer = (props) => {
|
|
|
4705
4814
|
}
|
|
4706
4815
|
return (
|
|
4707
4816
|
// `clover-viewer`, Clover 3's root, for a site's 1.x styles (`version-parity.css`).
|
|
4708
|
-
|
|
4709
|
-
|
|
4817
|
+
// On a work page the viewer runtime adds a toggle beside it, named in the page's
|
|
4818
|
+
// words (`viewer-runtime-entry.js`).
|
|
4819
|
+
/* @__PURE__ */ React5.createElement(
|
|
4820
|
+
"div",
|
|
4710
4821
|
{
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4822
|
+
"data-canopy-viewer": "1",
|
|
4823
|
+
"data-canopy-viewer-widen": getString("common.actions.widen_viewer", "Widen the viewer"),
|
|
4824
|
+
className: "not-prose clover-viewer"
|
|
4825
|
+
},
|
|
4826
|
+
/* @__PURE__ */ React5.createElement(
|
|
4827
|
+
"script",
|
|
4828
|
+
{
|
|
4829
|
+
type: "application/json",
|
|
4830
|
+
dangerouslySetInnerHTML: { __html: json }
|
|
4831
|
+
}
|
|
4832
|
+
)
|
|
4833
|
+
)
|
|
4715
4834
|
);
|
|
4716
4835
|
}
|
|
4717
|
-
return /* @__PURE__ */
|
|
4836
|
+
return /* @__PURE__ */ React5.createElement(CloverViewer, { ...props, options: mergedOptions });
|
|
4718
4837
|
};
|
|
4719
4838
|
|
|
4720
4839
|
// ui/src/iiif/Slider.jsx
|
|
4721
|
-
import
|
|
4840
|
+
import React6, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
4722
4841
|
|
|
4723
4842
|
// ui/src/iiif/sliderOptions.js
|
|
4724
4843
|
var UNIT_TOKEN2 = "__canopySliderUnit";
|
|
@@ -4865,7 +4984,7 @@ var Slider = (props = {}) => {
|
|
|
4865
4984
|
} catch (_) {
|
|
4866
4985
|
json = "{}";
|
|
4867
4986
|
}
|
|
4868
|
-
return /* @__PURE__ */
|
|
4987
|
+
return /* @__PURE__ */ React6.createElement("div", { className: sliderClassName, "data-canopy-slider": "1" }, /* @__PURE__ */ React6.createElement(
|
|
4869
4988
|
"script",
|
|
4870
4989
|
{
|
|
4871
4990
|
type: "application/json",
|
|
@@ -4873,11 +4992,11 @@ var Slider = (props = {}) => {
|
|
|
4873
4992
|
}
|
|
4874
4993
|
));
|
|
4875
4994
|
}
|
|
4876
|
-
return /* @__PURE__ */
|
|
4995
|
+
return /* @__PURE__ */ React6.createElement(CloverSlider, { ...resolvedProps });
|
|
4877
4996
|
};
|
|
4878
4997
|
|
|
4879
4998
|
// ui/src/iiif/Scroll.jsx
|
|
4880
|
-
import
|
|
4999
|
+
import React7, { useEffect as useEffect3, useState as useState3 } from "react";
|
|
4881
5000
|
var Scroll = (props) => {
|
|
4882
5001
|
const [CloverScroll, setCloverScroll] = useState3(null);
|
|
4883
5002
|
useEffect3(() => {
|
|
@@ -4906,7 +5025,7 @@ var Scroll = (props) => {
|
|
|
4906
5025
|
} catch (_) {
|
|
4907
5026
|
json = "{}";
|
|
4908
5027
|
}
|
|
4909
|
-
return /* @__PURE__ */
|
|
5028
|
+
return /* @__PURE__ */ React7.createElement("div", { "data-canopy-scroll": "1", className: "not-prose" }, /* @__PURE__ */ React7.createElement(
|
|
4910
5029
|
"script",
|
|
4911
5030
|
{
|
|
4912
5031
|
type: "application/json",
|
|
@@ -4914,11 +5033,11 @@ var Scroll = (props) => {
|
|
|
4914
5033
|
}
|
|
4915
5034
|
));
|
|
4916
5035
|
}
|
|
4917
|
-
return /* @__PURE__ */
|
|
5036
|
+
return /* @__PURE__ */ React7.createElement(CloverScroll, { ...props });
|
|
4918
5037
|
};
|
|
4919
5038
|
|
|
4920
5039
|
// ui/src/iiif/Image.jsx
|
|
4921
|
-
import
|
|
5040
|
+
import React8, { useEffect as useEffect4, useState as useState4 } from "react";
|
|
4922
5041
|
var Image = (props = {}) => {
|
|
4923
5042
|
const [CloverImage, setCloverImage] = useState4(null);
|
|
4924
5043
|
const baseClass = "canopy-iiif-image";
|
|
@@ -4952,7 +5071,7 @@ var Image = (props = {}) => {
|
|
|
4952
5071
|
} catch (_) {
|
|
4953
5072
|
json = "{}";
|
|
4954
5073
|
}
|
|
4955
|
-
return /* @__PURE__ */
|
|
5074
|
+
return /* @__PURE__ */ React8.createElement("figure", { className: rootClassName }, /* @__PURE__ */ React8.createElement(
|
|
4956
5075
|
"div",
|
|
4957
5076
|
{
|
|
4958
5077
|
className: `${baseClass}__placeholder`,
|
|
@@ -4962,20 +5081,20 @@ var Image = (props = {}) => {
|
|
|
4962
5081
|
"--canopy-iiif-image-bg": backgroundColor
|
|
4963
5082
|
}
|
|
4964
5083
|
},
|
|
4965
|
-
/* @__PURE__ */
|
|
5084
|
+
/* @__PURE__ */ React8.createElement(
|
|
4966
5085
|
"script",
|
|
4967
5086
|
{
|
|
4968
5087
|
type: "application/json",
|
|
4969
5088
|
dangerouslySetInnerHTML: { __html: json }
|
|
4970
5089
|
}
|
|
4971
5090
|
)
|
|
4972
|
-
), caption && /* @__PURE__ */
|
|
5091
|
+
), caption && /* @__PURE__ */ React8.createElement("figcaption", { className: `${baseClass}__caption` }, caption));
|
|
4973
5092
|
}
|
|
4974
|
-
return /* @__PURE__ */
|
|
5093
|
+
return /* @__PURE__ */ React8.createElement(CloverImage, { ...props, className: rootClassName });
|
|
4975
5094
|
};
|
|
4976
5095
|
|
|
4977
5096
|
// ui/src/iiif/ImageStory.jsx
|
|
4978
|
-
import
|
|
5097
|
+
import React9, { useEffect as useEffect5, useMemo, useRef } from "react";
|
|
4979
5098
|
|
|
4980
5099
|
// ui/src/iiif/imageStoryRuntime.js
|
|
4981
5100
|
var STORIIIES_STYLE_URL = "https://unpkg.com/@cogapp/storiiies-viewer@latest/dist/storiiies-viewer.css";
|
|
@@ -5323,7 +5442,7 @@ var ImageStory = (props = {}) => {
|
|
|
5323
5442
|
}
|
|
5324
5443
|
};
|
|
5325
5444
|
}, [iiifContent, disablePanAndZoom, pointOfInterestSvgUrl, viewerOptions]);
|
|
5326
|
-
return /* @__PURE__ */
|
|
5445
|
+
return /* @__PURE__ */ React9.createElement(
|
|
5327
5446
|
"div",
|
|
5328
5447
|
{
|
|
5329
5448
|
ref: containerRef,
|
|
@@ -5336,7 +5455,7 @@ var ImageStory = (props = {}) => {
|
|
|
5336
5455
|
},
|
|
5337
5456
|
...rest
|
|
5338
5457
|
},
|
|
5339
|
-
/* @__PURE__ */
|
|
5458
|
+
/* @__PURE__ */ React9.createElement(
|
|
5340
5459
|
"script",
|
|
5341
5460
|
{
|
|
5342
5461
|
type: "application/json",
|
|
@@ -5347,15 +5466,19 @@ var ImageStory = (props = {}) => {
|
|
|
5347
5466
|
};
|
|
5348
5467
|
|
|
5349
5468
|
// ui/src/iiif/MdxRelatedItems.jsx
|
|
5350
|
-
import
|
|
5469
|
+
import React10 from "react";
|
|
5351
5470
|
function MdxRelatedItems(props) {
|
|
5471
|
+
const { getString } = useLocale();
|
|
5352
5472
|
let json = "{}";
|
|
5353
5473
|
try {
|
|
5354
|
-
json = JSON.stringify(
|
|
5474
|
+
json = JSON.stringify({
|
|
5475
|
+
...props || {},
|
|
5476
|
+
viewAll: getString("common.actions.view_all", "View all")
|
|
5477
|
+
});
|
|
5355
5478
|
} catch (_) {
|
|
5356
5479
|
json = "{}";
|
|
5357
5480
|
}
|
|
5358
|
-
return /* @__PURE__ */
|
|
5481
|
+
return /* @__PURE__ */ React10.createElement("div", { "data-canopy-related-items": "1" }, /* @__PURE__ */ React10.createElement(
|
|
5359
5482
|
"script",
|
|
5360
5483
|
{
|
|
5361
5484
|
type: "application/json",
|
|
@@ -5384,7 +5507,7 @@ function computeHeroHeightStyle(height) {
|
|
|
5384
5507
|
}
|
|
5385
5508
|
|
|
5386
5509
|
// ui/src/layout/Button.jsx
|
|
5387
|
-
import
|
|
5510
|
+
import React11 from "react";
|
|
5388
5511
|
var VARIANTS = /* @__PURE__ */ new Set(["primary", "secondary"]);
|
|
5389
5512
|
function Button({
|
|
5390
5513
|
label,
|
|
@@ -5418,11 +5541,11 @@ function Button({
|
|
|
5418
5541
|
if (typeof target !== "undefined") elementProps.target = target;
|
|
5419
5542
|
if (computedRel) elementProps.rel = computedRel;
|
|
5420
5543
|
}
|
|
5421
|
-
return /* @__PURE__ */
|
|
5544
|
+
return /* @__PURE__ */ React11.createElement(Element, { ...elementProps }, content);
|
|
5422
5545
|
}
|
|
5423
5546
|
|
|
5424
5547
|
// ui/src/layout/ButtonWrapper.jsx
|
|
5425
|
-
import
|
|
5548
|
+
import React12 from "react";
|
|
5426
5549
|
function ButtonWrapper({
|
|
5427
5550
|
className = "",
|
|
5428
5551
|
children,
|
|
@@ -5432,94 +5555,7 @@ function ButtonWrapper({
|
|
|
5432
5555
|
}) {
|
|
5433
5556
|
const variantClass = variant && variant !== "default" ? `canopy-button-group--${variant}` : "";
|
|
5434
5557
|
const classes = ["canopy-button-group", variantClass, className].filter(Boolean).join(" ");
|
|
5435
|
-
return /* @__PURE__ */
|
|
5436
|
-
}
|
|
5437
|
-
|
|
5438
|
-
// ui/src/locale/index.js
|
|
5439
|
-
import React12 from "react";
|
|
5440
|
-
|
|
5441
|
-
// ui/src/layout/pageContext.js
|
|
5442
|
-
import React11 from "react";
|
|
5443
|
-
var CONTEXT_KEY = typeof Symbol === "function" ? Symbol.for("__CANOPY_PAGE_CONTEXT__") : "__CANOPY_PAGE_CONTEXT__";
|
|
5444
|
-
function getSharedRoot() {
|
|
5445
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
5446
|
-
if (typeof window !== "undefined") return window;
|
|
5447
|
-
if (typeof global !== "undefined") return global;
|
|
5448
|
-
return null;
|
|
5449
|
-
}
|
|
5450
|
-
function getSafePageContext() {
|
|
5451
|
-
const root = getSharedRoot();
|
|
5452
|
-
if (root && root[CONTEXT_KEY]) return root[CONTEXT_KEY];
|
|
5453
|
-
const ctx = React11.createContext({ navigation: null, page: null, site: null });
|
|
5454
|
-
if (root) root[CONTEXT_KEY] = ctx;
|
|
5455
|
-
return ctx;
|
|
5456
|
-
}
|
|
5457
|
-
|
|
5458
|
-
// ui/src/locale/index.js
|
|
5459
|
-
var import_default_locale = __toESM(require_default_locale());
|
|
5460
|
-
function getGlobalScope() {
|
|
5461
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
5462
|
-
if (typeof window !== "undefined") return window;
|
|
5463
|
-
if (typeof global !== "undefined") return global;
|
|
5464
|
-
return null;
|
|
5465
|
-
}
|
|
5466
|
-
function readRuntimeMessages() {
|
|
5467
|
-
const scope = getGlobalScope();
|
|
5468
|
-
const candidate = scope && scope.CANOPY_LOCALE_MESSAGES;
|
|
5469
|
-
if (candidate && typeof candidate === "object") return candidate;
|
|
5470
|
-
return import_default_locale.default || {};
|
|
5471
|
-
}
|
|
5472
|
-
function accessPath(obj, path) {
|
|
5473
|
-
if (!obj || typeof obj !== "object" || !path) return void 0;
|
|
5474
|
-
const parts = Array.isArray(path) ? path : String(path).split(".");
|
|
5475
|
-
let current = obj;
|
|
5476
|
-
for (const part of parts) {
|
|
5477
|
-
if (!current || typeof current !== "object") return void 0;
|
|
5478
|
-
const key = String(part).trim();
|
|
5479
|
-
if (!key || !(key in current)) return void 0;
|
|
5480
|
-
current = current[key];
|
|
5481
|
-
}
|
|
5482
|
-
return current;
|
|
5483
|
-
}
|
|
5484
|
-
function formatTemplate(template, replacements = {}) {
|
|
5485
|
-
if (template == null) return template;
|
|
5486
|
-
const str = String(template);
|
|
5487
|
-
if (!replacements || typeof replacements !== "object") return str;
|
|
5488
|
-
return str.replace(/\{([^}]+)\}/g, (match, key) => {
|
|
5489
|
-
if (!Object.prototype.hasOwnProperty.call(replacements, key)) return match;
|
|
5490
|
-
const value = replacements[key];
|
|
5491
|
-
if (value == null) return match;
|
|
5492
|
-
return String(value);
|
|
5493
|
-
});
|
|
5494
|
-
}
|
|
5495
|
-
function useLocaleMessages() {
|
|
5496
|
-
const PageContext3 = getSafePageContext();
|
|
5497
|
-
const context = PageContext3 ? React12.useContext(PageContext3) : null;
|
|
5498
|
-
const siteMessages = context && context.site && context.site.localeMessages && typeof context.site.localeMessages === "object" ? context.site.localeMessages : null;
|
|
5499
|
-
return siteMessages || readRuntimeMessages();
|
|
5500
|
-
}
|
|
5501
|
-
function useLocale() {
|
|
5502
|
-
const messages = useLocaleMessages();
|
|
5503
|
-
const getString = React12.useCallback(
|
|
5504
|
-
(path, fallback) => {
|
|
5505
|
-
const value = path ? accessPath(messages, path) : void 0;
|
|
5506
|
-
if (typeof value === "string" || typeof value === "number") {
|
|
5507
|
-
return value;
|
|
5508
|
-
}
|
|
5509
|
-
return fallback;
|
|
5510
|
-
},
|
|
5511
|
-
[messages]
|
|
5512
|
-
);
|
|
5513
|
-
const formatString = React12.useCallback(
|
|
5514
|
-
(path, fallback, replacements) => {
|
|
5515
|
-
const template = path ? accessPath(messages, path) : void 0;
|
|
5516
|
-
const resolved = template != null ? template : fallback;
|
|
5517
|
-
if (resolved == null) return resolved;
|
|
5518
|
-
return formatTemplate(resolved, replacements);
|
|
5519
|
-
},
|
|
5520
|
-
[messages]
|
|
5521
|
-
);
|
|
5522
|
-
return { messages, getString, formatString };
|
|
5558
|
+
return /* @__PURE__ */ React12.createElement("div", { className: classes, ...rest }, text && /* @__PURE__ */ React12.createElement("span", { className: "canopy-button-group__text" }, text), /* @__PURE__ */ React12.createElement("div", { className: "canopy-button-group__actions" }, children));
|
|
5523
5559
|
}
|
|
5524
5560
|
|
|
5525
5561
|
// ui/src/interstitials/Hero.jsx
|
|
@@ -5557,17 +5593,6 @@ var NextArrowIcon = (props) => /* @__PURE__ */ React13.createElement(NavIconBase
|
|
|
5557
5593
|
strokeLinejoin: "round"
|
|
5558
5594
|
}
|
|
5559
5595
|
));
|
|
5560
|
-
var PauseIcon = (props) => /* @__PURE__ */ React13.createElement(NavIconBase, { ...props }, /* @__PURE__ */ React13.createElement("path", { d: "M5.5 3.5V12.5M10.5 3.5V12.5", stroke: "currentColor", strokeWidth: "1.618", strokeLinecap: "round" }));
|
|
5561
|
-
var PlayIcon = (props) => /* @__PURE__ */ React13.createElement(NavIconBase, { ...props }, /* @__PURE__ */ React13.createElement(
|
|
5562
|
-
"path",
|
|
5563
|
-
{
|
|
5564
|
-
d: "M5.5 3.5L12 8L5.5 12.5Z",
|
|
5565
|
-
fill: "currentColor",
|
|
5566
|
-
stroke: "currentColor",
|
|
5567
|
-
strokeWidth: "1.2",
|
|
5568
|
-
strokeLinejoin: "round"
|
|
5569
|
-
}
|
|
5570
|
-
));
|
|
5571
5596
|
var HERO_DEFAULT_SIZES_ATTR = "(min-width: 1024px) 1280px, 100vw";
|
|
5572
5597
|
var basePath = (() => {
|
|
5573
5598
|
try {
|
|
@@ -5874,28 +5899,12 @@ function Hero({
|
|
|
5874
5899
|
)
|
|
5875
5900
|
);
|
|
5876
5901
|
};
|
|
5877
|
-
const
|
|
5878
|
-
const startLabel = getString("common.carousel.start", "Play the slideshow");
|
|
5879
|
-
const renderCarousel = (options = {}) => /* @__PURE__ */ React13.createElement(React13.Fragment, null, isCarousel ? /* @__PURE__ */ React13.createElement(
|
|
5880
|
-
"button",
|
|
5881
|
-
{
|
|
5882
|
-
type: "button",
|
|
5883
|
-
className: "canopy-interstitial__rotation",
|
|
5884
|
-
"aria-label": stopLabel,
|
|
5885
|
-
"aria-controls": slidesId,
|
|
5886
|
-
"data-label-stop": stopLabel,
|
|
5887
|
-
"data-label-start": startLabel,
|
|
5888
|
-
"data-rotation": "on",
|
|
5889
|
-
hidden: true
|
|
5890
|
-
},
|
|
5891
|
-
/* @__PURE__ */ React13.createElement(PauseIcon, { className: "canopy-interstitial__rotation-icon canopy-interstitial__rotation-icon--pause" }),
|
|
5892
|
-
/* @__PURE__ */ React13.createElement(PlayIcon, { className: "canopy-interstitial__rotation-icon canopy-interstitial__rotation-icon--play" })
|
|
5893
|
-
) : null, /* @__PURE__ */ React13.createElement("div", { className: "canopy-interstitial__slider" }, /* @__PURE__ */ React13.createElement(
|
|
5902
|
+
const renderCarousel = (options = {}) => /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("div", { className: "canopy-interstitial__slider" }, /* @__PURE__ */ React13.createElement(
|
|
5894
5903
|
"div",
|
|
5895
5904
|
{
|
|
5896
5905
|
className: "canopy-interstitial__slide-wrapper",
|
|
5897
5906
|
id: slidesId,
|
|
5898
|
-
"aria-live": isCarousel ? "
|
|
5907
|
+
"aria-live": isCarousel ? "polite" : void 0
|
|
5899
5908
|
},
|
|
5900
5909
|
orderedSlides.map((slide, idx) => renderSlide(slide, idx, options))
|
|
5901
5910
|
), isCarousel ? /* @__PURE__ */ React13.createElement("div", { className: "canopy-interstitial__nav", hidden: true }, /* @__PURE__ */ React13.createElement(
|
|
@@ -7848,6 +7857,80 @@ function HeaderScript() {
|
|
|
7848
7857
|
|
|
7849
7858
|
ready(trackHeaderHeight);
|
|
7850
7859
|
|
|
7860
|
+
// The search at desktop widths: a button that opens into the field, the field gone back
|
|
7861
|
+
// into the button when it is left empty. Run as the header is read, so the field never
|
|
7862
|
+
// shows closed-to-open on load; without this script the field shows (the markup's own).
|
|
7863
|
+
// - The button says it is a disclosure (aria-expanded, aria-controls); opening it puts
|
|
7864
|
+
// focus in the field.
|
|
7865
|
+
// - Escape closes the suggestions first (the field's own script), then the field, and
|
|
7866
|
+
// focus goes back to the button. Leaving it empty, by Tab or a click, closes it too.
|
|
7867
|
+
// - The shortcut (Cmd or Ctrl K) opens it before the field's script focuses it.
|
|
7868
|
+
// - On the search page the field is the page's own, driving its results, so it stays
|
|
7869
|
+
// open there, with no button.
|
|
7870
|
+
function setupDesktopSearch() {
|
|
7871
|
+
var box = doc.querySelector('.canopy-header [data-canopy-header-search]');
|
|
7872
|
+
if (!box) return;
|
|
7873
|
+
var toggle = box.querySelector('.canopy-header__search-toggle');
|
|
7874
|
+
var input = box.querySelector('[data-canopy-search-form-input]');
|
|
7875
|
+
if (!toggle || !input) return;
|
|
7876
|
+
|
|
7877
|
+
function isOpen() {
|
|
7878
|
+
return box.getAttribute('data-expanded') === 'true';
|
|
7879
|
+
}
|
|
7880
|
+
function setOpen(open, focusTarget) {
|
|
7881
|
+
box.setAttribute('data-expanded', open ? 'true' : 'false');
|
|
7882
|
+
toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
|
|
7883
|
+
if (focusTarget && focusTarget.focus) {
|
|
7884
|
+
try { focusTarget.focus(); } catch (_) {}
|
|
7885
|
+
}
|
|
7886
|
+
}
|
|
7887
|
+
function suggesting() {
|
|
7888
|
+
var teaser = box.querySelector('.canopy-search-teaser');
|
|
7889
|
+
return !!(teaser && !teaser.hidden && !teaser.classList.contains('is-empty'));
|
|
7890
|
+
}
|
|
7891
|
+
function onSearchPage() {
|
|
7892
|
+
try {
|
|
7893
|
+
if (window.CanopySearchPage) return true;
|
|
7894
|
+
return /\\/search(\\/index\\.html)?\\/?$/.test(String(window.location.pathname || ''));
|
|
7895
|
+
} catch (_) {
|
|
7896
|
+
return false;
|
|
7897
|
+
}
|
|
7898
|
+
}
|
|
7899
|
+
|
|
7900
|
+
if (onSearchPage()) return;
|
|
7901
|
+
toggle.hidden = false;
|
|
7902
|
+
box.setAttribute('data-canopy-header-search', 'ready');
|
|
7903
|
+
setOpen(Boolean(input.value));
|
|
7904
|
+
|
|
7905
|
+
toggle.addEventListener('click', function () {
|
|
7906
|
+
setOpen(true, input);
|
|
7907
|
+
});
|
|
7908
|
+
|
|
7909
|
+
box.addEventListener('keydown', function (event) {
|
|
7910
|
+
if (event.key !== 'Escape' || !isOpen() || suggesting()) return;
|
|
7911
|
+
event.preventDefault();
|
|
7912
|
+
setOpen(false, toggle);
|
|
7913
|
+
}, true);
|
|
7914
|
+
|
|
7915
|
+
box.addEventListener('focusout', function () {
|
|
7916
|
+
setTimeout(function () {
|
|
7917
|
+
if (!isOpen() || input.value || box.contains(doc.activeElement)) return;
|
|
7918
|
+
setOpen(false);
|
|
7919
|
+
}, 0);
|
|
7920
|
+
});
|
|
7921
|
+
|
|
7922
|
+
doc.addEventListener('keydown', function (event) {
|
|
7923
|
+
if (!(event.metaKey || event.ctrlKey) || (event.key !== 'k' && event.key !== 'K')) return;
|
|
7924
|
+
if (isOpen()) return;
|
|
7925
|
+
try {
|
|
7926
|
+
if (!window.matchMedia(desktopBreakpointQuery()).matches) return;
|
|
7927
|
+
} catch (_) {}
|
|
7928
|
+
setOpen(true);
|
|
7929
|
+
}, true);
|
|
7930
|
+
}
|
|
7931
|
+
|
|
7932
|
+
setupDesktopSearch();
|
|
7933
|
+
|
|
7851
7934
|
ready(function () {
|
|
7852
7935
|
var header = doc.querySelector('.canopy-header');
|
|
7853
7936
|
if (!header) return;
|
|
@@ -8251,6 +8334,7 @@ function CanopyHeader(props = {}) {
|
|
|
8251
8334
|
const contextNavigation = context && context.navigation ? context.navigation : null;
|
|
8252
8335
|
const contextSite = context && context.site ? context.site : null;
|
|
8253
8336
|
const pageData = context && context.page ? context.page : null;
|
|
8337
|
+
const isSearchPage = Boolean(pageData && pageData.type === "search");
|
|
8254
8338
|
const contextSiteTitle = contextSite && typeof contextSite.title === "string" ? contextSite.title.trim() : "";
|
|
8255
8339
|
const siteLanguageToggle = contextSite && contextSite.languageToggle ? contextSite.languageToggle : null;
|
|
8256
8340
|
const siteRoutes = contextSite && contextSite.routes ? contextSite.routes : null;
|
|
@@ -8336,15 +8420,61 @@ function CanopyHeader(props = {}) {
|
|
|
8336
8420
|
Logo: SiteLogo
|
|
8337
8421
|
}
|
|
8338
8422
|
)),
|
|
8339
|
-
/* @__PURE__ */ React27.createElement(
|
|
8340
|
-
|
|
8423
|
+
/* @__PURE__ */ React27.createElement(
|
|
8424
|
+
"div",
|
|
8341
8425
|
{
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8426
|
+
className: "canopy-header__desktop-search",
|
|
8427
|
+
"data-canopy-header-search": isSearchPage ? void 0 : "",
|
|
8428
|
+
"data-expanded": "true"
|
|
8429
|
+
},
|
|
8430
|
+
isSearchPage ? null : /* @__PURE__ */ React27.createElement(
|
|
8431
|
+
"button",
|
|
8432
|
+
{
|
|
8433
|
+
type: "button",
|
|
8434
|
+
className: "canopy-header__search-toggle",
|
|
8435
|
+
"aria-expanded": "true",
|
|
8436
|
+
"aria-controls": "canopy-header-search-field",
|
|
8437
|
+
hidden: true
|
|
8438
|
+
},
|
|
8439
|
+
/* @__PURE__ */ React27.createElement(
|
|
8440
|
+
"svg",
|
|
8441
|
+
{
|
|
8442
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8443
|
+
viewBox: "0 0 24 24",
|
|
8444
|
+
fill: "none",
|
|
8445
|
+
stroke: "currentColor",
|
|
8446
|
+
strokeWidth: "1.75",
|
|
8447
|
+
"aria-hidden": "true",
|
|
8448
|
+
focusable: "false"
|
|
8449
|
+
},
|
|
8450
|
+
/* @__PURE__ */ React27.createElement(
|
|
8451
|
+
"path",
|
|
8452
|
+
{
|
|
8453
|
+
strokeLinecap: "round",
|
|
8454
|
+
strokeLinejoin: "round",
|
|
8455
|
+
d: "m21 21-3.8-3.8M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z"
|
|
8456
|
+
}
|
|
8457
|
+
)
|
|
8458
|
+
),
|
|
8459
|
+
/* @__PURE__ */ React27.createElement("span", null, resolvedSearchLabel)
|
|
8460
|
+
),
|
|
8461
|
+
/* @__PURE__ */ React27.createElement(
|
|
8462
|
+
"div",
|
|
8463
|
+
{
|
|
8464
|
+
id: "canopy-header-search-field",
|
|
8465
|
+
className: "canopy-header__search-field"
|
|
8466
|
+
},
|
|
8467
|
+
/* @__PURE__ */ React27.createElement(
|
|
8468
|
+
SearchPanel,
|
|
8469
|
+
{
|
|
8470
|
+
label: resolvedSearchLabel,
|
|
8471
|
+
hotkey: searchHotkey,
|
|
8472
|
+
placeholder: resolvedSearchPlaceholder,
|
|
8473
|
+
searchPath: normalizedSearchRoute
|
|
8474
|
+
}
|
|
8475
|
+
)
|
|
8476
|
+
)
|
|
8477
|
+
),
|
|
8348
8478
|
/* @__PURE__ */ React27.createElement(
|
|
8349
8479
|
"nav",
|
|
8350
8480
|
{
|
|
@@ -12370,8 +12500,8 @@ var GRAY_COLOR_NAMES = ["gray", "mauve", "slate", "sage", "olive", "sand"];
|
|
|
12370
12500
|
var APPEARANCES = ["light", "dark"];
|
|
12371
12501
|
var DEFAULTS = {
|
|
12372
12502
|
appearance: "light",
|
|
12373
|
-
accentColor: "
|
|
12374
|
-
grayColor: "
|
|
12503
|
+
accentColor: "gold",
|
|
12504
|
+
grayColor: "sand"
|
|
12375
12505
|
};
|
|
12376
12506
|
var Section = ({ title, description, children }) => /* @__PURE__ */ React57.createElement("div", { className: "canopy-theme-showcase__section" }, /* @__PURE__ */ React57.createElement("h3", { className: "canopy-theme-showcase__section-title" }, title), description ? /* @__PURE__ */ React57.createElement("p", { className: "canopy-theme-showcase__section-description" }, description) : null, children);
|
|
12377
12507
|
var ColorScaleRow = ({ label, prefix }) => /* @__PURE__ */ React57.createElement("div", { className: "canopy-theme-showcase__scale-row" }, /* @__PURE__ */ React57.createElement("div", { className: "canopy-theme-showcase__scale-label" }, /* @__PURE__ */ React57.createElement("strong", null, label)), /* @__PURE__ */ React57.createElement("div", { className: "canopy-theme-showcase__scale-track" }, import_theme_palette.LEVELS.map((stop) => /* @__PURE__ */ React57.createElement(
|