parserlib: units L4, scrollbar-gutter

This commit is contained in:
tophf 2022-02-08 14:05:46 +03:00
parent 6b87f7840f
commit c29048c366

View File

@ -522,7 +522,7 @@ self.parserlib = (() => {
'scroll-snap-type': 'none | [ x | y | block | inline | both ] [ mandatory | proximity ]?', 'scroll-snap-type': 'none | [ x | y | block | inline | both ] [ mandatory | proximity ]?',
'scrollbar-color': 'auto | dark | light | <color>{2}', 'scrollbar-color': 'auto | dark | light | <color>{2}',
'scrollbar-gutter': 'auto | [ [ stable | always ] && both-edges? && force? ] || match-parent', 'scrollbar-gutter': 'auto | stable && both-edges?',
'scrollbar-width': 'auto | thin | none', 'scrollbar-width': 'auto | thin | none',
'shape-inside': 'auto | outside-shape | [ <basic-shape> || shape-box ] | <image> | display', 'shape-inside': 'auto | outside-shape | [ <basic-shape> || shape-box ] | <image> | display',
'shape-rendering': 'auto | optimizeSpeed | crispEdges | geometricPrecision', 'shape-rendering': 'auto | optimizeSpeed | crispEdges | geometricPrecision',
@ -683,36 +683,16 @@ self.parserlib = (() => {
SELECTOR_PART_TYPE: 8, SELECTOR_PART_TYPE: 8,
SELECTOR_SUB_PART_TYPE: 9, SELECTOR_SUB_PART_TYPE: 9,
}; };
const UNITS = { const UNITS = JSON.parse(`{${Object.entries({
em: 'length', angle: 'deg,grad,rad,turn',
rem: 'length', frequency: 'hz,khz',
ex: 'length', length: 'cap,ch,em,ex,ic,lh,rlh,rem,' +
px: 'length', 'cm,mm,in,pc,pt,px,q,' +
cm: 'length', 'fr,' + // grids
mm: 'length', 'vb,vi,vh,vw,vmin,vmax'.replace(/\w+/g, '$&,d$&,l$&,s$&'),
in: 'length', resolution: 'dpcm,dpi,dppx,x',
pt: 'length', time: 'ms,s',
pc: 'length', }).map(([type, units]) => units.replace(/\w+/g, `"$&":"${type}"`)).join(',')}}`);
ch: 'length',
vh: 'length',
vw: 'length',
vmax: 'length',
vmin: 'length',
fr: 'length',
q: 'length',
deg: 'angle',
rad: 'angle',
grad: 'angle',
turn: 'angle',
ms: 'time',
s: 'time',
hz: 'frequency',
khz: 'frequency',
dpi: 'resolution',
dpcm: 'resolution',
dppx: 'resolution',
x: 'resolution',
};
// Sticky `y` flag must be used in expressions used with peekTest and readMatch // Sticky `y` flag must be used in expressions used with peekTest and readMatch
const rxIdentStart = /[-\\_a-zA-Z\u00A0-\uFFFF]/u; const rxIdentStart = /[-\\_a-zA-Z\u00A0-\uFFFF]/u;
const rxNameChar = /[-\\_\da-zA-Z\u00A0-\uFFFF]/u; const rxNameChar = /[-\\_\da-zA-Z\u00A0-\uFFFF]/u;