@canopy-iiif/app 0.12.8 → 0.13.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/build/styles.js +6 -30
- package/package.json +1 -1
- package/ui/styles/index.css +0 -74
package/lib/build/styles.js
CHANGED
|
@@ -112,33 +112,11 @@ async function ensureStyles() {
|
|
|
112
112
|
const marker = "/* canopy-theme */";
|
|
113
113
|
const markerEnd = "/* canopy-theme:end */";
|
|
114
114
|
const markerRegex = new RegExp(`${marker}[\\s\\S]*?${markerEnd}\\n?`, "g");
|
|
115
|
-
const sanitized = existing.replace(markerRegex, "");
|
|
116
|
-
|
|
117
|
-
const layerRegex = /@layer properties\{([\s\S]*?)\}(?=@|$)/;
|
|
118
|
-
const match = layerRegex.exec(sanitized);
|
|
119
|
-
let before = sanitized;
|
|
120
|
-
let after = "";
|
|
121
|
-
let customRulesBlock = "";
|
|
122
|
-
|
|
123
|
-
if (match) {
|
|
124
|
-
before = sanitized.slice(0, match.index);
|
|
125
|
-
after = sanitized.slice(match.index + match[0].length);
|
|
126
|
-
const layerBody = match[1] || "";
|
|
127
|
-
const boundaryMatch = /}\s*:/.exec(layerBody);
|
|
128
|
-
if (boundaryMatch) {
|
|
129
|
-
const start = boundaryMatch.index + boundaryMatch[0].length - 1;
|
|
130
|
-
const customSegment = layerBody.slice(start).trim();
|
|
131
|
-
if (customSegment) {
|
|
132
|
-
const normalized = customSegment.endsWith("}")
|
|
133
|
-
? customSegment
|
|
134
|
-
: `${customSegment}}`;
|
|
135
|
-
customRulesBlock = `@layer properties {\n ${normalized}\n}\n`;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
115
|
+
const sanitized = existing.replace(markerRegex, "").replace(/\s+$/, "");
|
|
139
116
|
|
|
140
117
|
const themeBlock = `${marker}\n${themeCss}\n${markerEnd}\n`;
|
|
141
|
-
const
|
|
118
|
+
const separator = sanitized ? "\n" : "";
|
|
119
|
+
const next = `${sanitized}${separator}${themeBlock}`;
|
|
142
120
|
fs.writeFileSync(targetPath, next, "utf8");
|
|
143
121
|
} catch (_) {}
|
|
144
122
|
}
|
|
@@ -151,8 +129,6 @@ async function ensureStyles() {
|
|
|
151
129
|
} catch (_) {}
|
|
152
130
|
}
|
|
153
131
|
|
|
154
|
-
const shouldInjectTheme = !(hasAppCss && configPath);
|
|
155
|
-
|
|
156
132
|
if (configPath && (inputCss || generatedInput)) {
|
|
157
133
|
const ok = buildTailwindCli({
|
|
158
134
|
input: inputCss || generatedInput,
|
|
@@ -161,7 +137,7 @@ async function ensureStyles() {
|
|
|
161
137
|
minify: true,
|
|
162
138
|
});
|
|
163
139
|
if (ok) {
|
|
164
|
-
|
|
140
|
+
injectThemeTokens(dest);
|
|
165
141
|
stripTailwindThemeLayer(dest);
|
|
166
142
|
return; // Tailwind compiled CSS
|
|
167
143
|
}
|
|
@@ -178,7 +154,7 @@ async function ensureStyles() {
|
|
|
178
154
|
if (fs.existsSync(customAppCss)) {
|
|
179
155
|
if (!isTailwindSource(customAppCss)) {
|
|
180
156
|
await fsp.copyFile(customAppCss, dest);
|
|
181
|
-
|
|
157
|
+
injectThemeTokens(dest);
|
|
182
158
|
stripTailwindThemeLayer(dest);
|
|
183
159
|
return;
|
|
184
160
|
}
|
|
@@ -186,7 +162,7 @@ async function ensureStyles() {
|
|
|
186
162
|
if (fs.existsSync(customContentCss)) {
|
|
187
163
|
if (!isTailwindSource(customContentCss)) {
|
|
188
164
|
await fsp.copyFile(customContentCss, dest);
|
|
189
|
-
|
|
165
|
+
injectThemeTokens(dest);
|
|
190
166
|
stripTailwindThemeLayer(dest);
|
|
191
167
|
return;
|
|
192
168
|
}
|
package/package.json
CHANGED
package/ui/styles/index.css
CHANGED
|
@@ -1,77 +1,3 @@
|
|
|
1
|
-
/* canopy-theme */
|
|
2
|
-
@layer properties {
|
|
3
|
-
:root {
|
|
4
|
-
--color-accent-50: #141110;
|
|
5
|
-
--color-accent-100: #262220;
|
|
6
|
-
--color-accent-200: #302a27;
|
|
7
|
-
--color-accent-300: #493e3a;
|
|
8
|
-
--color-accent-400: #5a4c47;
|
|
9
|
-
--color-accent-500: #6f5f58;
|
|
10
|
-
--color-accent-600: #a18072;
|
|
11
|
-
--color-accent-700: #ae8c7e;
|
|
12
|
-
--color-accent-800: #d4b3a5;
|
|
13
|
-
--color-accent-900: #f2e8e3;
|
|
14
|
-
--color-accent-default: #ae8c7e;
|
|
15
|
-
--color-gray-50: #111110;
|
|
16
|
-
--color-gray-100: #222221;
|
|
17
|
-
--color-gray-200: #2a2a28;
|
|
18
|
-
--color-gray-300: #3b3a37;
|
|
19
|
-
--color-gray-400: #494844;
|
|
20
|
-
--color-gray-500: #62605b;
|
|
21
|
-
--color-gray-600: #6f6d66;
|
|
22
|
-
--color-gray-700: #7c7b74;
|
|
23
|
-
--color-gray-800: #b5b3ad;
|
|
24
|
-
--color-gray-900: #f5f5f4;
|
|
25
|
-
--color-gray-default: #f5f5f4;
|
|
26
|
-
--color-gray-muted: #6f6d66;
|
|
27
|
-
--colors-accent: #ae8c7e !important;
|
|
28
|
-
--colors-accentAlt: #d4b3a5 !important;
|
|
29
|
-
--colors-accentMuted: #5a4c47 !important;
|
|
30
|
-
--colors-primary: #f5f5f4 !important;
|
|
31
|
-
--colors-primaryAlt: #f5f5f4 !important;
|
|
32
|
-
--colors-primaryMuted: #f5f5f4 !important;
|
|
33
|
-
--colors-secondary: #111110 !important;
|
|
34
|
-
--colors-secondaryAlt: #111110 !important;
|
|
35
|
-
--colors-secondaryMuted: #111110 !important;
|
|
36
|
-
color-scheme: dark;
|
|
37
|
-
}
|
|
38
|
-
:host {
|
|
39
|
-
--color-accent-50: #141110;
|
|
40
|
-
--color-accent-100: #262220;
|
|
41
|
-
--color-accent-200: #302a27;
|
|
42
|
-
--color-accent-300: #493e3a;
|
|
43
|
-
--color-accent-400: #5a4c47;
|
|
44
|
-
--color-accent-500: #6f5f58;
|
|
45
|
-
--color-accent-600: #a18072;
|
|
46
|
-
--color-accent-700: #ae8c7e;
|
|
47
|
-
--color-accent-800: #d4b3a5;
|
|
48
|
-
--color-accent-900: #f2e8e3;
|
|
49
|
-
--color-accent-default: #ae8c7e;
|
|
50
|
-
--color-gray-50: #111110;
|
|
51
|
-
--color-gray-100: #222221;
|
|
52
|
-
--color-gray-200: #2a2a28;
|
|
53
|
-
--color-gray-300: #3b3a37;
|
|
54
|
-
--color-gray-400: #494844;
|
|
55
|
-
--color-gray-500: #62605b;
|
|
56
|
-
--color-gray-600: #6f6d66;
|
|
57
|
-
--color-gray-700: #7c7b74;
|
|
58
|
-
--color-gray-800: #b5b3ad;
|
|
59
|
-
--color-gray-900: #f5f5f4;
|
|
60
|
-
--color-gray-default: #f5f5f4;
|
|
61
|
-
--color-gray-muted: #6f6d66;
|
|
62
|
-
--colors-accent: #ae8c7e !important;
|
|
63
|
-
--colors-accentAlt: #d4b3a5 !important;
|
|
64
|
-
--colors-accentMuted: #5a4c47 !important;
|
|
65
|
-
--colors-primary: #f5f5f4 !important;
|
|
66
|
-
--colors-primaryAlt: #f5f5f4 !important;
|
|
67
|
-
--colors-primaryMuted: #f5f5f4 !important;
|
|
68
|
-
--colors-secondary: #111110 !important;
|
|
69
|
-
--colors-secondaryAlt: #111110 !important;
|
|
70
|
-
--colors-secondaryMuted: #111110 !important;
|
|
71
|
-
color-scheme: dark;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/* canopy-theme:end */
|
|
75
1
|
/**
|
|
76
2
|
* Main stylesheet for the @canopy-iiif/app/ui package
|
|
77
3
|
*/
|