Document completed flex, structural selectors and radial gradients

This commit is contained in:
waozi committed 2026-11-26 10:23:13 -03:00
1 parent 074c039842
commit b96d50b6b2
3 files changed
+50 -21

No files matched your search

+26 -2
View File
@@ -2,6 +2,30 @@
## Unreleased
- `radial-gradient()` parses and paints natively in `background` and
`background-image`: `[circle | ellipse] [<extent> | <radius> [<radius>]]?
[at <position>]` — extent keywords `closest-corner` (default),
`closest-side`, `farthest-corner` and `farthest-side`; a circle radius is a
`px` length, ellipse radii are `px` or `%` — with two to six percentage
stops sharing the linear gradient's stop list. Row, Column and Grid paint
it as bands from the computed center and radii; other widgets keep the
first-and-last-colors face. Conic and repeating gradients stay refused.
Packs stay 128 words a rule. Pins Kryon 3f37001a.
- Structural sibling selectors are native: `:last-child`, `:only-child`,
`:nth-child(an+b)`, `:first-of-type`, `:last-of-type`, `:only-of-type` and
`:nth-of-type(an+b)` join `:first-child`. Early positions match while the
frame builds; late positions read the previous frame's committed children,
so a structure change converges on the next frame. The pack format is 128
words a rule; older packs are refused as stale. Pins Kryon 35a52f70.
- Flex completes its native subset: `wrap-reverse`, percentage `flex-basis`
(also through `flex`), `order`, `align-content` distributing wrapped lines,
and `baseline` alignment on `align-items` and `align-self`, alongside the
existing directions, justification, grow/shrink and min/max constraints.
Intrinsic basis keywords (`min-content`, `max-content`, `fit-content`)
remain browser-only.
- Pin Ziran ba28d7c0 and Kryon 6a41ba74 so applications share the fixed GPU skinning, native entry, web scene compilation and hosted package naming paths.
- Build with Ziran c041afb6 and Kryon 09664f07: the DOM test app declares `main` and runs `App.Run` like every Kryon program now that the program-export program entry is gone, and the DOM browser test expects the `kryon_program_host` runner artifacts.
@@ -16,9 +40,9 @@
- `transform` (translate, scale and rotate functions with their X and Y forms), `scale`, `rotate` and `transform-origin` are native: Kryon applies them at paint time on every host to Row, Column, Grid, Button, Card, Text, Heading, Link and Image and to what they contain, with `:hover` and `:active` following the pointer, and `transition: transform …` eases them. They are opt-in paint code: the app calls `PaintTransformInstall()` (kryon/paint_transform) once, and `CssSheetInstall` refuses a sheet that sets a transform until it has, with that instruction. Skew, `matrix()`, 3D functions, `translate()` percentages and shearing lists fail a plain native parse with the reason. The pack format is 116 words a rule. Pins Kryon fdd70c4b.
- `linear-gradient()` takes any angle (`deg`, `turn`, `rad`, `grad`) or `to` a side or corner, and two to six color stops with `%` positions, in `background` and `background-image`; Row, Column and Grid paint them, other widgets a top-to-bottom gradient of the first and last colors (`css_tool check` says so). Radial, conic and repeating gradients are refused natively with the reason. The pack format is 101 words a rule. Pins Kryon d0711324.
- `linear-gradient()` takes any angle (`deg`, `turn`, `rad`, `grad`) or `to` a side or corner, and two to six color stops with `%` positions, in `background` and `background-image`; Row, Column and Grid paint them, other widgets a top-to-bottom gradient of the first and last colors (`css_tool check` says so). Conic and repeating gradients are refused natively with the reason; `radial-gradient()` joins above. The pack format is 101 words a rule. Pins Kryon d0711324.
- Selectors take tree context natively: one ancestor by class or id (`.card Text`), the parent (`.card > Text`), `:first-child`, and `:not(.class)` or `:not(:state)`, also in nested `&` rules, and the DOM export writes them as browser selectors. `:last-child`, `:nth-child()`, typed or second ancestors and sibling combinators fail with the native idiom. The pack format is 87 words a rule. Pins Kryon 56777c65.
- Selectors take tree context natively: one ancestor by class or id (`.card Text`), the parent (`.card > Text`), `:first-child`, and `:not(.class)` or `:not(:state)`, also in nested `&` rules, and the DOM export writes them as browser selectors. Typed or second ancestors and sibling combinators fail with the native idiom; the structural `:last-child` and `:nth-child()` family joins above. The pack format is 87 words a rule. Pins Kryon 56777c65.
- Per-side borders are native on Row, Column and Grid: `border-top|right|bottom|left`, `border-block-start|end` and `border-inline-start|end`, each with `-width`, `-color` and `-style`, with `var()` values; a uniform border later in the same rule clears earlier sides. With a border radius the box paints its uniform border and `css_tool check` reports it. `outline`, `outline-width` (also `thin`, `medium`, `thick`) and `outline-offset` size the native focus ring; `outline: none` keeps it, and `css_tool check` says so. Border widths take `thin`, `medium` and `thick`. The pack format is 82 words a rule. Pins Kryon d97c19e8.
+23 -18
View File
@@ -79,14 +79,17 @@ one class (`.primary`), one ID (`#save`; set `props.id` to `StyleId("save")`),
Kryon attributes (`[role=Label]`, `[tone=Accent]`, `[emphasis=Soft]`,
`[size=Small]`, `[state=normal]`) and one state pseudo-class:
`:hover`, `:active`, `:focus`, `:focus-visible`, `:disabled`, `:selected`,
`:checked` or `:loading`, in comma lists. `:first-child`, `:not(.class)` and
`:not(:state)` add tree context, and so may one ancestor, matched by its class
or id, before the compound: `.card Text` (any ancestor) or `.card > Text` (the
parent). Kryon matches the widget being styled as the next child of the open
container while the frame builds, so `:last-child` and `:nth-child()`, which
need later siblings, are errors, as are a typed ancestor (`Row Text`), a
second ancestor (`.a .b .c`) and sibling combinators (`+`, `~`): give the inner
widget its own class (`Text.card-title`). A rule can hold nested `&:state`,
`:checked` or `:loading`, in comma lists. `:not(.class)` and `:not(:state)`
add tree context, and so may one ancestor, matched by its class or id, before
the compound: `.card Text` (any ancestor) or `.card > Text` (the parent).
Structural positions also work: `:first-child`, `:last-child`, `:only-child`,
`:nth-child(an+b)`, `:first-of-type`, `:last-of-type`, `:only-of-type` and
`:nth-of-type(an+b)` (`.item:nth-child(2)`, `Text:last-child`). Early facts
match while the frame builds; late facts (`:last-child` family) read the
previous frame's children, so a structure change converges on the next frame.
A typed ancestor (`Row Text`), a second ancestor (`.a .b .c`) and sibling
combinators (`+`, `~`) are errors: give the inner widget its own class
(`Text.card-title`). A rule can hold nested `&:state`,
`&.class`, `&#id`, `&[attribute]`, `&:first-child` and `&:not(...)` rules one
level deep; each adds its parts to every parent selector and may not set a
class, id, attribute or state the parent sets to another value.
@@ -138,7 +141,7 @@ Anything else is browser-only or an error.
| `text-align` | `Text` | `center` | start, left, center, end or right |
| `display` | `Row` | `flex` | flex (Row, Column) or grid (Grid) |
| `flex-direction` | `Row` | `row-reverse` | row, column and their -reverse |
| `flex-wrap` | `Row` | `wrap` | wrap or nowrap |
| `flex-wrap` | `Row` | `wrap-reverse` | wrap, wrap-reverse or nowrap |
| `justify-content` | `Row` | `space-between` | normal, flex-start, center, flex-end, space-between, -around, -evenly |
| `align-items` | `Row` | `center` | start, center, end, stretch, normal |
| `align-self` | `Text` | `flex-end` | auto, start, center, end, stretch |
@@ -261,15 +264,17 @@ Anything else is browser-only or an error.
`id` and `class_name` when a selector matches it. `display: grid` maps
to `Layout.Grid`. Native code selects the container.
- Flex directions are `row`, `row-reverse`, `column` and `column-reverse`.
Lines support `wrap` and `nowrap` and use the main-axis and cross-axis gaps.
Justification supports `normal`, `flex-start`, `center`, `flex-end`,
`space-between`, `space-around` and `space-evenly`. Alignment supports
`start`/`flex-start`, `center`, `end`/`flex-end`, `stretch`, `normal`, and
`auto` for `align-self`. Stretch fills an unset cross extent. Flex basis
accepts `auto`, nonnegative `px` and `rem`, and zero. The `flex` shorthand
also accepts `none`, `auto` and `initial`. Percentage or intrinsic basis,
`wrap-reverse`, baseline alignment and cross-line distribution are outside
this native subset.
Lines support `wrap`, `wrap-reverse` and `nowrap` and use the main-axis and
cross-axis gaps. Justification supports `normal`, `flex-start`, `center`,
`flex-end`, `space-between`, `space-around` and `space-evenly`. Alignment
supports `start`/`flex-start`, `center`, `end`/`flex-end`, `stretch`,
`normal`, `baseline` and `auto` for `align-self`, with `align-content`
distributing wrapped lines the same way. Stretch fills an unset cross
extent. Flex basis accepts `auto`, nonnegative `px` and `rem`, zero, and a
percentage of the container's inner main size. The `flex` shorthand also
accepts `none`, `auto` and `initial`. Intrinsic basis keywords
(`min-content`, `max-content`, `fit-content`) remain outside this native
subset.
- `Card.Draw` uses stylesheet axis padding for its returned content rectangle.
- Native `Text`, `Heading` and `ParagraphText` read `font-weight`,
`font-style` and `letter-spacing`. Weight takes `normal` (400), `bold` (700)
+1 -1
View File
@@ -61,7 +61,7 @@ css_catalog_3: [10]CssCatalogEntry = .[
.{"flex-direction", "Row", "row-reverse", "row, column and their -reverse"}];
css_catalog_4: [10]CssCatalogEntry = .[
.{"flex-wrap", "Row", "wrap", "wrap or nowrap"},
.{"flex-wrap", "Row", "wrap-reverse", "wrap, wrap-reverse or nowrap"},
.{"justify-content", "Row", "space-between", "normal, flex-start, center, flex-end, space-between, -around, -evenly"},
.{"align-items", "Row", "center", "start, center, end, stretch, normal"},
.{"align-self", "Text", "flex-end", "auto, start, center, end, stretch"},