@uniweb/theming 0.1.12 → 0.1.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/package.json +1 -1
- package/src/css-generator.js +15 -4
- package/src/processor.js +8 -34
package/package.json
CHANGED
package/src/css-generator.js
CHANGED
|
@@ -597,10 +597,21 @@ export function generateThemeCSS(config = {}, options = {}) {
|
|
|
597
597
|
sections.push(generateDarkSchemeCSS(appearance, contexts.dark, colorVars))
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
// 7. Site background
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
600
|
+
// 7. Site background — the page behind the sections.
|
|
601
|
+
//
|
|
602
|
+
// Sections paint themselves (rule 3), and on a page whose sections run the
|
|
603
|
+
// full width that covers the viewport. It does not cover a layout with
|
|
604
|
+
// columns: a sidebar shell paints its rails and its article and leaves the
|
|
605
|
+
// space between them unpainted, which falls through to the browser's white —
|
|
606
|
+
// in both schemes, so dark mode shows a white page around dark panels.
|
|
607
|
+
//
|
|
608
|
+
// Defaulting to var(--section) means the page matches the sections sitting on
|
|
609
|
+
// it and flips with the visitor's choice, because that token already does. A
|
|
610
|
+
// site wanting a different canvas — a wash behind cards, an image — sets
|
|
611
|
+
// `background:` in theme.yml and replaces this.
|
|
612
|
+
sections.push(
|
|
613
|
+
`/* Site Background */\nbody {\n background: ${config.background || 'var(--section)'};\n}`
|
|
614
|
+
)
|
|
604
615
|
|
|
605
616
|
// 8. Inline text styles (if specified in theme.yml)
|
|
606
617
|
if (config.inline && typeof config.inline === 'object') {
|
package/src/processor.js
CHANGED
|
@@ -115,36 +115,6 @@ function normalizeApplyTo(applyTo) {
|
|
|
115
115
|
return cleaned.length ? cleaned : null
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
/**
|
|
119
|
-
* Default code block theme configuration
|
|
120
|
-
* Uses Shiki CSS variable names for compatibility
|
|
121
|
-
* These values are NOT converted to CSS here - the kit's Code component
|
|
122
|
-
* injects them at runtime only when code blocks are used (tree-shaking)
|
|
123
|
-
*/
|
|
124
|
-
const DEFAULT_CODE_THEME = {
|
|
125
|
-
// Background and foreground
|
|
126
|
-
background: '#1e1e2e', // Dark editor background
|
|
127
|
-
foreground: '#cdd6f4', // Default text color
|
|
128
|
-
|
|
129
|
-
// Syntax highlighting colors (Shiki token variables)
|
|
130
|
-
keyword: '#cba6f7', // Purple - keywords (if, else, function)
|
|
131
|
-
string: '#a6e3a1', // Green - strings
|
|
132
|
-
number: '#fab387', // Orange - numbers
|
|
133
|
-
comment: '#6c7086', // Gray - comments
|
|
134
|
-
function: '#89b4fa', // Blue - function names
|
|
135
|
-
variable: '#f5e0dc', // Light pink - variables
|
|
136
|
-
operator: '#89dceb', // Cyan - operators
|
|
137
|
-
punctuation: '#9399b2', // Gray - punctuation
|
|
138
|
-
type: '#f9e2af', // Yellow - types
|
|
139
|
-
constant: '#f38ba8', // Red - constants
|
|
140
|
-
property: '#94e2d5', // Teal - properties
|
|
141
|
-
tag: '#89b4fa', // Blue - HTML/JSX tags
|
|
142
|
-
attribute: '#f9e2af', // Yellow - attributes
|
|
143
|
-
|
|
144
|
-
// UI elements
|
|
145
|
-
lineNumber: '#6c7086', // Line number color
|
|
146
|
-
selection: '#45475a', // Selection background
|
|
147
|
-
}
|
|
148
118
|
|
|
149
119
|
/**
|
|
150
120
|
* Validate color configuration
|
|
@@ -693,10 +663,14 @@ export function processTheme(rawConfig = {}, options = {}) {
|
|
|
693
663
|
// Process code block theme
|
|
694
664
|
// These values are stored for runtime injection by kit's Code component
|
|
695
665
|
// (not converted to CSS here - enables tree-shaking when code blocks aren't used)
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
666
|
+
// Passed through exactly as declared — no defaults filled in.
|
|
667
|
+
//
|
|
668
|
+
// A default palette here would defeat the point of the setting downstream: a
|
|
669
|
+
// site naming a bundled theme and overriding one colour would arrive carrying
|
|
670
|
+
// fifteen, and the theme it named would be overridden in full by values it
|
|
671
|
+
// never asked for. Whoever renders code owns the default; this only carries
|
|
672
|
+
// what the site said.
|
|
673
|
+
const code = rawConfig.code ?? null
|
|
700
674
|
|
|
701
675
|
// Site background (pass through as CSS value)
|
|
702
676
|
const background = rawConfig.background || null
|