Reference
What's new
0.0.5 writes the stylesheet to web/ and 0.0.4 supports Jaspr 0.23. 0.0.3 puts everything in one package, jx_cli. 0.0.1 built the stylesheet inside jaspr serve, added components and converted Tailwind. 0.2 brought dark mode, groups, filters, gradients and animations.
Versions 0.0.4 and 0.0.5
| Version | Change |
|---|---|
0.0.5 |
jx init and jx build write the stylesheet to web/jx.css by default (was build/jx.css), so jaspr serve and jaspr build serve it at /jx.css. |
0.0.4 |
Supports Jaspr 0.23: the constraint is now >=0.22.4 <0.24.0, so dart pub add jx_cli works in projects created with the latest jaspr create. |
Upgrading to 0.0.5
A project that set output: build/jx.css
in jx.yaml keeps it. Without an
output key, move the
<link> to
/jx.css or set the old path back.
One package: jx_cli
The engine, the rules, the theme, the builder and the components now live in jx_cli. One
dart pub add jx_cli
installs everything; each part keeps its own import:
| Before | Now |
|---|---|
jx_engine |
package:jx_cli/engine.dart
|
jx_ui |
package:jx_cli/ui.dart
|
jx_builder |
package:jx_cli/builder.dart
|
jx_core, jx_parser, jx_theme, jx_rules, jx_generator
|
package:jx_cli/<name>.dart
|
Upgrading to 0.0.3
-
Replace the
jx_*dependencies withjx_cli: ^0.0.3, underdependencieswhen you use the components or the engine in your app. The former packages are discontinued on pub.dev. -
Rewrite the imports:
package:jx_ui/jx_ui.dartbecomespackage:jx_cli/ui.dart, and the same for the other packages. -
In
jx.yaml,packages: [jx_ui]becomespackages: [jx_cli/ui]. The old name still works. -
The builder is off by default: enable
jx_cli:jx_cssinbuild.yaml(see Automatic builds).
Version 0.0.1
| Package | What it does |
|---|---|
| builder | jaspr serve and jaspr build generate jx.css. No second terminal. |
| ui | Button, card, badge, alert and text field, accessible and themable. |
| jx migrate | Converts Tailwind classes in a project, with a report of approximations. |
packages: |
jx.yaml key: scans the lib/ folder of component libraries. |
Upgrading to 0.0.1
- Historical note: 0.0.1 was released after 0.2.1, which is now retracted. Use the latest jx_cli instead of these versions.
-
To use the builder, delete the
web/jx.csswritten by the CLI first.
In 0.2
New variants
-
dark:follows the system preference, or a.darkclass withdark_mode: class. -
group-hover:,peer-checked:and the othergroup-*/peer-*variants react to the state of a parent or a sibling. -
motion-safe:,motion-reduce:,print:,contrast-more:,portrait:,landscape:.
dark
:
bg
:
gray-900
@media (prefers-color-scheme: dark) {
.dark\:bg\:gray-900 {
background-color: #111827;
}
}
group-hover
:
c
:
blue
.group:hover .group-hover\:c\:blue {
color: #3b82f6;
}
motion-reduce
:
anim
:
none
@media (prefers-reduced-motion: reduce) {
.motion-reduce\:anim\:none {
animation: none;
}
}
New utilities
| Family | Classes |
|---|---|
| Transforms |
rot:45 skx:6 origin:top-left
|
| Filters |
blur:md bri:110 gs:100 dsh:lg
|
| Frosted glass |
bblur:lg bsat:180
|
| Gradients |
grad:to-r from:blue via:white to:teal
|
| Animations |
anim:spin anim:fade-in adur:500
|
| Media and backgrounds |
ar:video obf:cover bgp:center bs:dashed
|
| Alignment |
pi:center ac:between order:first basis:1/2
|
| Text |
truncate clamp:3 uppercase tw:balance sr-only
|
tx: and ty:
now stack on the same element, and filters compose: blur:sm bri:110
applies both.
grad:to-r
.grad\:to-r {
background-image: linear-gradient(to right, var(--jx-from, transparent), var(--jx-via,) var(--jx-to, transparent));
}
from:blue
.from\:blue {
--jx-from: #3b82f6;
}
@property --jx-from {
syntax: "*";
inherits: false;
}
blur:md
.blur\:md {
--jx-blur: blur(8px);
filter: var(--jx-blur,) var(--jx-brightness,) var(--jx-contrast,) var(--jx-grayscale,) var(--jx-hue-rotate,) var(--jx-invert,) var(--jx-saturate,) var(--jx-sepia,) var(--jx-drop-shadow,);
}
@property --jx-blur {
syntax: "*";
inherits: false;
}
anim:spin
.anim\:spin {
animation: jx-spin 1s linear infinite;
}
@keyframes jx-spin {
to {
rotate: 360deg;
}
}
Messages and diagnostics
A misspelled class is reported with a fix, offered only when that fix compiles. An unknown value lists the accepted values.
Warning: Invalid class syntax: "hover:hover:c:red" (repeated variant "hover").
Warning: Unknown class "pd:4": did you mean "p:4"?
Warning: "c:bleu" ignored: Invalid value "bleu" for "c". Did you mean "c:blue"?; accepted values: transparent, current, black, white, gray, gray-100, gray-300, gray-500, gray-700, gray-900, red, red-100…; or an arbitrary value in brackets.
In Dart, JxParser.analyze
returns the reason for a rejection as a code: unsafeValue,
duplicateVariant,
invalidValue…
Security
Bracketed values are validated before being written to the stylesheet. The details are on the Security page.
Migrating from 0.1
-
A plain value can no longer start with a dot:
lh:.5is rejected, writelh:[.5]. -
In an arbitrary value,
;,{,},<,!and\are rejected. -
The
_insideurl(…)are no longer turned into spaces. For a literal_elsewhere, write\_. -
tx:andty:now produce a--jx-tx/--jx-tyvariable: the rendering is the same, the generated CSS changes.