@uniweb/theming 1.3.1 → 1.3.3

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.1",
3
+ "version": "1.3.3",
4
4
  "description": "Theming utilities for the Uniweb platform — shade generation, CSS generation, theme processing",
5
5
  "type": "module",
6
6
  "exports": {
@@ -601,6 +601,12 @@ export function generateThemeCSS(config = {}, options = {}) {
601
601
  // part of that day the exclusion was a plain `:not([…])`, (0,2,0), which beat those rules.
602
602
  sections.push(`/* Default Semantic Tokens */\n:root {\n${defaultVars}\n}\n\n/* Section backgrounds — applied once, resolves via context tokens */\n[id^="section-"]:not(:where([data-uw-background="self"])) {\n background-color: var(--section);\n}`)
603
603
 
604
+ // ⭐ The section a header lies over (`underHeader`, marked by the runtime) clears it by
605
+ // `--uw-header-height`: what the browser measured, else the header type's declared height, on a
606
+ // page where a header box lies over it, and nothing on one where the layout drew no header. A
607
+ // rule, since only the rendered page holds that answer, so the first paint pads by what is there.
608
+ sections.push(`/* The section under the header clears it — by nothing where no header lies over it */\n[data-uw-under-header] {\n --uw-header-height: 0px;\n}\n:root:has([data-uw-header="over"]) [data-uw-under-header] {\n --uw-header-height: var(--uw-header-measured, var(--uw-header-declared, 0px));\n}`)
609
+
604
610
  // 4. Context classes
605
611
  const contextCSS = [
606
612
  generateContextCSS('light', contexts.light, colorVars),
package/src/processor.js CHANGED
@@ -25,6 +25,15 @@ const NEUTRAL_PRESETS = {
25
25
  neutral: '#737373',
26
26
  }
27
27
 
28
+ /**
29
+ * The names a bracket writes for a mark of its own rather than a style (content-reader's
30
+ * `MARK_NAMES`, 2026-11-17): `[x]{underline}`, `[2]{sup}`, `[2]{sub}`. A style by one of them
31
+ * would never apply, so the theme leaves it out and says so. Kept here, as theming has no
32
+ * dependencies.
33
+ */
34
+ const MARK_NAMES = { underline: 'underline', sup: 'superscript', sub: 'subscript' }
35
+ const MARK_ELEMENTS = { underline: 'u', superscript: 'sup', subscript: 'sub' }
36
+
28
37
  /**
29
38
  * Default inline text styles (content-author markdown: [text]{accent})
30
39
  * These reference semantic tokens so they adapt to context automatically
@@ -738,6 +747,11 @@ export function processTheme(rawConfig = {}, options = {}) {
738
747
  warnings.push(`theme: inline: \`${name}\` is not a style name — left out`)
739
748
  continue
740
749
  }
750
+ const mark = MARK_NAMES[name.toLowerCase()]
751
+ if (mark) {
752
+ warnings.push(`theme: inline: \`${name}\` is ${mark}, a mark of its own — \`[text]{${name.toLowerCase()}}\` is drawn as <${MARK_ELEMENTS[mark]}>, never a styled span — left out`)
753
+ continue
754
+ }
741
755
  inline[name] = styles && typeof styles === 'object'
742
756
  ? keepWritable(styles, `inline.${name}`, warnings, isCssProperty)
743
757
  : styles