Documentation
¶
Index ¶
- Variables
- func Keyframes(name string, steps ...KeyframeStep) item
- func Media(query string, items ...item) item
- func MediaDesktop(items ...item) item
- func MediaPrefersDark(items ...item) item
- func Raw(css string) item
- func RawRule(s string) rawRule
- func Root(decls ...Decl) item
- func Rule(sel any, content ...RuleContent) item
- type Class
- type Decl
- func AlignItems(v Value) Decl
- func AlignSelf(v Value) Decl
- func All(v Value) Decl
- func Animation(v ...Value) Decl
- func Background(v Value) Decl
- func BackgroundColor(v Value) Decl
- func BackgroundImage(v Value) Decl
- func Bind(active, source Token) Decl
- func Border(v ...Value) Decl
- func BorderColor(v Value) Decl
- func BorderRadius(v ...Value) Decl
- func BorderRight(v ...Value) Decl
- func Bottom(v Value) Decl
- func BoxShadow(v Value) Decl
- func BoxSizing(v Value) Decl
- func Color(v Value) Decl
- func Cursor(v Value) Decl
- func Declare(t Token, value string) Decl
- func Display(v Value) Decl
- func Flex(v ...Value) Decl
- func FlexDirection(v Value) Decl
- func FontFamily(v Value) Decl
- func FontSize(v Value) Decl
- func FontWeight(v Value) Decl
- func Gap(v Value) Decl
- func GridArea(v Value) Decl
- func GridTemplate(v Value) Decl
- func GridTemplateColumns(v Value) Decl
- func GridTemplateRows(v Value) Decl
- func Height(v Value) Decl
- func JustifyContent(v Value) Decl
- func Left(v Value) Decl
- func LetterSpacing(v Value) Decl
- func LineHeight(v Value) Decl
- func ListStyle(v Value) Decl
- func ListStyleType(v Value) Decl
- func Margin(v ...Value) Decl
- func MarginLeft(v Value) Decl
- func MarginRight(v Value) Decl
- func MaxHeight(v Value) Decl
- func MaxWidth(v Value) Decl
- func MinHeight(v Value) Decl
- func MinWidth(v Value) Decl
- func Opacity(v float64) Decl
- func Outline(v Value) Decl
- func OutlineOffset(v Value) Decl
- func Overflow(v Value) Decl
- func OverflowY(v Value) Decl
- func Padding(v ...Value) Decl
- func PaddingBottom(v Value) Decl
- func PointerEvents(v Value) Decl
- func Position(v Value) Decl
- func Right(v Value) Decl
- func TextAlign(v Value) Decl
- func TextDecoration(v Value) Decl
- func TextShadow(v ...Value) Decl
- func TextTransform(v Value) Decl
- func Top(v Value) Decl
- func TouchAction(v Value) Decl
- func Transform(v Value) Decl
- func Transition(v ...Value) Decl
- func UserSelect(v Value) Decl
- func Visibility(v Value) Decl
- func Width(v Value) Decl
- func ZIndex(v Value) Decl
- type KeyframeStep
- type KeyframesItem
- type MediaItem
- type RawItem
- type RuleContent
- type RuleItem
- type Selector
- type Stylesheet
- type Token
- type Value
Constants ¶
This section is empty.
Variables ¶
var ( // Brand colors ColorPrimary = Token{"--color-primary", "#00ADD8"} ColorOnPrimary = Token{"--color-on-primary", "#1C1C1E"} ColorSecondary = Token{"--color-secondary", "#654FF0"} ColorOnSecondary = Token{"--color-on-secondary", "#FFFFFF"} ColorSuccess = Token{"--color-success", "#3FB950"} ColorError = Token{"--color-error", "#E34F26"} // Theme — active layer (consumed by components) ColorBackground = Token{"--color-background", "#FFFFFF"} ColorSurface = Token{"--color-surface", "#F2F2F7"} ColorOnSurface = Token{"--color-on-surface", "#1C1C1E"} ColorMuted = Token{"--color-muted", "#6E6E73"} ColorHover = Token{"--color-hover", "#B8860B"} // Theme — source layer (apps redeclare these for rebrand) ColorBackgroundLight = Token{"--color-background-light", "#FFFFFF"} ColorBackgroundDark = Token{"--color-background-dark", "#0D1117"} ColorSurfaceLight = Token{"--color-surface-light", "#F2F2F7"} ColorSurfaceDark = Token{"--color-surface-dark", "#161B22"} ColorOnSurfaceLight = Token{"--color-on-surface-light", "#1C1C1E"} ColorOnSurfaceDark = Token{"--color-on-surface-dark", "#E6EDF3"} ColorMutedLight = Token{"--color-muted-light", "#6E6E73"} ColorMutedDark = Token{"--color-muted-dark", "#8B949E"} ColorHoverLight = Token{"--color-hover-light", "#B8860B"} ColorHoverDark = Token{"--color-hover-dark", "#F7DF1E"} // Typography size scale TextXs = Token{"--text-xs", "0.75rem"} TextSm = Token{"--text-sm", "0.875rem"} TextBase = Token{"--text-base", "1rem"} TextLg = Token{"--text-lg", "1.25rem"} TextXl = Token{"--text-xl", "1.5rem"} Text2xl = Token{"--text-2xl", "2rem"} // Line-height / weight / tracking LeadingTight = Token{"--leading-tight", "1.25"} LeadingNormal = Token{"--leading-normal", "1.5"} LeadingRelaxed = Token{"--leading-relaxed", "1.75"} FontWeightRegular = Token{"--font-weight-regular", "400"} FontWeightMedium = Token{"--font-weight-medium", "500"} FontWeightBold = Token{"--font-weight-bold", "700"} TrackingTight = Token{"--tracking-tight", "-0.02em"} TrackingNormal = Token{"--tracking-normal", "0"} TrackingWide = Token{"--tracking-wide", "0.05em"} // Spacing (4px grid) Space1 = Token{"--space-1", "0.25rem"} Space2 = Token{"--space-2", "0.5rem"} Space3 = Token{"--space-3", "0.75rem"} Space4 = Token{"--space-4", "1rem"} Space6 = Token{"--space-6", "1.5rem"} Space8 = Token{"--space-8", "2rem"} Space12 = Token{"--space-12", "3rem"} // Border radius RadiusSm = Token{"--radius-sm", "4px"} RadiusMd = Token{"--radius-md", "8px"} RadiusLg = Token{"--radius-lg", "16px"} RadiusFull = Token{"--radius-full", "9999px"} // Elevation ShadowSm = Token{"--shadow-sm", "0 1px 2px rgba(0,0,0,0.05)"} ShadowMd = Token{"--shadow-md", "0 4px 6px rgba(0,0,0,0.1)"} ShadowLg = Token{"--shadow-lg", "0 10px 15px rgba(0,0,0,0.1)"} ShadowXl = Token{"--shadow-xl", "0 20px 25px rgba(0,0,0,0.15)"} // Motion DurationFast = Token{"--duration-fast", "150ms"} DurationBase = Token{"--duration-base", "250ms"} DurationSlow = Token{"--duration-slow", "400ms"} EaseIn = Token{"--ease-in", "cubic-bezier(0.4,0,1,1)"} EaseOut = Token{"--ease-out", "cubic-bezier(0,0,0.2,1)"} EaseInOut = Token{"--ease-in-out", "cubic-bezier(0.4,0,0.2,1)"} // Z-index ZBase = Token{"--z-base", "0"} ZDropdown = Token{"--z-dropdown", "100"} ZSticky = Token{"--z-sticky", "200"} ZModal = Token{"--z-modal", "300"} ZToast = Token{"--z-toast", "400"} ZTooltip = Token{"--z-tooltip", "500"} // Breakpoints BpSm = Token{"--bp-sm", "640px"} BpMd = Token{"--bp-md", "768px"} BpLg = Token{"--bp-lg", "1024px"} BpXl = Token{"--bp-xl", "1280px"} // Container widths MaxWProse = Token{"--max-w-prose", "65ch"} MaxWContent = Token{"--max-w-content", "1200px"} MaxWScreen = Token{"--max-w-screen", "1440px"} )
Token catalog — every token from the legacy theme.css.
Functions ¶
func Keyframes ¶ added in v0.0.3
func Keyframes(name string, steps ...KeyframeStep) item
Keyframes builds an @keyframes at-rule.
func MediaDesktop ¶ added in v0.0.5
func MediaDesktop(items ...item) item
MediaDesktop wraps the canonical "landscape + hover" media query used by tinywasm layouts to distinguish desktop from mobile. Reference: appears 4 times verbatim in platformd Appendix A.
func MediaPrefersDark ¶ added in v0.0.2
func MediaPrefersDark(items ...item) item
func RawRule ¶ added in v0.0.2
func RawRule(s string) rawRule
RawRule is a transitional escape hatch. New code SHOULD use the typed DSL. Each RawRule call site SHOULD carry a // TODO(css-dsl): add typed X comment naming the missing property, so reviewers can decide whether to extend the DSL or accept the raw use case (vendor-prefixed, exotic property, etc.).
func Rule ¶ added in v0.0.2
func Rule(sel any, content ...RuleContent) item
Types ¶
type Class ¶ added in v0.0.2
type Class string
Class is a CSS class name. Shared by HTML emission (WASM) and CSS emission (SSR). Only the string identity crosses the WASM boundary; pseudo-class helpers (Hover/Focus/Disabled) live in dsl.go (!wasm) because they only feed Rule().
type Decl ¶ added in v0.0.2
type Decl struct{ Prop, Val string }
func AlignItems ¶ added in v0.0.2
func Background ¶ added in v0.0.2
func BackgroundColor ¶ added in v0.0.2
func BackgroundImage ¶ added in v0.0.2
func BorderColor ¶ added in v0.0.2
func BorderRadius ¶ added in v0.0.2
func BorderRight ¶ added in v0.1.0
func FlexDirection ¶ added in v0.0.2
func FontFamily ¶ added in v0.0.2
func FontWeight ¶ added in v0.0.2
func GridTemplate ¶ added in v0.0.5
func GridTemplateColumns ¶ added in v0.1.0
func GridTemplateRows ¶ added in v0.1.0
func JustifyContent ¶ added in v0.0.2
func LetterSpacing ¶ added in v0.0.2
func LineHeight ¶ added in v0.0.2
func ListStyleType ¶ added in v0.0.5
func MarginLeft ¶ added in v0.1.0
func MarginRight ¶ added in v0.1.0
func OutlineOffset ¶ added in v0.0.2
func PaddingBottom ¶ added in v0.1.0
func PointerEvents ¶ added in v0.0.2
func TextDecoration ¶ added in v0.0.5
func TextShadow ¶ added in v0.0.5
func TextTransform ¶ added in v0.0.5
func TouchAction ¶ added in v0.0.5
func Transition ¶ added in v0.0.2
func UserSelect ¶ added in v0.0.5
func Visibility ¶ added in v0.0.5
type KeyframeStep ¶ added in v0.0.3
KeyframeStep is one step of a keyframes animation. At is the percentage or named position ("0%", "50%", "100%", "from", "to").
func At ¶ added in v0.0.3
func At(at string, decls ...Decl) KeyframeStep
At builds a KeyframeStep. Variadic Decls match the DSL's existing rule shape.
type KeyframesItem ¶ added in v0.0.3
type KeyframesItem struct {
// contains filtered or unexported fields
}
type MediaItem ¶ added in v0.0.2
type MediaItem struct {
// contains filtered or unexported fields
}
type RuleContent ¶ added in v0.0.2
type RuleContent interface {
// contains filtered or unexported methods
}
type Selector ¶ added in v0.0.2
type Selector string
Selector is a raw CSS selector string used by the DSL.
type Stylesheet ¶ added in v0.0.2
type Stylesheet struct {
// contains filtered or unexported fields
}
func NewStylesheet ¶ added in v0.1.0
func NewStylesheet(items ...item) *Stylesheet
func RenderCSS ¶ added in v0.0.2
func RenderCSS() *Stylesheet
func RootCSS ¶ added in v0.0.2
func RootCSS() *Stylesheet
func (*Stylesheet) String ¶ added in v0.0.2
func (s *Stylesheet) String() string
type Token ¶ added in v0.0.2
type Token struct{ Name, Fallback string }
Token is a design token: a named visual decision with a fallback value. Industry-standard term (W3C Design Tokens CG, Material, Carbon, Primer, Spectrum).
type Value ¶ added in v0.0.2
type Value interface {
// contains filtered or unexported methods
}
var ( Auto Value = kw("auto") None Value = kw("none") Block Value = kw("block") Flex_ Value = kw("flex") Grid Value = kw("grid") Inline Value = kw("inline-block") Center Value = kw("center") Zero Value = kw("0") Pointer Value = kw("pointer") Fixed Value = kw("fixed") Absolute Value = kw("absolute") Unset Value = kw("unset") Initial Value = kw("initial") FlexEnd Value = kw("flex-end") SpaceAround Value = kw("space-around") Row Value = kw("row") Column Value = kw("column") Hidden Value = kw("hidden") Visible Value = kw("visible") Uppercase Value = kw("uppercase") Capitalize Value = kw("capitalize") RightText Value = kw("right") )