CSS subset support

Subset version: 1.8.0

The Shell parses and computes the declarations below and the M6 Core consumes their canonical typed values. CSS text and selector matching remain outside Core.

CSS property TypeScript name grammar inherited invalidation animation engine status
display display display no layout, paint, hit, semantics, scroll discrete M6 Core
width width length-auto no layout, paint, hit, scroll number M6 Core
height height length-auto no layout, paint, hit, scroll number M6 Core
min-width minWidth non-negative-length-auto no layout, paint, hit, scroll number M6 Core
min-height minHeight non-negative-length-auto no layout, paint, hit, scroll number M6 Core
max-width maxWidth length-none no layout, paint, hit, scroll number M6 Core
max-height maxHeight length-none no layout, paint, hit, scroll number M6 Core
box-sizing boxSizing box-sizing no layout, paint, hit, scroll discrete M6 Core
margin-top marginTop length-auto no layout, paint, hit, scroll number M6 Core
margin-right marginRight length-auto no layout, paint, hit, scroll number M6 Core
margin-bottom marginBottom length-auto no layout, paint, hit, scroll number M6 Core
margin-left marginLeft length-auto no layout, paint, hit, scroll number M6 Core
padding-top paddingTop non-negative-length no layout, paint, hit, scroll number M6 Core
padding-right paddingRight non-negative-length no layout, paint, hit, scroll number M6 Core
padding-bottom paddingBottom non-negative-length no layout, paint, hit, scroll number M6 Core
padding-left paddingLeft non-negative-length no layout, paint, hit, scroll number M6 Core
row-gap rowGap non-negative-length-normal no layout, paint, hit, scroll number M6 Core
column-gap columnGap non-negative-length-normal no layout, paint, hit, scroll number M6 Core
flex-direction flexDirection flex-direction no layout, paint, hit, scroll discrete M6 Core
justify-content justifyContent justify-content no layout, paint, hit, scroll discrete M6 Core
align-items alignItems align-items no layout, paint, hit, scroll discrete M6 Core
overflow-x overflowX overflow no layout, paint, hit, semantics, scroll discrete M6 Core
overflow-y overflowY overflow no layout, paint, hit, semantics, scroll discrete M6 Core
overscroll-behavior overscrollBehavior overscroll-behavior no scroll discrete M6 Core
background-color backgroundColor color no paint color M6 Core
color color color yes paint color M6 Core
opacity opacity opacity no paintSelf, hit number M6 Core
border-top-width borderTopWidth non-negative-length no layout, paint, hit number M6 Core
border-right-width borderRightWidth non-negative-length no layout, paint, hit number M6 Core
border-bottom-width borderBottomWidth non-negative-length no layout, paint, hit number M6 Core
border-left-width borderLeftWidth non-negative-length no layout, paint, hit number M6 Core
border-top-color borderTopColor color-current no paint color M6 Core
border-right-color borderRightColor color-current no paint color M6 Core
border-bottom-color borderBottomColor color-current no paint color M6 Core
border-left-color borderLeftColor color-current no paint color M6 Core
border-top-style borderTopStyle border-style no layout, paint, hit discrete M6 Core
border-right-style borderRightStyle border-style no layout, paint, hit discrete M6 Core
border-bottom-style borderBottomStyle border-style no layout, paint, hit discrete M6 Core
border-left-style borderLeftStyle border-style no layout, paint, hit discrete M6 Core
border-radius borderRadius non-negative-length no paint, hit number M6 Core
visibility visibility visibility yes paint, hit, semantics discrete M6 Core
font-family fontFamily font-family yes layout, paint discrete M6 Core
font-size fontSize positive-length yes layout, paint number M6 Core
font-weight fontWeight font-weight yes layout, paint number M6 Core
font-style fontStyle font-style yes layout, paint discrete M6 Core
line-height lineHeight line-height yes layout, paint number M6 Core
text-align textAlign text-align yes layout, paint discrete M6 Core
white-space whiteSpace white-space yes layout, paint discrete M6 Core
overflow-wrap overflowWrap overflow-wrap yes layout, paint discrete M6 Core
text-overflow textOverflow text-overflow no layout, paint discrete M6 Core
transform transform transform no paint, hit transform M6 Core
transform-origin transformOrigin position no paint, hit number M6 Core
pointer-events pointerEvents pointer-events yes hit discrete M6 Core
cursor cursor cursor yes hit discrete M6 Core
touch-action touchAction touch-action no hit, scroll discrete M6 Core
object-fit objectFit object-fit no layout, paint, hit discrete M6 Core
object-position objectPosition position no paint, hit number M6 Core
flex-grow flexGrow non-negative-number no layout, paint, hit, scroll number M6 Core
flex-shrink flexShrink non-negative-number no layout, paint, hit, scroll number M6 Core
flex-basis flexBasis length-auto no layout, paint, hit, scroll number M6 Core
box-shadow boxShadow box-shadow no paint, paintSelf discrete M6 Core
z-index zIndex z-index no paint, hit discrete M6 Core
position position positioning no layout, paint, hit, scroll discrete M6 Core
top top length-auto no layout, paint, hit, scroll number M6 Core
right right length-auto no layout, paint, hit, scroll number M6 Core
bottom bottom length-auto no layout, paint, hit, scroll number M6 Core
left left length-auto no layout, paint, hit, scroll number M6 Core
scrollbar-width scrollbarWidth scrollbar-width no paint, paintSelf discrete M6 Core
scrollbar-color scrollbarColor scrollbar-color yes paint, paintSelf discrete M6 Core

