@farming-labs/nuxt-theme 0.0.2-beta.18 → 0.0.2-beta.20
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/nuxt-theme",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.20",
|
|
4
4
|
"description": "Nuxt/Vue UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"sugar-high": "^0.9.5",
|
|
56
|
-
"@farming-labs/docs": "0.0.2-beta.
|
|
56
|
+
"@farming-labs/docs": "0.0.2-beta.20"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"vue": ">=3.0.0",
|
|
@@ -132,11 +132,26 @@ function buildTypographyCSS(typo: Record<string, any> | undefined): string {
|
|
|
132
132
|
return `:root {\n ${vars.join("\n ")}\n}`;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
function buildLayoutCSS(layout: Record<string, any> | undefined): string {
|
|
136
|
+
if (!layout) return "";
|
|
137
|
+
const rootVars: string[] = [];
|
|
138
|
+
const desktopVars: string[] = [];
|
|
139
|
+
if (layout.sidebarWidth) desktopVars.push(`--fd-sidebar-width: ${layout.sidebarWidth}px;`);
|
|
140
|
+
if (layout.contentWidth) rootVars.push(`--fd-content-width: ${layout.contentWidth}px;`);
|
|
141
|
+
if (layout.tocWidth) desktopVars.push(`--fd-toc-width: ${layout.tocWidth}px;`);
|
|
142
|
+
if (rootVars.length === 0 && desktopVars.length === 0) return "";
|
|
143
|
+
const parts: string[] = [];
|
|
144
|
+
if (rootVars.length > 0) parts.push(`:root {\n ${rootVars.join("\n ")}\n}`);
|
|
145
|
+
if (desktopVars.length > 0) parts.push(`@media (min-width: 1024px) {\n :root {\n ${desktopVars.join("\n ")}\n }\n}`);
|
|
146
|
+
return parts.join("\n");
|
|
147
|
+
}
|
|
148
|
+
|
|
135
149
|
const overrideCSS = computed(() => {
|
|
136
150
|
const colorOverrides = (props.config?.theme as any)?._userColorOverrides
|
|
137
151
|
?? (props.config?.theme as any)?.ui?.colors;
|
|
138
152
|
const typography = (props.config?.theme as any)?.ui?.typography;
|
|
139
|
-
|
|
153
|
+
const layout = (props.config?.theme as any)?.ui?.layout;
|
|
154
|
+
return [buildColorsCSS(colorOverrides), buildTypographyCSS(typography), buildLayoutCSS(layout)].filter(Boolean).join("\n");
|
|
140
155
|
});
|
|
141
156
|
|
|
142
157
|
useHead(() => ({
|