@animxyz/core
v0.6.7
Published
AnimXYZ is a composable animation library that makes your site shine
Readme
@animxyz/core
AnimXYZ is a composable animation library that makes your site shine.
See animxyz.com for full documentation.
Testing
Tests live in test/ and run on the plain Node.js test runner (node:test,
no extra framework). From this package directory:
npm testor from the repo root:
npm test -w @animxyz/core
# or
turbo run testturbo run test builds this package first (the test task depends on
^build in turbo.json), so the snapshot and size-budget tests always run
against freshly built output.
What's covered:
Compile test (
test/compile.test.js) —build.scsscompiles without errors, and without any Sass deprecation warnings (build.scssuses@use, not@import).Mixin API tests (
test/mixin-api.test.js) — small fixture.scssfiles undertest/fixtures/@usethe source directly and invoke the public mixins/functions (xyz-utility,xyz-var,xyz-set-all,xyz-animation,xyz-make-keyframes), asserting they compile and spot checking emitted declarations.test/fixtures/xyz-apply.scssdocuments a known bug (tracked by work brief A2,fix/xyz-apply): the mixin currently always errors due to swapped constructor arguments. Once A2 lands, flip that test from asserting the@errorto asserting a successful compile.test/fixtures/xyz-time-levels-override.scssproves that$xyz-duration-levels/$xyz-delay-levels/$xyz-stagger-levelsremain independently!default-overridable after being derived from the shared$xyz-time-levelsmap (work brief A3).Snapshot test (
test/snapshot.test.js) — compilesbuild.scss(expanded), normalizes it (strips comments, collapses whitespace, reflows to one declaration per line for reviewable diffs), and compares it against the committedtest/__snapshots__/animxyz.css. If you intentionally change compiled output, regenerate the snapshot with:npm run test:update-snapshotthen review the resulting
git diffand explain the change in your PR description — don't just regenerate and commit blindly.Size budget (
test/size-budget.test.js) — asserts the gzipped size ofdist/animxyz.min.cssstays under a fixed byte budget (measured size + 10% headroom). If a change intentionally grows the output, remeasure and updateBUDGET_BYTESin that file with justification in the PR.
Building from source
This package requires Dart Sass to compile src/*.scss (see sass in
devDependencies).
Minimum Dart Sass version: 1.57.0. The source uses sass:string's
string.split(), which was added in Dart Sass 1.57. If you @use this
package's src/*.scss directly (rather than consuming the prebuilt
dist/animxyz.css), make sure your own Sass compiler is at least 1.57.
