@farming-labs/svelte-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/svelte-theme",
3
- "version": "0.0.2-beta.18",
3
+ "version": "0.0.2-beta.20",
4
4
  "description": "Svelte UI components for @farming-labs/docs — layout, sidebar, TOC, search, and theme toggle",
5
5
  "type": "module",
6
6
  "svelte": "./src/index.js",
@@ -72,8 +72,8 @@
72
72
  "dependencies": {
73
73
  "gray-matter": "^4.0.3",
74
74
  "sugar-high": "^0.9.5",
75
- "@farming-labs/docs": "0.0.2-beta.18",
76
- "@farming-labs/svelte": "0.0.2-beta.18"
75
+ "@farming-labs/docs": "0.0.2-beta.20",
76
+ "@farming-labs/svelte": "0.0.2-beta.20"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "svelte": ">=5.0.0"
@@ -174,10 +174,25 @@
174
174
  return `:root {\n ${vars.join("\n ")}\n}`;
175
175
  }
176
176
 
177
+ function buildLayoutCSS(layout) {
178
+ if (!layout) return "";
179
+ const rootVars = [];
180
+ const desktopVars = [];
181
+ if (layout.sidebarWidth) desktopVars.push(`--fd-sidebar-width: ${layout.sidebarWidth}px;`);
182
+ if (layout.contentWidth) rootVars.push(`--fd-content-width: ${layout.contentWidth}px;`);
183
+ if (layout.tocWidth) desktopVars.push(`--fd-toc-width: ${layout.tocWidth}px;`);
184
+ if (rootVars.length === 0 && desktopVars.length === 0) return "";
185
+ const parts = [];
186
+ if (rootVars.length > 0) parts.push(`:root {\n ${rootVars.join("\n ")}\n}`);
187
+ if (desktopVars.length > 0) parts.push(`@media (min-width: 1024px) {\n :root {\n ${desktopVars.join("\n ")}\n }\n}`);
188
+ return parts.join("\n");
189
+ }
190
+
177
191
  let overrideCSS = $derived.by(() => {
178
192
  const colorOverrides = config?.theme?._userColorOverrides;
179
193
  const typography = config?.theme?.ui?.typography;
180
- return [buildColorsCSS(colorOverrides), buildTypographyCSS(typography)].filter(Boolean).join("\n");
194
+ const layout = config?.theme?.ui?.layout;
195
+ return [buildColorsCSS(colorOverrides), buildTypographyCSS(typography), buildLayoutCSS(layout)].filter(Boolean).join("\n");
181
196
  });
182
197
  </script>
183
198