waozi 95387b23f5 Parse, format, and install KSS style sheets as a package over Kryon
KSS moves here from Kryon, with the classic, lightfield, and material
style packs, the pack module generator, and the parser tests and
sanitized fuzzing. Kryon keeps the rule table and style resolution;
apps that read .kss text add this package and import kss/Kss or
kss/SystemStyle.
2026-09-29 20:56:55 -03:00

KSS

KSS is the style sheet language of Kryon applications. This package parses and formats .kss sheets, resolves their @imports and color tokens, installs the rules into Kryon's style table, and ships the classic, lightfield, and material style packs in styles/. Kryon itself only resolves installed rules; apps that read .kss text add this package.

Use it

ziran add https://github.com/kryonlabs/kss.git
using Styles :: #import "kss/Kss";
#import "kss/SystemStyle"

BeginStyleRules, ParseStyleRules, and InstallParsedStyleRules parse a sheet in steps and install it; ProvideStyleRulesImport answers an @import. SystemStyle picks a pack that matches the desktop theme. The classic pack is also compiled in as style_pack_classic, so an app can install it without shipping the .kss file.

Develop

make check checks the package, runs the parser and style tests as portable bundles and native code, verifies that src/style_pack_classic.zi matches styles/classic.kss, and fuzzes generated and damaged sheets under AddressSanitizer and UndefinedBehaviorSanitizer. After editing styles/classic.kss, run make style-packs and commit the regenerated module with it. make fuzz FUZZ_SEED=N FUZZ_COUNT=M runs other sheets; a failing one is kept in build/kss-fuzz/ with a command that shrinks it.

To test against local checkouts, keep them next to this one and put this in an ignored ziran.local.toml:

[overrides]
ziran = "../ziran"
kryon = "../kryon"
S
Description
CSS parser, style pack compiler, formatter and browser export tools.
Readme BSD-3-Clause
2.3 MiB
0 Stars 1 Watchers 0 Forks
Languages
Ziran 82.7%
CSS 14.5%
Python 1.5%
Shell 0.8%
Makefile 0.4%