jxTextRules top-level property
Texte : uppercase, italic, truncate, sr-only, tw:balance,
clamp:3, wb:…
Implementation
final List<JxRuleContract> jxTextRules = [
const JxStaticRule('text-standalone', {
'uppercase': {'text-transform': 'uppercase'},
'lowercase': {'text-transform': 'lowercase'},
'capitalize': {'text-transform': 'capitalize'},
'normal-case': {'text-transform': 'none'},
'italic': {'font-style': 'italic'},
'not-italic': {'font-style': 'normal'},
'truncate': {
'overflow': 'hidden',
'text-overflow': 'ellipsis',
'white-space': 'nowrap',
},
'antialiased': {
'-webkit-font-smoothing': 'antialiased',
'-moz-osx-font-smoothing': 'grayscale',
},
'tabular-nums': {'font-variant-numeric': 'tabular-nums'},
'sr-only': {
'position': 'absolute',
'width': '1px',
'height': '1px',
'padding': '0',
'margin': '-1px',
'overflow': 'hidden',
'clip': 'rect(0, 0, 0, 0)',
'white-space': 'nowrap',
'border-width': '0',
},
'not-sr-only': {
'position': 'static',
'width': 'auto',
'height': 'auto',
'padding': '0',
'margin': '0',
'overflow': 'visible',
'clip': 'auto',
'white-space': 'normal',
},
'visible': {'visibility': 'visible'},
'invisible': {'visibility': 'hidden'},
'isolate': {'isolation': 'isolate'},
'scroll-smooth': {'scroll-behavior': 'smooth'},
}),
const JxValueRule(
'text-wrap',
properties: {
'tw': ['text-wrap'],
},
keywords: {
'wrap': 'wrap',
'nowrap': 'nowrap',
'balance': 'balance',
'pretty': 'pretty',
},
allowArbitrary: false,
),
const JxValueRule(
'word-break',
properties: {
'wb': ['overflow-wrap'],
},
keywords: {
'normal': 'normal',
'words': 'break-word',
'anywhere': 'anywhere',
},
allowArbitrary: false,
),
JxDynamicRule(
'line-clamp',
identifiers: const {'clamp'},
build: (value, token, theme) {
if (value == 'none') {
return const {
'overflow': 'visible',
'display': 'block',
'-webkit-box-orient': 'horizontal',
'-webkit-line-clamp': 'unset',
};
}
if (value == null || !_integer.hasMatch(value)) return null;
return {
'overflow': 'hidden',
'display': '-webkit-box',
'-webkit-box-orient': 'vertical',
'-webkit-line-clamp': value,
};
},
),
];