@canopy-iiif/app 1.4.11 → 1.4.13
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/package.json +1 -1
- package/ui/dist/index.mjs +127 -120
- package/ui/dist/index.mjs.map +4 -4
- package/ui/dist/server.mjs +119 -200
- package/ui/dist/server.mjs.map +4 -4
- package/ui/styles/components/{_biblography.scss → _bibliography.scss} +15 -15
- package/ui/styles/components/index.scss +1 -1
- package/ui/styles/components/search/_tabs.scss +6 -6
- package/ui/styles/index.css +21 -21
- package/ui/theme.js +0 -136
package/ui/dist/server.mjs
CHANGED
|
@@ -2415,7 +2415,7 @@ function References({
|
|
|
2415
2415
|
return /* @__PURE__ */ React26.createElement("dl", { className: containerClass, ...rest }, /* @__PURE__ */ React26.createElement("div", { className: "references__group" }, /* @__PURE__ */ React26.createElement("dt", null, title), entries.map((entry) => /* @__PURE__ */ React26.createElement("dd", { key: entry.href, className: "references__item" }, /* @__PURE__ */ React26.createElement("a", { href: entry.href }, entry.title || entry.href)))));
|
|
2416
2416
|
}
|
|
2417
2417
|
|
|
2418
|
-
// ui/src/content/
|
|
2418
|
+
// ui/src/content/Bibliography.jsx
|
|
2419
2419
|
import React27 from "react";
|
|
2420
2420
|
import bibliography from "@canopy-iiif/app/lib/components/bibliography.js";
|
|
2421
2421
|
function resolveHeadingTag(tag, fallback) {
|
|
@@ -2429,17 +2429,17 @@ function NoteBody({ note }) {
|
|
|
2429
2429
|
return /* @__PURE__ */ React27.createElement(
|
|
2430
2430
|
"div",
|
|
2431
2431
|
{
|
|
2432
|
-
className: "
|
|
2432
|
+
className: "bibliography__note-body",
|
|
2433
2433
|
dangerouslySetInnerHTML: { __html: note.html }
|
|
2434
2434
|
}
|
|
2435
2435
|
);
|
|
2436
2436
|
}
|
|
2437
2437
|
if (note.text) {
|
|
2438
|
-
return /* @__PURE__ */ React27.createElement("div", { className: "
|
|
2438
|
+
return /* @__PURE__ */ React27.createElement("div", { className: "bibliography__note-body" }, note.text);
|
|
2439
2439
|
}
|
|
2440
2440
|
return null;
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function Bibliography({
|
|
2443
2443
|
className = "",
|
|
2444
2444
|
pageHeadingTag = "h3"
|
|
2445
2445
|
} = {}) {
|
|
@@ -2452,13 +2452,13 @@ function Biblography({
|
|
|
2452
2452
|
}
|
|
2453
2453
|
if (!entries.length) return null;
|
|
2454
2454
|
const PageHeadingTag = resolveHeadingTag(pageHeadingTag, "h3");
|
|
2455
|
-
const rootClass = ["
|
|
2456
|
-
return /* @__PURE__ */ React27.createElement("section", { className: rootClass }, /* @__PURE__ */ React27.createElement("div", { className: "
|
|
2455
|
+
const rootClass = ["bibliography", className].filter(Boolean).join(" ");
|
|
2456
|
+
return /* @__PURE__ */ React27.createElement("section", { className: rootClass }, /* @__PURE__ */ React27.createElement("div", { className: "bibliography__pages" }, entries.map((entry) => {
|
|
2457
2457
|
const key = entry.href || entry.relativePath || entry.title;
|
|
2458
2458
|
const pageTitle = entry.title || entry.href;
|
|
2459
|
-
return /* @__PURE__ */ React27.createElement("article", { key, className: "
|
|
2459
|
+
return /* @__PURE__ */ React27.createElement("article", { key, className: "bibliography__page" }, /* @__PURE__ */ React27.createElement("header", { className: "bibliography__page-header" }, pageTitle ? /* @__PURE__ */ React27.createElement(PageHeadingTag, { className: "bibliography__page-title" }, pageTitle) : null, entry.href ? /* @__PURE__ */ React27.createElement("a", { className: "bibliography__page-link", href: entry.href }, entry.href) : null), /* @__PURE__ */ React27.createElement("ol", { className: "bibliography__notes" }, (entry.footnotes || []).map((note, idx) => {
|
|
2460
2460
|
const noteKey = `${key || "entry"}-${note.identifier || idx}`;
|
|
2461
|
-
return /* @__PURE__ */ React27.createElement("li", { key: noteKey, className: "
|
|
2461
|
+
return /* @__PURE__ */ React27.createElement("li", { key: noteKey, className: "bibliography__note" }, note.identifier ? /* @__PURE__ */ React27.createElement("span", { className: "bibliography__note-label" }, note.identifier) : null, /* @__PURE__ */ React27.createElement(NoteBody, { note }));
|
|
2462
2462
|
})));
|
|
2463
2463
|
})));
|
|
2464
2464
|
}
|
|
@@ -3836,8 +3836,14 @@ function RequiredStatement({ manifest, requiredStatement, ...rest }) {
|
|
|
3836
3836
|
return /* @__PURE__ */ React38.createElement(CloverRequiredStatement, { requiredStatement: stmt, ...rest });
|
|
3837
3837
|
}
|
|
3838
3838
|
|
|
3839
|
-
// ui/src/
|
|
3839
|
+
// ui/src/iiif/Properties/Id.jsx
|
|
3840
3840
|
import React39 from "react";
|
|
3841
|
+
function Id({ title = "IIIF Manifest", id, ...props }) {
|
|
3842
|
+
return /* @__PURE__ */ React39.createElement("dl", null, /* @__PURE__ */ React39.createElement("dt", null, title), /* @__PURE__ */ React39.createElement("dd", null, /* @__PURE__ */ React39.createElement("a", { href: id }, id)));
|
|
3843
|
+
}
|
|
3844
|
+
|
|
3845
|
+
// ui/src/docs/CodeBlock.jsx
|
|
3846
|
+
import React40 from "react";
|
|
3841
3847
|
function parseHighlightAttr(attr) {
|
|
3842
3848
|
if (!attr) return /* @__PURE__ */ new Set();
|
|
3843
3849
|
const cleaned = String(attr || "").trim();
|
|
@@ -3883,10 +3889,10 @@ var highlightBaseStyle = {
|
|
|
3883
3889
|
};
|
|
3884
3890
|
function DocsCodeBlock(props = {}) {
|
|
3885
3891
|
const { children, ...rest } = props;
|
|
3886
|
-
const childArray =
|
|
3887
|
-
const codeElement = childArray.find((el) =>
|
|
3892
|
+
const childArray = React40.Children.toArray(children);
|
|
3893
|
+
const codeElement = childArray.find((el) => React40.isValidElement(el));
|
|
3888
3894
|
if (!codeElement || !codeElement.props) {
|
|
3889
|
-
return
|
|
3895
|
+
return React40.createElement("pre", props);
|
|
3890
3896
|
}
|
|
3891
3897
|
const {
|
|
3892
3898
|
className = "",
|
|
@@ -3901,8 +3907,8 @@ function DocsCodeBlock(props = {}) {
|
|
|
3901
3907
|
const highlightSet = parseHighlightAttr(highlightAttr);
|
|
3902
3908
|
const copyAttr = codeProps["data-copy"];
|
|
3903
3909
|
const enableCopy = copyAttr !== void 0 ? copyAttr === true || copyAttr === "true" || copyAttr === "" : false;
|
|
3904
|
-
const [copied, setCopied] =
|
|
3905
|
-
const handleCopy =
|
|
3910
|
+
const [copied, setCopied] = React40.useState(false);
|
|
3911
|
+
const handleCopy = React40.useCallback(async () => {
|
|
3906
3912
|
const text = rawCode;
|
|
3907
3913
|
try {
|
|
3908
3914
|
if (typeof navigator !== "undefined" && navigator.clipboard && navigator.clipboard.writeText) {
|
|
@@ -3940,12 +3946,12 @@ function DocsCodeBlock(props = {}) {
|
|
|
3940
3946
|
fontWeight: 700,
|
|
3941
3947
|
background: "var(--color-accent-100)",
|
|
3942
3948
|
borderBottom: "1px solid var(--color-accent-200)",
|
|
3943
|
-
color: "var(--color-
|
|
3949
|
+
color: "var(--color-gray-900)"
|
|
3944
3950
|
};
|
|
3945
3951
|
const preStyle = {
|
|
3946
3952
|
margin: 0,
|
|
3947
3953
|
background: "var(--color-accent-100)",
|
|
3948
|
-
color: "var(--color-accent-
|
|
3954
|
+
color: "var(--color-accent-800)",
|
|
3949
3955
|
lineHeight: 1.55,
|
|
3950
3956
|
padding: "1rem 0",
|
|
3951
3957
|
overflowX: "auto"
|
|
@@ -3967,31 +3973,30 @@ function DocsCodeBlock(props = {}) {
|
|
|
3967
3973
|
const highlight = highlightSet.has(lineNumber);
|
|
3968
3974
|
const style = highlight ? { ...baseLineStyle, ...highlightBaseStyle } : baseLineStyle;
|
|
3969
3975
|
const displayLine = line === "" ? " " : line;
|
|
3970
|
-
return
|
|
3976
|
+
return React40.createElement(
|
|
3971
3977
|
"span",
|
|
3972
3978
|
{ key: lineNumber, style },
|
|
3973
|
-
|
|
3979
|
+
React40.createElement("span", { style: lineContentStyle }, displayLine)
|
|
3974
3980
|
);
|
|
3975
3981
|
});
|
|
3976
|
-
return
|
|
3982
|
+
return React40.createElement(
|
|
3977
3983
|
"div",
|
|
3978
3984
|
{ style: containerStyle },
|
|
3979
|
-
showHeader ?
|
|
3985
|
+
showHeader ? React40.createElement(
|
|
3980
3986
|
"div",
|
|
3981
3987
|
{ style: headerStyle },
|
|
3982
|
-
|
|
3983
|
-
enableCopy ?
|
|
3988
|
+
React40.createElement("span", null, showFilename ? filename : null),
|
|
3989
|
+
enableCopy ? React40.createElement(
|
|
3984
3990
|
"button",
|
|
3985
3991
|
{
|
|
3986
3992
|
type: "button",
|
|
3987
3993
|
onClick: handleCopy,
|
|
3988
3994
|
style: {
|
|
3989
|
-
border: "1px solid var(--color-accent-
|
|
3995
|
+
border: "1px solid var(--color-accent-200, )",
|
|
3990
3996
|
borderRadius: "6px",
|
|
3991
3997
|
padding: "0.2rem 0.55rem",
|
|
3992
3998
|
fontSize: "0.7rem",
|
|
3993
3999
|
fontWeight: 500,
|
|
3994
|
-
background: "color-mix(in srgb, var(--color-accent-100, #e0f2ff) 55%, #ffffff)",
|
|
3995
4000
|
color: "var(--color-accent-700, #1d4ed8)",
|
|
3996
4001
|
cursor: "pointer"
|
|
3997
4002
|
}
|
|
@@ -3999,29 +4004,29 @@ function DocsCodeBlock(props = {}) {
|
|
|
3999
4004
|
copied ? "Copied" : "Copy"
|
|
4000
4005
|
) : null
|
|
4001
4006
|
) : null,
|
|
4002
|
-
|
|
4007
|
+
React40.createElement(
|
|
4003
4008
|
"pre",
|
|
4004
4009
|
{ ...preRest, className: preClassName, style: mergedPreStyle },
|
|
4005
|
-
|
|
4010
|
+
React40.createElement("code", { style: codeStyle }, lineElements)
|
|
4006
4011
|
)
|
|
4007
4012
|
);
|
|
4008
4013
|
}
|
|
4009
4014
|
|
|
4010
4015
|
// ui/src/docs/MarkdownTable.jsx
|
|
4011
|
-
import
|
|
4016
|
+
import React41 from "react";
|
|
4012
4017
|
function MarkdownTable({ className = "", ...rest }) {
|
|
4013
4018
|
const merged = ["markdown-table", className].filter(Boolean).join(" ");
|
|
4014
|
-
return /* @__PURE__ */
|
|
4019
|
+
return /* @__PURE__ */ React41.createElement("div", { className: "markdown-table__frame" }, /* @__PURE__ */ React41.createElement("table", { className: merged, ...rest }));
|
|
4015
4020
|
}
|
|
4016
4021
|
|
|
4017
4022
|
// ui/src/docs/Diagram.jsx
|
|
4018
|
-
import
|
|
4023
|
+
import React42 from "react";
|
|
4019
4024
|
function CanopyDiagram() {
|
|
4020
|
-
return /* @__PURE__ */
|
|
4025
|
+
return /* @__PURE__ */ React42.createElement("div", { className: "canopy-diagram" }, /* @__PURE__ */ React42.createElement("section", { className: "canopy-diagram__section canopy-diagram__section--collections" }, /* @__PURE__ */ React42.createElement("h3", null, "IIIF Collection(s)"), /* @__PURE__ */ React42.createElement("span", { className: "canopy-diagram__section-summary" }, "Source collections contribute 105 total manifests that Canopy retrieves as-is via IIIF endpoints."), /* @__PURE__ */ React42.createElement("div", { className: "canopy-diagram__grid" }, /* @__PURE__ */ React42.createElement("article", null, /* @__PURE__ */ React42.createElement("h4", null, "Collection A"), /* @__PURE__ */ React42.createElement("ul", null, /* @__PURE__ */ React42.createElement("li", null, "70 Manifests"), /* @__PURE__ */ React42.createElement("li", null, "IIIF Images + A/V"), /* @__PURE__ */ React42.createElement("li", null, "Textual Annotations"))), /* @__PURE__ */ React42.createElement("article", null, /* @__PURE__ */ React42.createElement("h4", null, "Collection B"), /* @__PURE__ */ React42.createElement("ul", null, /* @__PURE__ */ React42.createElement("li", null, "35 Manifests"), /* @__PURE__ */ React42.createElement("li", null, "IIIF Images + A/V"), /* @__PURE__ */ React42.createElement("li", null, "Textual Annotations"))))), /* @__PURE__ */ React42.createElement("div", { className: "canopy-diagram__arrow", "aria-hidden": "true" }, /* @__PURE__ */ React42.createElement("span", { className: "canopy-diagram__arrow-line" }), /* @__PURE__ */ React42.createElement("span", { className: "canopy-diagram__arrow-head" })), /* @__PURE__ */ React42.createElement("section", { className: "canopy-diagram__section canopy-diagram__section--build" }, /* @__PURE__ */ React42.createElement("h3", null, "Canopy Build Process"), /* @__PURE__ */ React42.createElement("span", { className: "canopy-diagram__section-summary" }, "Canopy syncs manifests, page content, and annotations before bundling the site."), /* @__PURE__ */ React42.createElement("div", { className: "canopy-diagram__grid" }, /* @__PURE__ */ React42.createElement("article", null, /* @__PURE__ */ React42.createElement("h4", null, "Automated content"), /* @__PURE__ */ React42.createElement("ul", null, /* @__PURE__ */ React42.createElement("li", null, "105 manifests \u2192 105 work pages"), /* @__PURE__ */ React42.createElement("li", null, "One page per manifest"), /* @__PURE__ */ React42.createElement("li", null, "Customize page layout"))), /* @__PURE__ */ React42.createElement("article", null, /* @__PURE__ */ React42.createElement("h4", null, "Contextual content"), /* @__PURE__ */ React42.createElement("ul", null, /* @__PURE__ */ React42.createElement("li", null, "Markdown & MDX pages"), /* @__PURE__ */ React42.createElement("li", null, "Author narratives"), /* @__PURE__ */ React42.createElement("li", null, "Reference manifests inline"))), /* @__PURE__ */ React42.createElement("article", null, /* @__PURE__ */ React42.createElement("h4", null, "Search index"), /* @__PURE__ */ React42.createElement("ul", null, /* @__PURE__ */ React42.createElement("li", null, "Combines works + pages"), /* @__PURE__ */ React42.createElement("li", null, "Customize result layout"), /* @__PURE__ */ React42.createElement("li", null, "Optional annotations"))))), /* @__PURE__ */ React42.createElement("div", { className: "canopy-diagram__arrow", "aria-hidden": "true" }, /* @__PURE__ */ React42.createElement("span", { className: "canopy-diagram__arrow-line" }), /* @__PURE__ */ React42.createElement("span", { className: "canopy-diagram__arrow-head" })), /* @__PURE__ */ React42.createElement("section", { className: "canopy-diagram__section canopy-diagram__section--output" }, /* @__PURE__ */ React42.createElement("h3", null, "Static Digital Project"), /* @__PURE__ */ React42.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__ */ React42.createElement("div", { className: "canopy-diagram__grid" }, /* @__PURE__ */ React42.createElement("article", null, /* @__PURE__ */ React42.createElement("h4", null, "Work pages"), /* @__PURE__ */ React42.createElement("ul", null, /* @__PURE__ */ React42.createElement("li", null, "105 generated HTML pages"), /* @__PURE__ */ React42.createElement("li", null, "Each links back to source manifests"), /* @__PURE__ */ React42.createElement("li", null, "Styled with Canopy components"))), /* @__PURE__ */ React42.createElement("article", null, /* @__PURE__ */ React42.createElement("h4", null, "Custom pages"), /* @__PURE__ */ React42.createElement("ul", null, /* @__PURE__ */ React42.createElement("li", null, "Markdown & MDX-authored content"), /* @__PURE__ */ React42.createElement("li", null, "Reusable layouts for narratives"), /* @__PURE__ */ React42.createElement("li", null, "Embed IIIF media & interstitials"))), /* @__PURE__ */ React42.createElement("article", null, /* @__PURE__ */ React42.createElement("h4", null, "Search bundle"), /* @__PURE__ */ React42.createElement("ul", null, /* @__PURE__ */ React42.createElement("li", null, "Static FlexSearch index"), /* @__PURE__ */ React42.createElement("li", null, "Works + pages share records"), /* @__PURE__ */ React42.createElement("li", null, "Optional annotation dataset"))))));
|
|
4021
4026
|
}
|
|
4022
4027
|
|
|
4023
4028
|
// ui/src/docs/ThemeShowcase.jsx
|
|
4024
|
-
import
|
|
4029
|
+
import React43 from "react";
|
|
4025
4030
|
|
|
4026
4031
|
// ../../node_modules/@radix-ui/colors/index.mjs
|
|
4027
4032
|
var colors_exports = {};
|
|
@@ -7873,21 +7878,21 @@ var STEP_MAP = {
|
|
|
7873
7878
|
800: 11,
|
|
7874
7879
|
900: 12
|
|
7875
7880
|
};
|
|
7876
|
-
var Section = ({ title, description, children }) => /* @__PURE__ */
|
|
7877
|
-
var ColorScaleRow = ({ label, prefix }) => /* @__PURE__ */
|
|
7881
|
+
var Section = ({ title, description, children }) => /* @__PURE__ */ React43.createElement("div", { className: "canopy-theme-showcase__section" }, /* @__PURE__ */ React43.createElement("h3", { className: "canopy-theme-showcase__section-title" }, title), description ? /* @__PURE__ */ React43.createElement("p", { className: "canopy-theme-showcase__section-description" }, description) : null, children);
|
|
7882
|
+
var ColorScaleRow = ({ label, prefix }) => /* @__PURE__ */ React43.createElement("div", { className: "canopy-theme-showcase__scale-row" }, /* @__PURE__ */ React43.createElement("div", { className: "canopy-theme-showcase__scale-label" }, /* @__PURE__ */ React43.createElement("strong", null, label)), /* @__PURE__ */ React43.createElement("div", { className: "canopy-theme-showcase__scale-track" }, COLOR_STOPS.map((stop) => /* @__PURE__ */ React43.createElement(
|
|
7878
7883
|
"div",
|
|
7879
7884
|
{
|
|
7880
7885
|
key: `${label}-${stop}`,
|
|
7881
7886
|
className: "canopy-theme-showcase__scale-stop"
|
|
7882
7887
|
},
|
|
7883
|
-
/* @__PURE__ */
|
|
7888
|
+
/* @__PURE__ */ React43.createElement(
|
|
7884
7889
|
"span",
|
|
7885
7890
|
{
|
|
7886
7891
|
className: "canopy-theme-showcase__scale-chip",
|
|
7887
7892
|
style: { backgroundColor: `var(${prefix}-${stop})` }
|
|
7888
7893
|
}
|
|
7889
7894
|
),
|
|
7890
|
-
/* @__PURE__ */
|
|
7895
|
+
/* @__PURE__ */ React43.createElement("span", { className: "canopy-theme-showcase__scale-token" }, stop)
|
|
7891
7896
|
))));
|
|
7892
7897
|
var AVAILABLE = new Set(
|
|
7893
7898
|
Object.keys(colors_exports).filter(
|
|
@@ -7898,108 +7903,6 @@ function normalizeAppearance(raw) {
|
|
|
7898
7903
|
if (!raw) return "light";
|
|
7899
7904
|
return String(raw).trim().toLowerCase() === "dark" ? "dark" : "light";
|
|
7900
7905
|
}
|
|
7901
|
-
function darkenHex(hex, amount = 0.15) {
|
|
7902
|
-
if (!hex) return hex;
|
|
7903
|
-
const normalized = hex.replace("#", "");
|
|
7904
|
-
if (!/^[0-9a-fA-F]{6}$/.test(normalized)) return hex;
|
|
7905
|
-
const num = parseInt(normalized, 16);
|
|
7906
|
-
const r = num >> 16 & 255;
|
|
7907
|
-
const g = num >> 8 & 255;
|
|
7908
|
-
const b = num & 255;
|
|
7909
|
-
const clamp = (value) => Math.max(0, Math.min(255, Math.round(value)));
|
|
7910
|
-
const toHex = (value) => clamp(value).toString(16).padStart(2, "0");
|
|
7911
|
-
const factor = 1 - amount;
|
|
7912
|
-
return `#${toHex(r * factor)}${toHex(g * factor)}${toHex(b * factor)}`;
|
|
7913
|
-
}
|
|
7914
|
-
function lightenHex(hex, amount = 0.15) {
|
|
7915
|
-
if (!hex) return hex;
|
|
7916
|
-
const normalized = hex.replace("#", "");
|
|
7917
|
-
if (!/^[0-9a-fA-F]{6}$/.test(normalized)) return hex;
|
|
7918
|
-
const num = parseInt(normalized, 16);
|
|
7919
|
-
const r = num >> 16 & 255;
|
|
7920
|
-
const g = num >> 8 & 255;
|
|
7921
|
-
const b = num & 255;
|
|
7922
|
-
const clamp = (value) => Math.max(0, Math.min(255, Math.round(value)));
|
|
7923
|
-
const toHex = (value) => clamp(value).toString(16).padStart(2, "0");
|
|
7924
|
-
const adjust = (value) => value + (255 - value) * amount;
|
|
7925
|
-
return `#${toHex(adjust(r))}${toHex(adjust(g))}${toHex(adjust(b))}`;
|
|
7926
|
-
}
|
|
7927
|
-
function adjustSaturation(hex, amount = 0.15) {
|
|
7928
|
-
if (!hex) return hex;
|
|
7929
|
-
const normalized = hex.replace("#", "");
|
|
7930
|
-
if (!/^[0-9a-fA-F]{6}$/.test(normalized)) return hex;
|
|
7931
|
-
const num = parseInt(normalized, 16);
|
|
7932
|
-
let r = (num >> 16 & 255) / 255;
|
|
7933
|
-
let g = (num >> 8 & 255) / 255;
|
|
7934
|
-
let b = (num & 255) / 255;
|
|
7935
|
-
const max = Math.max(r, g, b);
|
|
7936
|
-
const min = Math.min(r, g, b);
|
|
7937
|
-
let h = 0;
|
|
7938
|
-
let s = 0;
|
|
7939
|
-
const l = (max + min) / 2;
|
|
7940
|
-
if (max !== min) {
|
|
7941
|
-
const d = max - min;
|
|
7942
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
7943
|
-
switch (max) {
|
|
7944
|
-
case r:
|
|
7945
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
7946
|
-
break;
|
|
7947
|
-
case g:
|
|
7948
|
-
h = (b - r) / d + 2;
|
|
7949
|
-
break;
|
|
7950
|
-
default:
|
|
7951
|
-
h = (r - g) / d + 4;
|
|
7952
|
-
}
|
|
7953
|
-
h /= 6;
|
|
7954
|
-
}
|
|
7955
|
-
const delta = Number(amount);
|
|
7956
|
-
if (!Number.isFinite(delta) || delta === 0) return hex;
|
|
7957
|
-
s = Math.max(0, Math.min(1, s + delta));
|
|
7958
|
-
const hueToRgb = (p, q, t) => {
|
|
7959
|
-
if (t < 0) t += 1;
|
|
7960
|
-
if (t > 1) t -= 1;
|
|
7961
|
-
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
7962
|
-
if (t < 1 / 2) return q;
|
|
7963
|
-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
7964
|
-
return p;
|
|
7965
|
-
};
|
|
7966
|
-
let rOut;
|
|
7967
|
-
let gOut;
|
|
7968
|
-
let bOut;
|
|
7969
|
-
if (s === 0) {
|
|
7970
|
-
rOut = gOut = bOut = l;
|
|
7971
|
-
} else {
|
|
7972
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
7973
|
-
const p = 2 * l - q;
|
|
7974
|
-
rOut = hueToRgb(p, q, h + 1 / 3);
|
|
7975
|
-
gOut = hueToRgb(p, q, h);
|
|
7976
|
-
bOut = hueToRgb(p, q, h - 1 / 3);
|
|
7977
|
-
}
|
|
7978
|
-
const toHex = (value) => Math.round(Math.max(0, Math.min(1, value)) * 255).toString(16).padStart(2, "0");
|
|
7979
|
-
return `#${toHex(rOut)}${toHex(gOut)}${toHex(bOut)}`;
|
|
7980
|
-
}
|
|
7981
|
-
function mixHexColors(colorA, colorB, amount = 0.5) {
|
|
7982
|
-
const normalize = (hex) => hex && /^[0-9a-fA-F]{6}$/.test(hex.replace("#", "")) ? hex.replace("#", "") : null;
|
|
7983
|
-
const first = normalize(colorA);
|
|
7984
|
-
const second = normalize(colorB);
|
|
7985
|
-
if (!first || !second) return colorA || colorB || null;
|
|
7986
|
-
const a = parseInt(first, 16);
|
|
7987
|
-
const b = parseInt(second, 16);
|
|
7988
|
-
const clampAmount = Math.max(0, Math.min(1, Number(amount) || 0));
|
|
7989
|
-
const mixChannel = (shift) => Math.round(
|
|
7990
|
-
(a >> shift & 255) + ((b >> shift & 255) - (a >> shift & 255)) * clampAmount
|
|
7991
|
-
);
|
|
7992
|
-
const toHex = (value) => value.toString(16).padStart(2, "0");
|
|
7993
|
-
const r = mixChannel(16);
|
|
7994
|
-
const g = mixChannel(8);
|
|
7995
|
-
const bl = mixChannel(0);
|
|
7996
|
-
return `#${toHex(r)}${toHex(g)}${toHex(bl)}`;
|
|
7997
|
-
}
|
|
7998
|
-
function normalizeDarkenAmount(raw) {
|
|
7999
|
-
const value = Number(raw);
|
|
8000
|
-
if (!Number.isFinite(value)) return null;
|
|
8001
|
-
return Math.min(0.95, Math.max(0, value));
|
|
8002
|
-
}
|
|
8003
7906
|
function resolveRadixPalette(name, appearance) {
|
|
8004
7907
|
if (!name || !AVAILABLE.has(name)) return null;
|
|
8005
7908
|
const paletteKey = appearance === "dark" ? `${name}Dark` : name;
|
|
@@ -8014,7 +7917,6 @@ function toTailwindScale(name, options = {}) {
|
|
|
8014
7917
|
const palette = resolveRadixPalette(name, appearance);
|
|
8015
7918
|
if (!palette) return null;
|
|
8016
7919
|
const scale = {};
|
|
8017
|
-
const darken900Amount = normalizeDarkenAmount(options.darken900Amount);
|
|
8018
7920
|
for (const lvl of LEVELS) {
|
|
8019
7921
|
const radixStep = STEP_MAP[lvl];
|
|
8020
7922
|
const key = `${name}${radixStep}`;
|
|
@@ -8022,20 +7924,6 @@ function toTailwindScale(name, options = {}) {
|
|
|
8022
7924
|
if (!value) return null;
|
|
8023
7925
|
scale[lvl] = value;
|
|
8024
7926
|
}
|
|
8025
|
-
const saturate700 = options.saturate700 !== false;
|
|
8026
|
-
if (scale["700"]) {
|
|
8027
|
-
let adjusted = appearance === "dark" ? lightenHex(scale["700"], 0.15) : darkenHex(scale["700"], 0.15);
|
|
8028
|
-
if (saturate700) adjusted = adjustSaturation(adjusted, 0.15);
|
|
8029
|
-
scale["700"] = adjusted;
|
|
8030
|
-
}
|
|
8031
|
-
const darkestKey = `${name}${STEP_MAP["900"]}`;
|
|
8032
|
-
if (scale["800"] && palette[darkestKey]) {
|
|
8033
|
-
const amount = darken900Amount != null ? darken900Amount : 0.25;
|
|
8034
|
-
scale["900"] = appearance === "dark" ? lightenHex(palette[darkestKey], amount) : darkenHex(palette[darkestKey], amount);
|
|
8035
|
-
}
|
|
8036
|
-
if (scale["800"] && scale["900"]) {
|
|
8037
|
-
scale["800"] = mixHexColors(scale["800"], scale["900"], 0.65);
|
|
8038
|
-
}
|
|
8039
7927
|
return scale;
|
|
8040
7928
|
}
|
|
8041
7929
|
function buildPreviewData() {
|
|
@@ -8069,9 +7957,9 @@ var PREVIEW_DATA = buildPreviewData();
|
|
|
8069
7957
|
function encodeJson(value) {
|
|
8070
7958
|
return JSON.stringify(value).replace(/</g, "\\u003c");
|
|
8071
7959
|
}
|
|
8072
|
-
var ColorsLabeled = ({ colors, type, getRadixSwatch }) => /* @__PURE__ */
|
|
7960
|
+
var ColorsLabeled = ({ colors, type, getRadixSwatch }) => /* @__PURE__ */ React43.createElement("div", { className: "canopy-theme-showcase__swatch-grid" }, colors.map((name) => {
|
|
8073
7961
|
const colorValue = getRadixSwatch(name);
|
|
8074
|
-
return /* @__PURE__ */
|
|
7962
|
+
return /* @__PURE__ */ React43.createElement(
|
|
8075
7963
|
"button",
|
|
8076
7964
|
{
|
|
8077
7965
|
key: `${type}-${name}`,
|
|
@@ -8082,14 +7970,14 @@ var ColorsLabeled = ({ colors, type, getRadixSwatch }) => /* @__PURE__ */ React4
|
|
|
8082
7970
|
"data-theme-swatch-value": name,
|
|
8083
7971
|
"aria-pressed": "false"
|
|
8084
7972
|
},
|
|
8085
|
-
/* @__PURE__ */
|
|
7973
|
+
/* @__PURE__ */ React43.createElement(
|
|
8086
7974
|
"span",
|
|
8087
7975
|
{
|
|
8088
7976
|
className: "canopy-theme-showcase__swatch-chip",
|
|
8089
7977
|
style: { background: colorValue || "var(--color-gray-200)" }
|
|
8090
7978
|
}
|
|
8091
7979
|
),
|
|
8092
|
-
/* @__PURE__ */
|
|
7980
|
+
/* @__PURE__ */ React43.createElement("span", { className: "canopy-theme-showcase__swatch-label" }, name)
|
|
8093
7981
|
);
|
|
8094
7982
|
}));
|
|
8095
7983
|
function ThemeShowcase() {
|
|
@@ -8104,10 +7992,6 @@ function ThemeShowcase() {
|
|
|
8104
7992
|
const styles = `
|
|
8105
7993
|
.canopy-theme-showcase {
|
|
8106
7994
|
margin: 2.618rem 0;
|
|
8107
|
-
padding: 1.5rem;
|
|
8108
|
-
border: 1px solid color-mix(in srgb, var(--color-gray-400) 40%, transparent);
|
|
8109
|
-
border-radius: 0.85rem;
|
|
8110
|
-
background: color-mix(in srgb, var(--color-gray-50) 78%, transparent);
|
|
8111
7995
|
}
|
|
8112
7996
|
.canopy-theme-showcase__appearance-buttons {
|
|
8113
7997
|
display: inline-flex;
|
|
@@ -8222,7 +8106,8 @@ function ThemeShowcase() {
|
|
|
8222
8106
|
align-items: center;
|
|
8223
8107
|
gap: 0.35rem;
|
|
8224
8108
|
cursor: pointer;
|
|
8225
|
-
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
|
8109
|
+
transition: border-color 0.2s ease, box-shadow 0.2s ease background 0.2s ease, color 0.2s ease;
|
|
8110
|
+
font-weight: 300;
|
|
8226
8111
|
}
|
|
8227
8112
|
.canopy-theme-showcase__swatch:focus-visible {
|
|
8228
8113
|
outline: 2px solid var(--color-accent-default);
|
|
@@ -8231,6 +8116,14 @@ function ThemeShowcase() {
|
|
|
8231
8116
|
.canopy-theme-showcase__swatch[data-swatch-active="true"] {
|
|
8232
8117
|
border-color: var(--color-accent-default);
|
|
8233
8118
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent-200) 70%, transparent);
|
|
8119
|
+
background: linear-gradient(135deg, var(--color-accent-50), var(--color-accent-100));
|
|
8120
|
+
color: var(--color-gray-900);
|
|
8121
|
+
font-weight: 400;
|
|
8122
|
+
}
|
|
8123
|
+
.canopy-theme-showcase__swatch[data-swatch-active="true"][data-theme-swatch-type="gray"] {
|
|
8124
|
+
border-color: var(--color-gray-default);
|
|
8125
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-gray-200) 70%, transparent);
|
|
8126
|
+
background: linear-gradient(135deg, var(--color-gray-50), var(--color-gray-100));
|
|
8234
8127
|
}
|
|
8235
8128
|
.canopy-theme-showcase__swatch-chip {
|
|
8236
8129
|
width: 100%;
|
|
@@ -8238,51 +8131,62 @@ function ThemeShowcase() {
|
|
|
8238
8131
|
border-radius: 0.5rem;
|
|
8239
8132
|
}
|
|
8240
8133
|
.canopy-theme-showcase__swatch-label {
|
|
8241
|
-
font-size: 0.
|
|
8134
|
+
font-size: 0.9222rem;
|
|
8242
8135
|
margin-top: 0.1rem;
|
|
8243
|
-
font-weight: 500;
|
|
8244
|
-
text-transform: capitalize;
|
|
8245
8136
|
}
|
|
8246
8137
|
.canopy-theme-showcase__swatch-controls { display: none; }
|
|
8247
8138
|
.canopy-theme-showcase__clear-button { display: none; }
|
|
8248
8139
|
`;
|
|
8249
|
-
return /* @__PURE__ */
|
|
8250
|
-
|
|
8251
|
-
{
|
|
8252
|
-
title: "Appearance",
|
|
8253
|
-
description: "Pick the base light or dark mode for the theme preview."
|
|
8254
|
-
},
|
|
8255
|
-
/* @__PURE__ */ React42.createElement("div", { className: "canopy-theme-showcase__appearance-buttons" }, ["light", "dark"].map((mode) => {
|
|
8256
|
-
const label = `${mode.charAt(0).toUpperCase()}${mode.slice(1)}`;
|
|
8257
|
-
const baseClass = "canopy-theme-showcase__appearance-button";
|
|
8258
|
-
const isDefault = mode === DEFAULTS.appearance;
|
|
8259
|
-
const className = isDefault ? `${baseClass} is-active` : baseClass;
|
|
8260
|
-
return /* @__PURE__ */ React42.createElement(
|
|
8261
|
-
"button",
|
|
8262
|
-
{
|
|
8263
|
-
key: mode,
|
|
8264
|
-
type: "button",
|
|
8265
|
-
className,
|
|
8266
|
-
"data-theme-appearance": mode
|
|
8267
|
-
},
|
|
8268
|
-
label
|
|
8269
|
-
);
|
|
8270
|
-
}))
|
|
8271
|
-
), /* @__PURE__ */ React42.createElement(
|
|
8272
|
-
"button",
|
|
8140
|
+
return /* @__PURE__ */ React43.createElement("div", { className: "canopy-theme-showcase", "data-theme-showcase": true }, /* @__PURE__ */ React43.createElement("style", { dangerouslySetInnerHTML: { __html: styles } }), /* @__PURE__ */ React43.createElement(
|
|
8141
|
+
"div",
|
|
8273
8142
|
{
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8143
|
+
style: {
|
|
8144
|
+
display: "flex",
|
|
8145
|
+
justifyContent: "space-between",
|
|
8146
|
+
alignItems: "flex-start",
|
|
8147
|
+
gap: "1rem",
|
|
8148
|
+
marginBottom: "1rem"
|
|
8149
|
+
}
|
|
8277
8150
|
},
|
|
8278
|
-
|
|
8279
|
-
|
|
8151
|
+
/* @__PURE__ */ React43.createElement(
|
|
8152
|
+
Section,
|
|
8153
|
+
{
|
|
8154
|
+
title: "Appearance",
|
|
8155
|
+
description: "Pick the base light or dark mode for the theme preview."
|
|
8156
|
+
},
|
|
8157
|
+
/* @__PURE__ */ React43.createElement("div", { className: "canopy-theme-showcase__appearance-buttons" }, ["light", "dark"].map((mode) => {
|
|
8158
|
+
const label = `${mode.charAt(0).toUpperCase()}${mode.slice(1)}`;
|
|
8159
|
+
const baseClass = "canopy-theme-showcase__appearance-button";
|
|
8160
|
+
const isDefault = mode === DEFAULTS.appearance;
|
|
8161
|
+
const className = isDefault ? `${baseClass} is-active` : baseClass;
|
|
8162
|
+
return /* @__PURE__ */ React43.createElement(
|
|
8163
|
+
"button",
|
|
8164
|
+
{
|
|
8165
|
+
key: mode,
|
|
8166
|
+
type: "button",
|
|
8167
|
+
className,
|
|
8168
|
+
"data-theme-appearance": mode
|
|
8169
|
+
},
|
|
8170
|
+
label
|
|
8171
|
+
);
|
|
8172
|
+
}))
|
|
8173
|
+
),
|
|
8174
|
+
/* @__PURE__ */ React43.createElement(
|
|
8175
|
+
"button",
|
|
8176
|
+
{
|
|
8177
|
+
type: "button",
|
|
8178
|
+
className: "canopy-theme-showcase__reset",
|
|
8179
|
+
"data-theme-reset": true
|
|
8180
|
+
},
|
|
8181
|
+
"Reset"
|
|
8182
|
+
)
|
|
8183
|
+
), /* @__PURE__ */ React43.createElement(
|
|
8280
8184
|
Section,
|
|
8281
8185
|
{
|
|
8282
8186
|
title: "Color scales",
|
|
8283
8187
|
description: "Accent and gray ramps from the active theme."
|
|
8284
8188
|
},
|
|
8285
|
-
/* @__PURE__ */
|
|
8189
|
+
/* @__PURE__ */ React43.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "1.5rem" } }, COLOR_SCALES.map((scale) => /* @__PURE__ */ React43.createElement(
|
|
8286
8190
|
ColorScaleRow,
|
|
8287
8191
|
{
|
|
8288
8192
|
key: scale.label,
|
|
@@ -8290,21 +8194,35 @@ function ThemeShowcase() {
|
|
|
8290
8194
|
prefix: scale.prefix
|
|
8291
8195
|
}
|
|
8292
8196
|
)))
|
|
8293
|
-
), /* @__PURE__ */
|
|
8197
|
+
), /* @__PURE__ */ React43.createElement(
|
|
8294
8198
|
Section,
|
|
8295
8199
|
{
|
|
8296
8200
|
title: "Accent color palette options",
|
|
8297
8201
|
description: "Click a swatch to temporarily override the accent palette."
|
|
8298
8202
|
},
|
|
8299
|
-
/* @__PURE__ */
|
|
8300
|
-
|
|
8203
|
+
/* @__PURE__ */ React43.createElement(
|
|
8204
|
+
ColorsLabeled,
|
|
8205
|
+
{
|
|
8206
|
+
colors: accentColors,
|
|
8207
|
+
type: "accent",
|
|
8208
|
+
getRadixSwatch
|
|
8209
|
+
}
|
|
8210
|
+
)
|
|
8211
|
+
), /* @__PURE__ */ React43.createElement(
|
|
8301
8212
|
Section,
|
|
8302
8213
|
{
|
|
8303
8214
|
title: "Gray color palette options",
|
|
8304
8215
|
description: "Click a swatch to preview the neutral ramp for surfaces and text."
|
|
8305
8216
|
},
|
|
8306
|
-
/* @__PURE__ */
|
|
8307
|
-
|
|
8217
|
+
/* @__PURE__ */ React43.createElement(
|
|
8218
|
+
ColorsLabeled,
|
|
8219
|
+
{
|
|
8220
|
+
colors: grayColors,
|
|
8221
|
+
type: "gray",
|
|
8222
|
+
getRadixSwatch
|
|
8223
|
+
}
|
|
8224
|
+
)
|
|
8225
|
+
), /* @__PURE__ */ React43.createElement(
|
|
8308
8226
|
"script",
|
|
8309
8227
|
{
|
|
8310
8228
|
type: "application/json",
|
|
@@ -8314,7 +8232,7 @@ function ThemeShowcase() {
|
|
|
8314
8232
|
));
|
|
8315
8233
|
}
|
|
8316
8234
|
export {
|
|
8317
|
-
|
|
8235
|
+
Bibliography,
|
|
8318
8236
|
Button,
|
|
8319
8237
|
ButtonWrapper,
|
|
8320
8238
|
CanopyBrand,
|
|
@@ -8328,6 +8246,7 @@ export {
|
|
|
8328
8246
|
MarkdownTable as DocsMarkdownTable,
|
|
8329
8247
|
GoogleAnalytics,
|
|
8330
8248
|
HelloWorld,
|
|
8249
|
+
Id,
|
|
8331
8250
|
Image,
|
|
8332
8251
|
interstitials_exports as Interstitials,
|
|
8333
8252
|
Label,
|