@uniweb/theming 1.3.4 → 1.3.5

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": "@uniweb/theming",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Theming utilities for the Uniweb platform — shade generation, CSS generation, theme processing",
5
5
  "type": "module",
6
6
  "exports": {
package/src/processor.js CHANGED
@@ -795,7 +795,7 @@ export function processTheme(rawConfig = {}, options = {}) {
795
795
  : styles
796
796
  }
797
797
 
798
- // ⭐ NAMED BACKGROUNDS (`backgrounds:`): a background defined once, which a section picks by its
798
+ // ⭐ NAMED BACKGROUNDS (`backgrounds:`): a background defined once, with the `theme` it needs, which a section picks by its
799
799
  // name (`background: glow`), as written: core resolves the name and normalizes the value when a
800
800
  // section names it (`Block.namedBackground`). A name is a surface's kind of name, and never one a
801
801
  // background value already means — a token (`muted`) or a palette shade (`primary-100`) — so a
@@ -807,9 +807,12 @@ export function processTheme(rawConfig = {}, options = {}) {
807
807
  continue
808
808
  }
809
809
  if (typeof definition === 'string' ? !definition.trim() : !isMap(definition)) {
810
- warnings.push(`theme: backgrounds.${name}: a background is a value such as /images/hero.jpg, or a map (color, gradient, image, video, overlay, surface) — left out`)
810
+ warnings.push(`theme: backgrounds.${name}: a background is a value such as /images/hero.jpg, or a map (color, gradient, image, video, overlay, theme) — left out`)
811
811
  continue
812
812
  }
813
+ if (isMap(definition) && definition.surface !== undefined) {
814
+ warnings.push(`theme: backgrounds.${name}.surface is \`theme\`, the theme a section reads in, as a section writes it — \`surface\` is not read`)
815
+ }
813
816
  backgrounds[name] = definition
814
817
  }
815
818
 
@@ -212,6 +212,14 @@ function buildBlockRules(block, appearance) {
212
212
  light.push(...buildElementVars(theme.contexts?.light), ...buildFoundationVars(ctxVars.light))
213
213
  themeDark.push(...buildElementVars(theme.contexts?.dark), ...buildFoundationVars(ctxVars.dark))
214
214
  dark.push(...themeDark)
215
+ } else if (block.themeFollowsScheme) {
216
+ // ⭐ A pinned context that follows the scheme (`medium`, a site's own with a dark version,
217
+ // `Block.contextFollowsScheme`): its own tokens are the light scheme's and its `dark:` ones the
218
+ // dark scheme's, as an Auto section's are, so a light band's colors never sit on the dark
219
+ // version's light text. ⛔ For an hour of 2026-11-28 (1.37.0) they applied in both schemes.
220
+ light.push(...buildElementVars(theme.contexts?.[block.themeName]), ...buildFoundationVars(ctxVars.light))
221
+ themeDark.push(...buildElementVars(theme.darkContexts?.[block.themeName]), ...buildFoundationVars(ctxVars.dark))
222
+ dark.push(...themeDark)
215
223
  } else {
216
224
  always.push(...buildElementVars(theme.contexts?.[block.themeName]), ...buildFoundationVars(ctxVars[block.themeName]))
217
225
  }