Shorthands

Shorthands are expanded in the Shell and never reach the ABI.

CSS property TypeScript name grammar expands to
margin margin box-length-auto marginTop, marginRight, marginBottom, marginLeft
padding padding box-non-negative-length paddingTop, paddingRight, paddingBottom, paddingLeft
gap gap pair-non-negative-length-normal rowGap, columnGap
overflow overflow pair-overflow overflowX, overflowY
border-width borderWidth box-non-negative-length borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth
border-color borderColor box-color-current borderTopColor, borderRightColor, borderBottomColor, borderLeftColor
border-style borderStyle box-border-style borderTopStyle, borderRightStyle, borderBottomStyle, borderLeftStyle
border border border borderTopWidth, borderRightWidth, borderBottomWidth, borderLeftWidth, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderTopStyle, borderRightStyle, borderBottomStyle, borderLeftStyle
flex flex flex flexGrow, flexShrink, flexBasis
inset inset box-length-auto top, right, bottom, left

Known deviations from CSS

Flex item automatic minimum size

min-width/min-height are auto initially, as CSS has them, and auto is the content-based minimum that keeps a flex item from being shrunk to nothing by a larger sibling. This subset answers it along the block axis only: a column flex container already measures every child's content height, so the floor costs nothing to know. Along the inline axis the content-based minimum is a leaf's longest unbreakable run, which needs a second text measurement this subset does not make, so a row's items may still be shrunk to zero; state min-width explicitly where that matters. A scroll container's automatic minimum is zero on the axis it scrolls, and it contributes nothing to an ancestor's minimum there either -- otherwise a virtualised list holding ten thousand rows would make every ancestor unshrinkable. Both properties reject negative lengths, which CSS does not accept either.

flex: <number> uses a 0px basis

CSS expands flex: 1 to 1 1 0%. This subset expands it to 1 1 0px. A 0% basis is indefinite when the container's main size is indefinite, whereas 0px is always definite; both resolve to the same number inside a definite container.

Percentage lengths in an indefinite axis resolve to zero

CSS treats a percentage against an indefinite containing block as auto. This subset resolves it to 0. The container's own content box is used whenever it is definite, including inside overflow: hidden/auto/scroll containers and along the block axis of column flow.

Percentage margins use one inline basis for the whole frame

A child's percentage margins are resolved once by its parent, against the parent's available inline content box, and the same values are used for measuring and for placement.

flex-shrink does not apply along a scrollable main axis

When a flex container scrolls along its main axis, overflowing content becomes scroll extent instead of a space deficit, so items are not shrunk. Growing still applies when the line is shorter than the viewport.

box-shadow is outer-only and paints under a transparent box

inset is rejected: drawing one needs an inverse path and a clip, and the shadcn preset has none. Canvas2D also paints the shadow behind the shape it came from, so a node with a transparent background shows the shadow through its middle where CSS would not; an opaque background covers it. Up to four shadows per node.

z-index reorders siblings, not stacking contexts

A z-index lifts or lowers a child within its own siblings, stably, so equal values keep document order. There are no stacking contexts: opacity and transform do not create one, and a z-index never escapes its parent. Accessibility order is deliberately unaffected, because a screen reader follows document order rather than what is drawn on top.

An absolutely positioned child is placed against its parent

CSS uses the nearest positioned ancestor as the containing block. This subset uses the parent's padding box, so every element is a containing block for its own absolutely positioned children and such a child must be a direct child of the box it is placed against. position: relative therefore has nothing left to mean and is not in the subset; use transform for a visual offset. With both left and right given, left wins and right is ignored; with neither, the child sits at the content-box origin rather than at its static position.

No flex-wrap

Flex containers are single-line. flex-wrap is not part of the subset, so main-axis overflow is clipped or scrolled rather than wrapped.

最后更新: