ShtukbaseStandard

Design scales

design-scales · version 0.1.0
Design4 norms3 checks

Spacing on a 4 px scale, font sizes from a short scale, radii and shadows from a set, line length of 45–75 characters. Checks on CSS, Tailwind classes and TSX styles; a judge looks at line length.

About the package

Norms for the sizes of an interface: spacing, font, corner radii, shadows, line length. All values come from the short lists on the page Scales; the same page says where the ideas come from (Refactoring UI, Material 3, Every Layout) and holds the settings.

What it installs

  • The page Scales.
  • Norms:
    • SCL-R01: spacing is a multiple of 4 px, 2 px below 16 px; the spacing check.
    • SCL-R02: font sizes from the scale, no more than 10 different ones; the type check.
    • SCL-R03: radii from the set, no more than 6 different ones; shadows from the theme, no more than 6; the shape check.
    • SCL-R04: a line of text is 45–75 characters; the judge judges/measure.md, helped by the measure sensor.

The checks read CSS, Tailwind classes (arbitrary values such as p-[13px]) and style={{…}} in TSX/JSX. They stand on the library of the design-base package; where they look for files is on its page Which files the design checks look at.

Where the boundary is

  • Values that go through var(), calc() or clamp() are not checked: the scale of the variables themselves checks them.
  • Color is not here: contrast is held by design-a11y, colors only from the theme by shadcn.
  • The package does not set the grid, breakpoints or line height.

Norms 4

IDNormLevelModeEnforcer
SCL-R01
Every spacing value (margin, padding, gap and spacing tokens) written as a length is a multiple of 4 px; below 16 px a step of 2 px is allowed; below 4 px it is fitting by eye, anything goes.
SHOULD blocks
check
SCL-R02
Every font size written as a length is taken from the typeScale scale, and a project has no more than maxFontSizes different sizes (10 by default).
SHOULD blocks
check
SCL-R03
Every corner radius written as a length is from the radii set (or a "pill", or a percentage), a project has no more than maxRadii (6) different radii; a shadow in a rule is taken from the theme (var(--shadow-…)), and a theme has no more than maxShadows (6) shadows.
SHOULD blocks
check
SCL-R04
A body-text paragraph in the widest window holds 45–75 characters per line.
SHOULD observes
judge

"Blocks": the enforcer stops a violation. "Observes": it only notes it. Level MUST means required; SHOULD means yes by default.

Actions 4

NameWhat it doesFileWhen
spacingSpacing on a 4 px scale
norm SCL-R01
checks/spacing.ts
check
typeFont sizes from a short scale
norm SCL-R02
checks/type.ts
check
shapeRadii and shadows from a short set
norm SCL-R03
checks/shape.ts
check
measureSensor: text widths in ch outside 45–75 characters (for the judge)checks/measure.ts
shtuk run

shtuk check runs the checks; shtuk run design-scales <name> runs any action. "After install" actions run by themselves only if the package comes from a trusted source.

Pages 5

They go into the project at these paths.

Package files 7

They go into .shtukbase/packages/design-scales/; actions run from there.