@uniweb/theming 1.3.2 → 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 +1 -1
- package/src/processor.js +14 -0
package/package.json
CHANGED
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
|