@canopy-iiif/app 1.4.12 → 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/server.mjs +71 -159
- package/ui/dist/server.mjs.map +3 -3
- package/ui/theme.js +0 -136
package/package.json
CHANGED
package/ui/dist/server.mjs
CHANGED
|
@@ -3946,12 +3946,12 @@ function DocsCodeBlock(props = {}) {
|
|
|
3946
3946
|
fontWeight: 700,
|
|
3947
3947
|
background: "var(--color-accent-100)",
|
|
3948
3948
|
borderBottom: "1px solid var(--color-accent-200)",
|
|
3949
|
-
color: "var(--color-
|
|
3949
|
+
color: "var(--color-gray-900)"
|
|
3950
3950
|
};
|
|
3951
3951
|
const preStyle = {
|
|
3952
3952
|
margin: 0,
|
|
3953
3953
|
background: "var(--color-accent-100)",
|
|
3954
|
-
color: "var(--color-accent-
|
|
3954
|
+
color: "var(--color-accent-800)",
|
|
3955
3955
|
lineHeight: 1.55,
|
|
3956
3956
|
padding: "1rem 0",
|
|
3957
3957
|
overflowX: "auto"
|
|
@@ -3992,12 +3992,11 @@ function DocsCodeBlock(props = {}) {
|
|
|
3992
3992
|
type: "button",
|
|
3993
3993
|
onClick: handleCopy,
|
|
3994
3994
|
style: {
|
|
3995
|
-
border: "1px solid var(--color-accent-
|
|
3995
|
+
border: "1px solid var(--color-accent-200, )",
|
|
3996
3996
|
borderRadius: "6px",
|
|
3997
3997
|
padding: "0.2rem 0.55rem",
|
|
3998
3998
|
fontSize: "0.7rem",
|
|
3999
3999
|
fontWeight: 500,
|
|
4000
|
-
background: "color-mix(in srgb, var(--color-accent-100, #e0f2ff) 55%, #ffffff)",
|
|
4001
4000
|
color: "var(--color-accent-700, #1d4ed8)",
|
|
4002
4001
|
cursor: "pointer"
|
|
4003
4002
|
}
|
|
@@ -7904,108 +7903,6 @@ function normalizeAppearance(raw) {
|
|
|
7904
7903
|
if (!raw) return "light";
|
|
7905
7904
|
return String(raw).trim().toLowerCase() === "dark" ? "dark" : "light";
|
|
7906
7905
|
}
|
|
7907
|
-
function darkenHex(hex, amount = 0.15) {
|
|
7908
|
-
if (!hex) return hex;
|
|
7909
|
-
const normalized = hex.replace("#", "");
|
|
7910
|
-
if (!/^[0-9a-fA-F]{6}$/.test(normalized)) return hex;
|
|
7911
|
-
const num = parseInt(normalized, 16);
|
|
7912
|
-
const r = num >> 16 & 255;
|
|
7913
|
-
const g = num >> 8 & 255;
|
|
7914
|
-
const b = num & 255;
|
|
7915
|
-
const clamp = (value) => Math.max(0, Math.min(255, Math.round(value)));
|
|
7916
|
-
const toHex = (value) => clamp(value).toString(16).padStart(2, "0");
|
|
7917
|
-
const factor = 1 - amount;
|
|
7918
|
-
return `#${toHex(r * factor)}${toHex(g * factor)}${toHex(b * factor)}`;
|
|
7919
|
-
}
|
|
7920
|
-
function lightenHex(hex, amount = 0.15) {
|
|
7921
|
-
if (!hex) return hex;
|
|
7922
|
-
const normalized = hex.replace("#", "");
|
|
7923
|
-
if (!/^[0-9a-fA-F]{6}$/.test(normalized)) return hex;
|
|
7924
|
-
const num = parseInt(normalized, 16);
|
|
7925
|
-
const r = num >> 16 & 255;
|
|
7926
|
-
const g = num >> 8 & 255;
|
|
7927
|
-
const b = num & 255;
|
|
7928
|
-
const clamp = (value) => Math.max(0, Math.min(255, Math.round(value)));
|
|
7929
|
-
const toHex = (value) => clamp(value).toString(16).padStart(2, "0");
|
|
7930
|
-
const adjust = (value) => value + (255 - value) * amount;
|
|
7931
|
-
return `#${toHex(adjust(r))}${toHex(adjust(g))}${toHex(adjust(b))}`;
|
|
7932
|
-
}
|
|
7933
|
-
function adjustSaturation(hex, amount = 0.15) {
|
|
7934
|
-
if (!hex) return hex;
|
|
7935
|
-
const normalized = hex.replace("#", "");
|
|
7936
|
-
if (!/^[0-9a-fA-F]{6}$/.test(normalized)) return hex;
|
|
7937
|
-
const num = parseInt(normalized, 16);
|
|
7938
|
-
let r = (num >> 16 & 255) / 255;
|
|
7939
|
-
let g = (num >> 8 & 255) / 255;
|
|
7940
|
-
let b = (num & 255) / 255;
|
|
7941
|
-
const max = Math.max(r, g, b);
|
|
7942
|
-
const min = Math.min(r, g, b);
|
|
7943
|
-
let h = 0;
|
|
7944
|
-
let s = 0;
|
|
7945
|
-
const l = (max + min) / 2;
|
|
7946
|
-
if (max !== min) {
|
|
7947
|
-
const d = max - min;
|
|
7948
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
7949
|
-
switch (max) {
|
|
7950
|
-
case r:
|
|
7951
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
7952
|
-
break;
|
|
7953
|
-
case g:
|
|
7954
|
-
h = (b - r) / d + 2;
|
|
7955
|
-
break;
|
|
7956
|
-
default:
|
|
7957
|
-
h = (r - g) / d + 4;
|
|
7958
|
-
}
|
|
7959
|
-
h /= 6;
|
|
7960
|
-
}
|
|
7961
|
-
const delta = Number(amount);
|
|
7962
|
-
if (!Number.isFinite(delta) || delta === 0) return hex;
|
|
7963
|
-
s = Math.max(0, Math.min(1, s + delta));
|
|
7964
|
-
const hueToRgb = (p, q, t) => {
|
|
7965
|
-
if (t < 0) t += 1;
|
|
7966
|
-
if (t > 1) t -= 1;
|
|
7967
|
-
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
7968
|
-
if (t < 1 / 2) return q;
|
|
7969
|
-
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
7970
|
-
return p;
|
|
7971
|
-
};
|
|
7972
|
-
let rOut;
|
|
7973
|
-
let gOut;
|
|
7974
|
-
let bOut;
|
|
7975
|
-
if (s === 0) {
|
|
7976
|
-
rOut = gOut = bOut = l;
|
|
7977
|
-
} else {
|
|
7978
|
-
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
7979
|
-
const p = 2 * l - q;
|
|
7980
|
-
rOut = hueToRgb(p, q, h + 1 / 3);
|
|
7981
|
-
gOut = hueToRgb(p, q, h);
|
|
7982
|
-
bOut = hueToRgb(p, q, h - 1 / 3);
|
|
7983
|
-
}
|
|
7984
|
-
const toHex = (value) => Math.round(Math.max(0, Math.min(1, value)) * 255).toString(16).padStart(2, "0");
|
|
7985
|
-
return `#${toHex(rOut)}${toHex(gOut)}${toHex(bOut)}`;
|
|
7986
|
-
}
|
|
7987
|
-
function mixHexColors(colorA, colorB, amount = 0.5) {
|
|
7988
|
-
const normalize = (hex) => hex && /^[0-9a-fA-F]{6}$/.test(hex.replace("#", "")) ? hex.replace("#", "") : null;
|
|
7989
|
-
const first = normalize(colorA);
|
|
7990
|
-
const second = normalize(colorB);
|
|
7991
|
-
if (!first || !second) return colorA || colorB || null;
|
|
7992
|
-
const a = parseInt(first, 16);
|
|
7993
|
-
const b = parseInt(second, 16);
|
|
7994
|
-
const clampAmount = Math.max(0, Math.min(1, Number(amount) || 0));
|
|
7995
|
-
const mixChannel = (shift) => Math.round(
|
|
7996
|
-
(a >> shift & 255) + ((b >> shift & 255) - (a >> shift & 255)) * clampAmount
|
|
7997
|
-
);
|
|
7998
|
-
const toHex = (value) => value.toString(16).padStart(2, "0");
|
|
7999
|
-
const r = mixChannel(16);
|
|
8000
|
-
const g = mixChannel(8);
|
|
8001
|
-
const bl = mixChannel(0);
|
|
8002
|
-
return `#${toHex(r)}${toHex(g)}${toHex(bl)}`;
|
|
8003
|
-
}
|
|
8004
|
-
function normalizeDarkenAmount(raw) {
|
|
8005
|
-
const value = Number(raw);
|
|
8006
|
-
if (!Number.isFinite(value)) return null;
|
|
8007
|
-
return Math.min(0.95, Math.max(0, value));
|
|
8008
|
-
}
|
|
8009
7906
|
function resolveRadixPalette(name, appearance) {
|
|
8010
7907
|
if (!name || !AVAILABLE.has(name)) return null;
|
|
8011
7908
|
const paletteKey = appearance === "dark" ? `${name}Dark` : name;
|
|
@@ -8020,7 +7917,6 @@ function toTailwindScale(name, options = {}) {
|
|
|
8020
7917
|
const palette = resolveRadixPalette(name, appearance);
|
|
8021
7918
|
if (!palette) return null;
|
|
8022
7919
|
const scale = {};
|
|
8023
|
-
const darken900Amount = normalizeDarkenAmount(options.darken900Amount);
|
|
8024
7920
|
for (const lvl of LEVELS) {
|
|
8025
7921
|
const radixStep = STEP_MAP[lvl];
|
|
8026
7922
|
const key = `${name}${radixStep}`;
|
|
@@ -8028,20 +7924,6 @@ function toTailwindScale(name, options = {}) {
|
|
|
8028
7924
|
if (!value) return null;
|
|
8029
7925
|
scale[lvl] = value;
|
|
8030
7926
|
}
|
|
8031
|
-
const saturate700 = options.saturate700 !== false;
|
|
8032
|
-
if (scale["700"]) {
|
|
8033
|
-
let adjusted = appearance === "dark" ? lightenHex(scale["700"], 0.15) : darkenHex(scale["700"], 0.15);
|
|
8034
|
-
if (saturate700) adjusted = adjustSaturation(adjusted, 0.15);
|
|
8035
|
-
scale["700"] = adjusted;
|
|
8036
|
-
}
|
|
8037
|
-
const darkestKey = `${name}${STEP_MAP["900"]}`;
|
|
8038
|
-
if (scale["800"] && palette[darkestKey]) {
|
|
8039
|
-
const amount = darken900Amount != null ? darken900Amount : 0.25;
|
|
8040
|
-
scale["900"] = appearance === "dark" ? lightenHex(palette[darkestKey], amount) : darkenHex(palette[darkestKey], amount);
|
|
8041
|
-
}
|
|
8042
|
-
if (scale["800"] && scale["900"]) {
|
|
8043
|
-
scale["800"] = mixHexColors(scale["800"], scale["900"], 0.65);
|
|
8044
|
-
}
|
|
8045
7927
|
return scale;
|
|
8046
7928
|
}
|
|
8047
7929
|
function buildPreviewData() {
|
|
@@ -8110,10 +7992,6 @@ function ThemeShowcase() {
|
|
|
8110
7992
|
const styles = `
|
|
8111
7993
|
.canopy-theme-showcase {
|
|
8112
7994
|
margin: 2.618rem 0;
|
|
8113
|
-
padding: 1.5rem;
|
|
8114
|
-
border: 1px solid color-mix(in srgb, var(--color-gray-400) 40%, transparent);
|
|
8115
|
-
border-radius: 0.85rem;
|
|
8116
|
-
background: color-mix(in srgb, var(--color-gray-50) 78%, transparent);
|
|
8117
7995
|
}
|
|
8118
7996
|
.canopy-theme-showcase__appearance-buttons {
|
|
8119
7997
|
display: inline-flex;
|
|
@@ -8228,7 +8106,8 @@ function ThemeShowcase() {
|
|
|
8228
8106
|
align-items: center;
|
|
8229
8107
|
gap: 0.35rem;
|
|
8230
8108
|
cursor: pointer;
|
|
8231
|
-
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;
|
|
8232
8111
|
}
|
|
8233
8112
|
.canopy-theme-showcase__swatch:focus-visible {
|
|
8234
8113
|
outline: 2px solid var(--color-accent-default);
|
|
@@ -8237,6 +8116,14 @@ function ThemeShowcase() {
|
|
|
8237
8116
|
.canopy-theme-showcase__swatch[data-swatch-active="true"] {
|
|
8238
8117
|
border-color: var(--color-accent-default);
|
|
8239
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));
|
|
8240
8127
|
}
|
|
8241
8128
|
.canopy-theme-showcase__swatch-chip {
|
|
8242
8129
|
width: 100%;
|
|
@@ -8244,45 +8131,56 @@ function ThemeShowcase() {
|
|
|
8244
8131
|
border-radius: 0.5rem;
|
|
8245
8132
|
}
|
|
8246
8133
|
.canopy-theme-showcase__swatch-label {
|
|
8247
|
-
font-size: 0.
|
|
8134
|
+
font-size: 0.9222rem;
|
|
8248
8135
|
margin-top: 0.1rem;
|
|
8249
|
-
font-weight: 500;
|
|
8250
|
-
text-transform: capitalize;
|
|
8251
8136
|
}
|
|
8252
8137
|
.canopy-theme-showcase__swatch-controls { display: none; }
|
|
8253
8138
|
.canopy-theme-showcase__clear-button { display: none; }
|
|
8254
8139
|
`;
|
|
8255
|
-
return /* @__PURE__ */ React43.createElement("div", { className: "canopy-theme-showcase", "data-theme-showcase": true }, /* @__PURE__ */ React43.createElement("style", { dangerouslySetInnerHTML: { __html: styles } }), /* @__PURE__ */ React43.createElement(
|
|
8256
|
-
|
|
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",
|
|
8257
8142
|
{
|
|
8258
|
-
|
|
8259
|
-
|
|
8143
|
+
style: {
|
|
8144
|
+
display: "flex",
|
|
8145
|
+
justifyContent: "space-between",
|
|
8146
|
+
alignItems: "flex-start",
|
|
8147
|
+
gap: "1rem",
|
|
8148
|
+
marginBottom: "1rem"
|
|
8149
|
+
}
|
|
8260
8150
|
},
|
|
8261
|
-
/* @__PURE__ */ React43.createElement(
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
{
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
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
|
+
)
|
|
8277
8183
|
), /* @__PURE__ */ React43.createElement(
|
|
8278
|
-
"button",
|
|
8279
|
-
{
|
|
8280
|
-
type: "button",
|
|
8281
|
-
className: "canopy-theme-showcase__reset",
|
|
8282
|
-
"data-theme-reset": true
|
|
8283
|
-
},
|
|
8284
|
-
"Reset"
|
|
8285
|
-
)), /* @__PURE__ */ React43.createElement(
|
|
8286
8184
|
Section,
|
|
8287
8185
|
{
|
|
8288
8186
|
title: "Color scales",
|
|
@@ -8302,14 +8200,28 @@ function ThemeShowcase() {
|
|
|
8302
8200
|
title: "Accent color palette options",
|
|
8303
8201
|
description: "Click a swatch to temporarily override the accent palette."
|
|
8304
8202
|
},
|
|
8305
|
-
/* @__PURE__ */ React43.createElement(
|
|
8203
|
+
/* @__PURE__ */ React43.createElement(
|
|
8204
|
+
ColorsLabeled,
|
|
8205
|
+
{
|
|
8206
|
+
colors: accentColors,
|
|
8207
|
+
type: "accent",
|
|
8208
|
+
getRadixSwatch
|
|
8209
|
+
}
|
|
8210
|
+
)
|
|
8306
8211
|
), /* @__PURE__ */ React43.createElement(
|
|
8307
8212
|
Section,
|
|
8308
8213
|
{
|
|
8309
8214
|
title: "Gray color palette options",
|
|
8310
8215
|
description: "Click a swatch to preview the neutral ramp for surfaces and text."
|
|
8311
8216
|
},
|
|
8312
|
-
/* @__PURE__ */ React43.createElement(
|
|
8217
|
+
/* @__PURE__ */ React43.createElement(
|
|
8218
|
+
ColorsLabeled,
|
|
8219
|
+
{
|
|
8220
|
+
colors: grayColors,
|
|
8221
|
+
type: "gray",
|
|
8222
|
+
getRadixSwatch
|
|
8223
|
+
}
|
|
8224
|
+
)
|
|
8313
8225
|
), /* @__PURE__ */ React43.createElement(
|
|
8314
8226
|
"script",
|
|
8315
8227
|
{
|