@treeseed/core 0.8.7 → 0.8.9
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/dist/components/content/ContentStatusLegend.astro +4 -4
- package/dist/components/docs/BookFontControls.astro +9 -9
- package/dist/components/docs/DesktopSidebarToggle.astro +8 -8
- package/dist/components/docs/Footer.astro +6 -6
- package/dist/components/docs/PageTitle.astro +1 -1
- package/dist/components/docs/ThemeSelect.astro +3 -1
- package/dist/components/forms/ContactForm.astro +21 -21
- package/dist/components/forms/FooterSubscribeForm.astro +9 -9
- package/dist/components/site/BookList.astro +7 -7
- package/dist/components/site/CTASection.astro +4 -4
- package/dist/components/site/ChronicleList.astro +6 -6
- package/dist/components/site/Hero.astro +3 -3
- package/dist/components/site/PathCard.astro +5 -5
- package/dist/components/site/ProfileList.astro +5 -5
- package/dist/components/site/RouteNotFound.astro +5 -5
- package/dist/components/site/SectionIntro.astro +3 -3
- package/dist/components/site/StageBanner.astro +2 -2
- package/dist/components/site/TrustCallout.astro +3 -3
- package/dist/components/ui/data/ActionList.astro +51 -0
- package/dist/components/ui/data/Badge.astro +19 -0
- package/dist/components/ui/data/DataTable.astro +51 -0
- package/dist/components/ui/data/KeyValueList.astro +28 -0
- package/dist/components/ui/data/MetricCard.astro +25 -0
- package/dist/components/ui/data/MetricGrid.astro +27 -0
- package/dist/components/ui/data/StatusPill.astro +20 -0
- package/dist/components/ui/forms/Button.astro +52 -0
- package/dist/components/ui/forms/Field.astro +39 -0
- package/dist/components/ui/forms/FormActions.astro +12 -0
- package/dist/components/ui/forms/PasswordMeter.astro +80 -0
- package/dist/components/ui/forms/RadioGroup.astro +55 -0
- package/dist/components/ui/forms/Select.astro +44 -0
- package/dist/components/ui/forms/TextInput.astro +58 -0
- package/dist/components/ui/forms/Textarea.astro +45 -0
- package/dist/components/ui/layout/PageHeader.astro +45 -0
- package/dist/components/ui/shell/AppShell.astro +110 -0
- package/dist/components/ui/shell/BottomNav.astro +35 -0
- package/dist/components/ui/shell/ProjectHeader.astro +66 -0
- package/dist/components/ui/shell/PublicShell.astro +108 -0
- package/dist/components/ui/shell/RailNav.astro +35 -0
- package/dist/components/ui/shell/TopBar.astro +52 -0
- package/dist/components/ui/surface/Card.astro +46 -0
- package/dist/components/ui/surface/EmptyState.astro +45 -0
- package/dist/components/ui/surface/Panel.astro +54 -0
- package/dist/components/ui/theme/ThemeMenu.astro +32 -0
- package/dist/components/ui/theme/ThemePreviewSwatch.astro +18 -0
- package/dist/components/ui/theme/ThemeScript.astro +105 -0
- package/dist/components/ui/theme/ThemeSelector.astro +202 -0
- package/dist/components/ui/types.js +0 -0
- package/dist/dev.js +14 -2
- package/dist/layouts/AuthoredEntryLayout.astro +27 -27
- package/dist/layouts/BookLayout.astro +10 -10
- package/dist/layouts/ContentLayout.astro +4 -4
- package/dist/layouts/MainLayout.astro +27 -25
- package/dist/layouts/NoteLayout.astro +6 -6
- package/dist/layouts/ProfileLayout.astro +17 -17
- package/dist/pages/404.astro +6 -6
- package/dist/pages/contact.astro +4 -4
- package/dist/pages/docs-runtime/[...slug].astro +12 -12
- package/dist/pages/docs-runtime/index.astro +13 -13
- package/dist/pages/index.astro +28 -28
- package/dist/pages/ui/index.astro +216 -0
- package/dist/site.js +3 -2
- package/dist/styles/app-shell.css +398 -0
- package/dist/styles/forms.css +258 -0
- package/dist/styles/global.css +119 -119
- package/dist/styles/prose.css +11 -11
- package/dist/styles/theme.css +177 -0
- package/dist/styles/tokens.css +62 -22
- package/dist/styles/ui.css +551 -0
- package/dist/utils/content-status.js +5 -5
- package/dist/utils/site-config.js +2 -2
- package/dist/utils/theme.js +352 -40
- package/package.json +35 -2
package/dist/utils/theme.js
CHANGED
|
@@ -1,49 +1,361 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
const DEFAULT_SCHEME = "fern";
|
|
2
|
+
const DEFAULT_MODE = "system";
|
|
3
|
+
const THEME_MODES = /* @__PURE__ */ new Set(["light", "dark", "system"]);
|
|
4
|
+
const BUILT_IN_SCHEME_SUMMARIES = [
|
|
5
|
+
{
|
|
6
|
+
id: "fern",
|
|
7
|
+
name: "Fern Canopy",
|
|
8
|
+
swatches: ["#4f7d4e", "#2f5a35", "#ffffff", "#1f2a20"],
|
|
9
|
+
modeSwatches: {
|
|
10
|
+
light: ["#4f7d4e", "#2f5a35", "#ffffff", "#1f2a20"],
|
|
11
|
+
dark: ["#8bbb75", "#b9e69e", "#172016", "#e8f0e3"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: "lichen",
|
|
16
|
+
name: "Lichen Stone",
|
|
17
|
+
swatches: ["#6f8b67", "#4e6d49", "#ffffff", "#242923"],
|
|
18
|
+
modeSwatches: {
|
|
19
|
+
light: ["#6f8b67", "#4e6d49", "#ffffff", "#242923"],
|
|
20
|
+
dark: ["#9ab48a", "#c9dbbd", "#1a201d", "#e7ece5"]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "cedar",
|
|
25
|
+
name: "Cedar Clay",
|
|
26
|
+
swatches: ["#b86b3c", "#7d4528", "#fffdf8", "#2d241c"],
|
|
27
|
+
modeSwatches: {
|
|
28
|
+
light: ["#b86b3c", "#7d4528", "#fffdf8", "#2d241c"],
|
|
29
|
+
dark: ["#d98c5f", "#ffc59c", "#241b16", "#f1e7da"]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: "tidepool",
|
|
34
|
+
name: "Tidepool Dusk",
|
|
35
|
+
swatches: ["#3f8582", "#286462", "#ffffff", "#1d2928"],
|
|
36
|
+
modeSwatches: {
|
|
37
|
+
light: ["#3f8582", "#286462", "#ffffff", "#1d2928"],
|
|
38
|
+
dark: ["#73c5bd", "#b8eee8", "#162123", "#e2eeee"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
const BUILT_IN_SCHEMES = {
|
|
43
|
+
fern: {
|
|
44
|
+
light: completeTokens({
|
|
45
|
+
canvas: "#f3f7ef",
|
|
46
|
+
canvasSubtle: "#e8efe1",
|
|
47
|
+
surface: "#ffffff",
|
|
48
|
+
surfaceMuted: "#e8efe1",
|
|
49
|
+
surfaceRaised: "#fafcf7",
|
|
50
|
+
text: "#1f2a20",
|
|
51
|
+
textMuted: "#51604d",
|
|
52
|
+
border: "#cdd8c6",
|
|
53
|
+
borderStrong: "#aebca6",
|
|
54
|
+
accent: "#4f7d4e",
|
|
55
|
+
accentHover: "#3f6f3f",
|
|
56
|
+
accentStrong: "#2f5a35",
|
|
57
|
+
accentSoft: "#dcebd6",
|
|
58
|
+
info: "#3a6f75",
|
|
59
|
+
success: "#287243",
|
|
60
|
+
warning: "#8a6a1f",
|
|
61
|
+
danger: "#a23e35"
|
|
62
|
+
}, "light"),
|
|
63
|
+
dark: completeTokens({
|
|
64
|
+
canvas: "#11170f",
|
|
65
|
+
canvasSubtle: "#172016",
|
|
66
|
+
surface: "#172016",
|
|
67
|
+
surfaceMuted: "#1e2b1b",
|
|
68
|
+
surfaceRaised: "#223020",
|
|
69
|
+
text: "#e8f0e3",
|
|
70
|
+
textMuted: "#a8b6a2",
|
|
71
|
+
border: "#344431",
|
|
72
|
+
borderStrong: "#4d6048",
|
|
73
|
+
accent: "#8bbb75",
|
|
74
|
+
accentHover: "#a9d88e",
|
|
75
|
+
accentStrong: "#b9e69e",
|
|
76
|
+
accentSoft: "#20351f",
|
|
77
|
+
info: "#7db9bd",
|
|
78
|
+
success: "#81c784",
|
|
79
|
+
warning: "#d6b45e",
|
|
80
|
+
danger: "#e07a6f"
|
|
81
|
+
}, "dark")
|
|
82
|
+
},
|
|
83
|
+
lichen: {
|
|
84
|
+
light: completeTokens({
|
|
85
|
+
canvas: "#f4f5f1",
|
|
86
|
+
canvasSubtle: "#e7ebe3",
|
|
87
|
+
surface: "#ffffff",
|
|
88
|
+
surfaceMuted: "#e7ebe3",
|
|
89
|
+
surfaceRaised: "#fbfcf8",
|
|
90
|
+
text: "#242923",
|
|
91
|
+
textMuted: "#596057",
|
|
92
|
+
border: "#d2d8cf",
|
|
93
|
+
borderStrong: "#b7c0b2",
|
|
94
|
+
accent: "#6f8b67",
|
|
95
|
+
accentHover: "#5d7a56",
|
|
96
|
+
accentStrong: "#4e6d49",
|
|
97
|
+
accentSoft: "#e0eadc",
|
|
98
|
+
info: "#607d83",
|
|
99
|
+
success: "#537f54",
|
|
100
|
+
warning: "#8a7140",
|
|
101
|
+
danger: "#9d4c44"
|
|
102
|
+
}, "light"),
|
|
103
|
+
dark: completeTokens({
|
|
104
|
+
canvas: "#121614",
|
|
105
|
+
canvasSubtle: "#1a201d",
|
|
106
|
+
surface: "#1a201d",
|
|
107
|
+
surfaceMuted: "#222a25",
|
|
108
|
+
surfaceRaised: "#27302b",
|
|
109
|
+
text: "#e7ece5",
|
|
110
|
+
textMuted: "#a5aea4",
|
|
111
|
+
border: "#38423c",
|
|
112
|
+
borderStrong: "#515c55",
|
|
113
|
+
accent: "#9ab48a",
|
|
114
|
+
accentHover: "#bdd0ad",
|
|
115
|
+
accentStrong: "#c9dbbd",
|
|
116
|
+
accentSoft: "#243322",
|
|
117
|
+
info: "#8fb1b4",
|
|
118
|
+
success: "#94be8d",
|
|
119
|
+
warning: "#d0b577",
|
|
120
|
+
danger: "#db8579"
|
|
121
|
+
}, "dark")
|
|
122
|
+
},
|
|
123
|
+
cedar: {
|
|
124
|
+
light: completeTokens({
|
|
125
|
+
canvas: "#f8f2e8",
|
|
126
|
+
canvasSubtle: "#efe3d2",
|
|
127
|
+
surface: "#fffdf8",
|
|
128
|
+
surfaceMuted: "#efe3d2",
|
|
129
|
+
surfaceRaised: "#fbf7ef",
|
|
130
|
+
text: "#2d241c",
|
|
131
|
+
textMuted: "#695746",
|
|
132
|
+
border: "#dccdb8",
|
|
133
|
+
borderStrong: "#bea98f",
|
|
134
|
+
accent: "#b86b3c",
|
|
135
|
+
accentHover: "#9a5731",
|
|
136
|
+
accentStrong: "#7d4528",
|
|
137
|
+
accentSoft: "#f1d9c8",
|
|
138
|
+
info: "#557f84",
|
|
139
|
+
success: "#5f7d45",
|
|
140
|
+
warning: "#9a6a21",
|
|
141
|
+
danger: "#a74435"
|
|
142
|
+
}, "light"),
|
|
143
|
+
dark: completeTokens({
|
|
144
|
+
canvas: "#181310",
|
|
145
|
+
canvasSubtle: "#241b16",
|
|
146
|
+
surface: "#241b16",
|
|
147
|
+
surfaceMuted: "#2d2119",
|
|
148
|
+
surfaceRaised: "#33261d",
|
|
149
|
+
text: "#f1e7da",
|
|
150
|
+
textMuted: "#c0ab98",
|
|
151
|
+
border: "#49382b",
|
|
152
|
+
borderStrong: "#655040",
|
|
153
|
+
accent: "#d98c5f",
|
|
154
|
+
accentHover: "#f0b184",
|
|
155
|
+
accentStrong: "#ffc59c",
|
|
156
|
+
accentSoft: "#3a241b",
|
|
157
|
+
info: "#83b0b3",
|
|
158
|
+
success: "#a1bf78",
|
|
159
|
+
warning: "#ddb76b",
|
|
160
|
+
danger: "#e88976"
|
|
161
|
+
}, "dark")
|
|
162
|
+
},
|
|
163
|
+
tidepool: {
|
|
164
|
+
light: completeTokens({
|
|
165
|
+
canvas: "#eff7f5",
|
|
166
|
+
canvasSubtle: "#dfecea",
|
|
167
|
+
surface: "#ffffff",
|
|
168
|
+
surfaceMuted: "#dfecea",
|
|
169
|
+
surfaceRaised: "#f7fbfa",
|
|
170
|
+
text: "#1d2928",
|
|
171
|
+
textMuted: "#4f615f",
|
|
172
|
+
border: "#c9d9d7",
|
|
173
|
+
borderStrong: "#a9bfbc",
|
|
174
|
+
accent: "#3f8582",
|
|
175
|
+
accentHover: "#32726f",
|
|
176
|
+
accentStrong: "#286462",
|
|
177
|
+
accentSoft: "#d5ece9",
|
|
178
|
+
info: "#4c7899",
|
|
179
|
+
success: "#3d7b62",
|
|
180
|
+
warning: "#8b6e2f",
|
|
181
|
+
danger: "#a6453d"
|
|
182
|
+
}, "light"),
|
|
183
|
+
dark: completeTokens({
|
|
184
|
+
canvas: "#0f1718",
|
|
185
|
+
canvasSubtle: "#162123",
|
|
186
|
+
surface: "#162123",
|
|
187
|
+
surfaceMuted: "#1c2b2d",
|
|
188
|
+
surfaceRaised: "#223235",
|
|
189
|
+
text: "#e2eeee",
|
|
190
|
+
textMuted: "#9fb6b6",
|
|
191
|
+
border: "#304649",
|
|
192
|
+
borderStrong: "#496265",
|
|
193
|
+
accent: "#73c5bd",
|
|
194
|
+
accentHover: "#a2e1d9",
|
|
195
|
+
accentStrong: "#b8eee8",
|
|
196
|
+
accentSoft: "#1c3838",
|
|
197
|
+
info: "#8bbce5",
|
|
198
|
+
success: "#7cc6a1",
|
|
199
|
+
warning: "#d3b66a",
|
|
200
|
+
danger: "#e28074"
|
|
201
|
+
}, "dark")
|
|
202
|
+
}
|
|
21
203
|
};
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
204
|
+
function completeTokens(tokens, mode) {
|
|
205
|
+
return {
|
|
206
|
+
...tokens,
|
|
207
|
+
surfaceOverlay: mode === "dark" ? "rgba(7, 12, 8, 0.72)" : "rgba(255, 255, 255, 0.88)",
|
|
208
|
+
textSubtle: tokens.textMuted,
|
|
209
|
+
textInverse: mode === "dark" ? "#11170f" : "#ffffff",
|
|
210
|
+
link: tokens.info,
|
|
211
|
+
linkHover: tokens.accentHover,
|
|
212
|
+
borderMuted: tokens.border,
|
|
213
|
+
focus: tokens.info,
|
|
214
|
+
accentText: mode === "dark" ? "#10170f" : "#ffffff",
|
|
215
|
+
infoSoft: mode === "dark" ? colorMix(tokens.info, tokens.canvas, 22) : colorMix(tokens.info, tokens.surface, 18),
|
|
216
|
+
infoText: tokens.info,
|
|
217
|
+
infoBorder: colorMix(tokens.info, tokens.border, mode === "dark" ? 48 : 42),
|
|
218
|
+
successSoft: mode === "dark" ? colorMix(tokens.success, tokens.canvas, 24) : colorMix(tokens.success, tokens.surface, 18),
|
|
219
|
+
successText: tokens.success,
|
|
220
|
+
successBorder: colorMix(tokens.success, tokens.border, mode === "dark" ? 48 : 42),
|
|
221
|
+
warningSoft: mode === "dark" ? colorMix(tokens.warning, tokens.canvas, 24) : colorMix(tokens.warning, tokens.surface, 18),
|
|
222
|
+
warningText: tokens.warning,
|
|
223
|
+
warningBorder: colorMix(tokens.warning, tokens.border, mode === "dark" ? 48 : 42),
|
|
224
|
+
dangerSoft: mode === "dark" ? colorMix(tokens.danger, tokens.canvas, 24) : colorMix(tokens.danger, tokens.surface, 16),
|
|
225
|
+
dangerText: tokens.danger,
|
|
226
|
+
dangerBorder: colorMix(tokens.danger, tokens.border, mode === "dark" ? 48 : 42),
|
|
227
|
+
shadow: mode === "dark" ? "0 16px 36px rgba(0, 0, 0, 0.28)" : "0 1px 2px rgba(31, 35, 40, 0.08)",
|
|
228
|
+
grid: mode === "dark" ? "rgba(160, 180, 150, 0.12)" : "rgba(80, 100, 74, 0.12)"
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function colorMix(first, second, firstPercent) {
|
|
232
|
+
return `color-mix(in srgb, ${first} ${firstPercent}%, ${second})`;
|
|
233
|
+
}
|
|
234
|
+
function mergeTokens(base, override) {
|
|
235
|
+
return {
|
|
236
|
+
...base,
|
|
237
|
+
...override ?? {}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function mergeScheme(base, override) {
|
|
241
|
+
return {
|
|
242
|
+
light: mergeTokens(base.light, override?.light),
|
|
243
|
+
dark: mergeTokens(base.dark, override?.dark)
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function normalizeSchemeId(value, fallback) {
|
|
247
|
+
return typeof value === "string" && /^[a-z][a-z0-9-]*$/u.test(value) ? value : fallback;
|
|
248
|
+
}
|
|
249
|
+
function cssVariableName(tokenName) {
|
|
250
|
+
return `--ts-color-${tokenName.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`)}`;
|
|
251
|
+
}
|
|
252
|
+
function buildTokenDeclarations(tokens) {
|
|
253
|
+
return Object.entries(tokens).map(([tokenName, value]) => ` ${cssVariableName(tokenName)}: ${value};`).join("\n");
|
|
254
|
+
}
|
|
255
|
+
function schemeSelector(schemeId, mode) {
|
|
256
|
+
return `html[data-ts-scheme="${schemeId}"][data-ts-mode="${mode}"]`;
|
|
257
|
+
}
|
|
258
|
+
function systemSchemeSelector(schemeId) {
|
|
259
|
+
return `html[data-ts-scheme="${schemeId}"][data-ts-mode="system"]`;
|
|
260
|
+
}
|
|
261
|
+
function getBuiltInColorSchemes() {
|
|
262
|
+
return BUILT_IN_SCHEME_SUMMARIES.map((summary) => ({
|
|
263
|
+
...summary,
|
|
264
|
+
swatches: [...summary.swatches],
|
|
265
|
+
modeSwatches: {
|
|
266
|
+
light: [...summary.modeSwatches.light],
|
|
267
|
+
dark: [...summary.modeSwatches.dark]
|
|
27
268
|
}
|
|
28
|
-
|
|
29
|
-
}, theme);
|
|
269
|
+
}));
|
|
30
270
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
271
|
+
function resolveTreeseedThemeConfig(input) {
|
|
272
|
+
const schemes = { ...BUILT_IN_SCHEMES };
|
|
273
|
+
for (const [schemeId, scheme] of Object.entries(input?.schemes ?? {})) {
|
|
274
|
+
const base = schemes[schemeId] ?? schemes[DEFAULT_SCHEME];
|
|
275
|
+
schemes[schemeId] = mergeScheme(base, scheme);
|
|
34
276
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}).filter((
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
277
|
+
const defaultScheme = normalizeSchemeId(input?.defaultScheme, DEFAULT_SCHEME);
|
|
278
|
+
const resolvedDefaultScheme = schemes[defaultScheme] ? defaultScheme : DEFAULT_SCHEME;
|
|
279
|
+
const defaultMode = input?.defaultMode && THEME_MODES.has(input.defaultMode) ? input.defaultMode : DEFAULT_MODE;
|
|
280
|
+
const customSummaries = Object.keys(input?.schemes ?? {}).filter((schemeId) => !BUILT_IN_SCHEME_SUMMARIES.some((summary) => summary.id === schemeId)).map((schemeId) => ({
|
|
281
|
+
id: schemeId,
|
|
282
|
+
name: schemeId.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" "),
|
|
283
|
+
swatches: [
|
|
284
|
+
schemes[schemeId].light.accent,
|
|
285
|
+
schemes[schemeId].light.accentStrong,
|
|
286
|
+
schemes[schemeId].light.surface,
|
|
287
|
+
schemes[schemeId].light.text
|
|
288
|
+
],
|
|
289
|
+
modeSwatches: {
|
|
290
|
+
light: [
|
|
291
|
+
schemes[schemeId].light.accent,
|
|
292
|
+
schemes[schemeId].light.accentStrong,
|
|
293
|
+
schemes[schemeId].light.surface,
|
|
294
|
+
schemes[schemeId].light.text
|
|
295
|
+
],
|
|
296
|
+
dark: [
|
|
297
|
+
schemes[schemeId].dark.accent,
|
|
298
|
+
schemes[schemeId].dark.accentStrong,
|
|
299
|
+
schemes[schemeId].dark.surface,
|
|
300
|
+
schemes[schemeId].dark.text
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
}));
|
|
304
|
+
return {
|
|
305
|
+
defaultScheme: resolvedDefaultScheme,
|
|
306
|
+
defaultMode,
|
|
307
|
+
schemes,
|
|
308
|
+
summaries: [...getBuiltInColorSchemes(), ...customSummaries]
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function normalizeThemePreference(input) {
|
|
312
|
+
const record = input && typeof input === "object" ? input : {};
|
|
313
|
+
return {
|
|
314
|
+
scheme: normalizeSchemeId(record.scheme ?? record.colorScheme, DEFAULT_SCHEME),
|
|
315
|
+
mode: typeof (record.mode ?? record.themeMode) === "string" && THEME_MODES.has(record.mode ?? record.themeMode) ? record.mode ?? record.themeMode : DEFAULT_MODE
|
|
316
|
+
};
|
|
44
317
|
}
|
|
318
|
+
function buildTreeseedThemeCss(input) {
|
|
319
|
+
const resolved = resolveTreeseedThemeConfig(input);
|
|
320
|
+
const defaultTokens = resolved.schemes[resolved.defaultScheme][resolved.defaultMode === "dark" ? "dark" : "light"];
|
|
321
|
+
const darkDefaultTokens = resolved.schemes[resolved.defaultScheme].dark;
|
|
322
|
+
const blocks = [
|
|
323
|
+
`:root {
|
|
324
|
+
${buildTokenDeclarations(defaultTokens)}
|
|
325
|
+
color-scheme: ${resolved.defaultMode === "dark" ? "dark" : "light"};
|
|
326
|
+
}`
|
|
327
|
+
];
|
|
328
|
+
if (resolved.defaultMode === "system") {
|
|
329
|
+
blocks.push(`@media (prefers-color-scheme: dark) {
|
|
330
|
+
:root {
|
|
331
|
+
${buildTokenDeclarations(darkDefaultTokens).replaceAll("\n", "\n ")}
|
|
332
|
+
color-scheme: dark;
|
|
333
|
+
}
|
|
334
|
+
}`);
|
|
335
|
+
}
|
|
336
|
+
for (const [schemeId, scheme] of Object.entries(resolved.schemes)) {
|
|
337
|
+
blocks.push(`${schemeSelector(schemeId, "light")},
|
|
338
|
+
${systemSchemeSelector(schemeId)} {
|
|
339
|
+
${buildTokenDeclarations(scheme.light)}
|
|
340
|
+
color-scheme: light;
|
|
341
|
+
}`);
|
|
342
|
+
blocks.push(`${schemeSelector(schemeId, "dark")} {
|
|
343
|
+
${buildTokenDeclarations(scheme.dark)}
|
|
344
|
+
color-scheme: dark;
|
|
345
|
+
}`);
|
|
346
|
+
blocks.push(`@media (prefers-color-scheme: dark) {
|
|
347
|
+
${systemSchemeSelector(schemeId)} {
|
|
348
|
+
${buildTokenDeclarations(scheme.dark).replaceAll("\n", "\n ")}
|
|
349
|
+
color-scheme: dark;
|
|
350
|
+
}
|
|
351
|
+
}`);
|
|
352
|
+
}
|
|
353
|
+
return `${blocks.join("\n\n")}
|
|
45
354
|
`;
|
|
46
355
|
}
|
|
47
356
|
export {
|
|
48
|
-
|
|
357
|
+
buildTreeseedThemeCss,
|
|
358
|
+
getBuiltInColorSchemes,
|
|
359
|
+
normalizeThemePreference,
|
|
360
|
+
resolveTreeseedThemeConfig
|
|
49
361
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeseed/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"description": "Treeseed web framework package for Astro/Starlight site runtimes.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@astrojs/sitemap": "3.7.0",
|
|
71
71
|
"@astrojs/starlight": "0.37.6",
|
|
72
72
|
"@tailwindcss/vite": "^4.1.4",
|
|
73
|
-
"@treeseed/sdk": "0.8.
|
|
73
|
+
"@treeseed/sdk": "0.8.9",
|
|
74
74
|
"astro": "^5.6.1",
|
|
75
75
|
"esbuild": "^0.28.0",
|
|
76
76
|
"katex": "^0.16.22",
|
|
@@ -159,6 +159,39 @@
|
|
|
159
159
|
"./components/site/PathCard.astro": "./dist/components/site/PathCard.astro",
|
|
160
160
|
"./components/site/TrustCallout.astro": "./dist/components/site/TrustCallout.astro",
|
|
161
161
|
"./components/content/ContentStatusLegend.astro": "./dist/components/content/ContentStatusLegend.astro",
|
|
162
|
+
"./components/ui/theme/ThemeScript.astro": "./dist/components/ui/theme/ThemeScript.astro",
|
|
163
|
+
"./components/ui/theme/ThemeSelector.astro": "./dist/components/ui/theme/ThemeSelector.astro",
|
|
164
|
+
"./components/ui/theme/ThemeMenu.astro": "./dist/components/ui/theme/ThemeMenu.astro",
|
|
165
|
+
"./components/ui/theme/ThemePreviewSwatch.astro": "./dist/components/ui/theme/ThemePreviewSwatch.astro",
|
|
166
|
+
"./components/ui/forms/Button.astro": "./dist/components/ui/forms/Button.astro",
|
|
167
|
+
"./components/ui/forms/Field.astro": "./dist/components/ui/forms/Field.astro",
|
|
168
|
+
"./components/ui/forms/TextInput.astro": "./dist/components/ui/forms/TextInput.astro",
|
|
169
|
+
"./components/ui/forms/Select.astro": "./dist/components/ui/forms/Select.astro",
|
|
170
|
+
"./components/ui/forms/Textarea.astro": "./dist/components/ui/forms/Textarea.astro",
|
|
171
|
+
"./components/ui/forms/RadioGroup.astro": "./dist/components/ui/forms/RadioGroup.astro",
|
|
172
|
+
"./components/ui/forms/FormActions.astro": "./dist/components/ui/forms/FormActions.astro",
|
|
173
|
+
"./components/ui/forms/PasswordMeter.astro": "./dist/components/ui/forms/PasswordMeter.astro",
|
|
174
|
+
"./components/ui/surface/Panel.astro": "./dist/components/ui/surface/Panel.astro",
|
|
175
|
+
"./components/ui/surface/Card.astro": "./dist/components/ui/surface/Card.astro",
|
|
176
|
+
"./components/ui/surface/EmptyState.astro": "./dist/components/ui/surface/EmptyState.astro",
|
|
177
|
+
"./components/ui/data/Badge.astro": "./dist/components/ui/data/Badge.astro",
|
|
178
|
+
"./components/ui/data/StatusPill.astro": "./dist/components/ui/data/StatusPill.astro",
|
|
179
|
+
"./components/ui/data/MetricCard.astro": "./dist/components/ui/data/MetricCard.astro",
|
|
180
|
+
"./components/ui/data/MetricGrid.astro": "./dist/components/ui/data/MetricGrid.astro",
|
|
181
|
+
"./components/ui/data/ActionList.astro": "./dist/components/ui/data/ActionList.astro",
|
|
182
|
+
"./components/ui/data/KeyValueList.astro": "./dist/components/ui/data/KeyValueList.astro",
|
|
183
|
+
"./components/ui/data/DataTable.astro": "./dist/components/ui/data/DataTable.astro",
|
|
184
|
+
"./components/ui/layout/PageHeader.astro": "./dist/components/ui/layout/PageHeader.astro",
|
|
185
|
+
"./components/ui/shell/AppShell.astro": "./dist/components/ui/shell/AppShell.astro",
|
|
186
|
+
"./components/ui/shell/PublicShell.astro": "./dist/components/ui/shell/PublicShell.astro",
|
|
187
|
+
"./components/ui/shell/RailNav.astro": "./dist/components/ui/shell/RailNav.astro",
|
|
188
|
+
"./components/ui/shell/BottomNav.astro": "./dist/components/ui/shell/BottomNav.astro",
|
|
189
|
+
"./components/ui/shell/TopBar.astro": "./dist/components/ui/shell/TopBar.astro",
|
|
190
|
+
"./components/ui/shell/ProjectHeader.astro": "./dist/components/ui/shell/ProjectHeader.astro",
|
|
191
|
+
"./styles/theme.css": "./dist/styles/theme.css",
|
|
192
|
+
"./styles/ui.css": "./dist/styles/ui.css",
|
|
193
|
+
"./styles/forms.css": "./dist/styles/forms.css",
|
|
194
|
+
"./styles/app-shell.css": "./dist/styles/app-shell.css",
|
|
162
195
|
"./components/starlight": {
|
|
163
196
|
"types": "./dist/components/starlight.d.ts",
|
|
164
197
|
"default": "./dist/components/starlight.js"
|