@canopy-iiif/app 0.10.12 → 0.10.14

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 CHANGED
@@ -9,7 +9,7 @@ const {
9
9
  ASSETS_DIR,
10
10
  ensureDirSync,
11
11
  } = require("../common");
12
- function resolveTailwindCli() {
12
+ function resolveTailwindCli() {
13
13
  const bin = path.join(
14
14
  process.cwd(),
15
15
  "node_modules",
@@ -40,6 +40,14 @@ const HAS_APP_WORKSPACE = (() => {
40
40
  return false;
41
41
  }
42
42
  })();
43
+
44
+ function stripTailwindThemeLayer(targetPath) {
45
+ try {
46
+ const raw = fs.readFileSync(targetPath, "utf8");
47
+ const cleaned = raw.replace(/@layer theme\{[\s\S]*?\}(?=@layer|$)/g, "");
48
+ if (cleaned !== raw) fs.writeFileSync(targetPath, cleaned, "utf8");
49
+ } catch (_) {}
50
+ }
43
51
  let pendingModuleReload = false;
44
52
  let building = false;
45
53
  let buildAgain = false;
@@ -896,6 +904,7 @@ async function dev() {
896
904
  }
897
905
  throw new Error("[tailwind] Initial Tailwind build failed.");
898
906
  }
907
+ stripTailwindThemeLayer(outputCss);
899
908
  console.log(
900
909
  `[tailwind] initial build ok (${fileSizeKb(outputCss)} KB) →`,
901
910
  prettyPath(outputCss)
@@ -920,6 +929,7 @@ async function dev() {
920
929
  cssWatcherAttached = true;
921
930
  try {
922
931
  fs.watch(outputCss, { persistent: false }, () => {
932
+ stripTailwindThemeLayer(outputCss);
923
933
  if (!unmuted) {
924
934
  unmuted = true;
925
935
  console.log(
@@ -946,6 +956,7 @@ async function dev() {
946
956
  }
947
957
  throw new Error("[tailwind] On-demand Tailwind compile failed.");
948
958
  }
959
+ stripTailwindThemeLayer(outputCss);
949
960
  console.log(
950
961
  `[tailwind] compiled (${fileSizeKb(outputCss)} KB) →`,
951
962
  prettyPath(outputCss)
@@ -143,6 +143,14 @@ async function ensureStyles() {
143
143
  } catch (_) {}
144
144
  }
145
145
 
146
+ function stripTailwindThemeLayer(targetPath) {
147
+ try {
148
+ const raw = fs.readFileSync(targetPath, "utf8");
149
+ const cleaned = raw.replace(/@layer theme\{[\s\S]*?\}(?=@layer|$)/g, "");
150
+ if (cleaned !== raw) fs.writeFileSync(targetPath, cleaned, "utf8");
151
+ } catch (_) {}
152
+ }
153
+
146
154
  const shouldInjectTheme = !(hasAppCss && configPath);
147
155
 
148
156
  if (configPath && (inputCss || generatedInput)) {
@@ -154,6 +162,7 @@ async function ensureStyles() {
154
162
  });
155
163
  if (ok) {
156
164
  if (shouldInjectTheme) injectThemeTokens(dest);
165
+ stripTailwindThemeLayer(dest);
157
166
  return; // Tailwind compiled CSS
158
167
  }
159
168
  }
@@ -170,6 +179,7 @@ async function ensureStyles() {
170
179
  if (!isTailwindSource(customAppCss)) {
171
180
  await fsp.copyFile(customAppCss, dest);
172
181
  if (shouldInjectTheme) injectThemeTokens(dest);
182
+ stripTailwindThemeLayer(dest);
173
183
  return;
174
184
  }
175
185
  }
@@ -177,6 +187,7 @@ async function ensureStyles() {
177
187
  if (!isTailwindSource(customContentCss)) {
178
188
  await fsp.copyFile(customContentCss, dest);
179
189
  if (shouldInjectTheme) injectThemeTokens(dest);
190
+ stripTailwindThemeLayer(dest);
180
191
  return;
181
192
  }
182
193
  }
@@ -184,6 +195,7 @@ async function ensureStyles() {
184
195
  const css = `:root{--max-w:760px;--muted:#6b7280}*{box-sizing:border-box}body{font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Helvetica,Arial,sans-serif;max-width:var(--max-w);margin:2rem auto;padding:0 1rem;line-height:1.6}a{color:#2563eb;text-decoration:none}a:hover{text-decoration:underline}.site-header,.site-footer{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:1rem 0;border-bottom:1px solid #e5e7eb}.site-footer{border-bottom:0;border-top:1px solid #e5e7eb;color:var(--muted)}.brand{font-weight:600}.content pre{background:#f6f8fa;padding:1rem;overflow:auto}.content code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;background:#f6f8fa;padding:.1rem .3rem;border-radius:4px}.tabs{display:flex;gap:.5rem;align-items:center;border-bottom:1px solid #e5e7eb;margin:.5rem 0}.tab{background:none;border:0;color:#374151;padding:.25rem .5rem;border-radius:.375rem;cursor:pointer}.tab:hover{color:#111827}.tab-active{color:#2563eb;border:1px solid #e5e7eb;border-bottom:0;background:#fff}.masonry{column-gap:1rem;column-count:1}@media(min-width:768px){.masonry{column-count:2}}@media(min-width:1024px){.masonry{column-count:3}}.masonry>*{break-inside:avoid;margin-bottom:1rem;display:block}[data-grid-variant=masonry]{column-gap:var(--grid-gap,1rem);column-count:var(--cols-base,1)}@media(min-width:768px){[data-grid-variant=masonry]{column-count:var(--cols-md,2)}}@media(min-width:1024px){[data-grid-variant=masonry]{column-count:var(--cols-lg,3)}}[data-grid-variant=masonry]>*{break-inside:avoid;margin-bottom:var(--grid-gap,1rem);display:block}[data-grid-variant=grid]{display:grid;grid-template-columns:repeat(var(--cols-base,1),minmax(0,1fr));gap:var(--grid-gap,1rem)}@media(min-width:768px){[data-grid-variant=grid]{grid-template-columns:repeat(var(--cols-md,2),minmax(0,1fr))}}@media(min-width:1024px){[data-grid-variant=grid]{grid-template-columns:repeat(var(--cols-lg,3),minmax(0,1fr))}}`;
185
196
  await fsp.writeFile(dest, css, "utf8");
186
197
  injectThemeTokens(dest);
198
+ stripTailwindThemeLayer(dest);
187
199
  }
188
200
 
189
201
  module.exports = { ensureStyles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopy-iiif/app",
3
- "version": "0.10.12",
3
+ "version": "0.10.14",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Mat Jordan <mat@northwestern.edu>",
@@ -12,6 +12,7 @@
12
12
  "./ui": "./ui/dist/index.mjs",
13
13
  "./ui/server": "./ui/dist/server.mjs",
14
14
  "./ui/styles/index.css": "./ui/styles/index.css",
15
+ "./ui/styles/runtime.css": "./ui/styles/runtime.css",
15
16
  "./ui/canopy-iiif-plugin": "./ui/tailwind-canopy-iiif-plugin.js",
16
17
  "./ui/canopy-iiif-preset": "./ui/tailwind-canopy-iiif-preset.js",
17
18
  "./ui/tailwind-config": {
@@ -1897,7 +1897,7 @@ var baseLineStyle = {
1897
1897
  boxSizing: "border-box"
1898
1898
  };
1899
1899
  var highlightBaseStyle = {
1900
- background: "linear-gradient(to right, var(--color-brand-200, #bfdbfe), var(--color-brand-100, #bfdbfe))"
1900
+ background: "linear-gradient(to right, var(--color-accent-200, #bfdbfe), var(--color-accent-100, #bfdbfe))"
1901
1901
  };
1902
1902
  function DocsCodeBlock(props = {}) {
1903
1903
  const { children, ...rest } = props;
@@ -1946,7 +1946,7 @@ function DocsCodeBlock(props = {}) {
1946
1946
  borderRadius: "12px",
1947
1947
  overflow: "hidden",
1948
1948
  margin: "1.5rem 0",
1949
- background: "var(--color-brand-100)",
1949
+ background: "var(--color-accent-100)",
1950
1950
  fontFamily: "var(--font-mono)",
1951
1951
  fontSize: "0.85rem"
1952
1952
  };
@@ -1956,14 +1956,14 @@ function DocsCodeBlock(props = {}) {
1956
1956
  justifyContent: "space-between",
1957
1957
  padding: "1rem 1.25rem",
1958
1958
  fontWeight: 700,
1959
- background: "var(--color-brand-100)",
1960
- borderBottom: "1px solid var(--color-brand-200)",
1961
- color: "var(--color-brand-900)"
1959
+ background: "var(--color-accent-100)",
1960
+ borderBottom: "1px solid var(--color-accent-200)",
1961
+ color: "var(--color-accent-900)"
1962
1962
  };
1963
1963
  const preStyle = {
1964
1964
  margin: 0,
1965
- background: "var(--color-brand-100)",
1966
- color: "var(--color-brand-800)",
1965
+ background: "var(--color-accent-100)",
1966
+ color: "var(--color-accent-800)",
1967
1967
  lineHeight: 1.55,
1968
1968
  padding: "1rem 0",
1969
1969
  overflowX: "auto"
@@ -2003,13 +2003,13 @@ function DocsCodeBlock(props = {}) {
2003
2003
  type: "button",
2004
2004
  onClick: handleCopy,
2005
2005
  style: {
2006
- border: "1px solid var(--color-brand-300, #bfdbfe)",
2006
+ border: "1px solid var(--color-accent-300, #bfdbfe)",
2007
2007
  borderRadius: "6px",
2008
2008
  padding: "0.2rem 0.55rem",
2009
2009
  fontSize: "0.7rem",
2010
2010
  fontWeight: 500,
2011
- background: "color-mix(in srgb, var(--color-brand-100, #e0f2ff) 55%, #ffffff)",
2012
- color: "var(--color-brand-700, #1d4ed8)",
2011
+ background: "color-mix(in srgb, var(--color-accent-100, #e0f2ff) 55%, #ffffff)",
2012
+ color: "var(--color-accent-700, #1d4ed8)",
2013
2013
  cursor: "pointer"
2014
2014
  }
2015
2015
  },