- Adds an
Image
component for embedding images in your visualizations. (#174). - Adds a
debug
prop toMafs
to make it easy to peek outside the current camera's view for debugging lazy-loaded visualizations.
- Fixes 'overhandling' of arrow keypresses (#169)
- Use package entrypoints, correctly tag this package as ESM using "type": "module" (#170).
- All plots (OfX, OfY, and Parametric) now support a
domain
prop. Previously, only theParametric
component supported setting a domain, and the prop to do so was calledt
, but this prop has been deprecated in favor of the newdomain
prop across all three plot components. Eventually,t
will be removed.
- VectorField no longer breaks when rendering the vector
[0, 0]
(#164).
- Mafs no longer declares a dependency on Node 20.11, instead depending on Node 20. In the future, the published version of Mafs will not declare an
engines
field at all, since Mafs is, of course, just a frontend project.
- The stroke width of axes on
Coordinates.Cartesian
have now been parameterized via the--mafs-axis-stroke-width
CSS custom property. (#160) - A bug that caused
Coordinates.Cartesian
to re-render frequently due to a changing ID has been fixed (#159).
- The appearance of dashed lines has been unified across various components, and is now accessible via
var(----mafs-line-stroke-dash-style)
. Thanks @jeremywiebe! #153.
- This version is published without
"type": "module"
in package.json to improve compatibility with some environments.
- As of #144, there is a new hook,
useMovable
, that has been extracted out ofuseMovablePoint
, and will eventually be used for being able to move various Mafs elements.
- Vectors are no longer always red. This was a silly mistake introduced in v0.18.1 as I was trying to test that alternate Vector colors work. Mafs has automated visual regression tests, but they don't run in CI, and I believe they should.
- Vectors no longer render a white outline, allowing them to be recolored correctly (see #137).
- In #135, the adaptive plotter was improved to more accurately plot highly periodic functions, and also to avoid plotting duplicate points. This should give a quality boost to most plots, but may slightly alter some. The sampling depth parameters are now "one lower", meaning that if you were previously passing
maxSamplingDepth={15}
, for example, you should now passmaxSamplingDepth={16}
. Change is annoying, but the depth made no sense before, and now it does (a depth of 16 means 2¹⁶ subdivisions).
- Introduces the LaTeX component.
- Deprecates the
ssr
attribute in favor of never rendering Mafs until hydration.
- Mafs now supports rendering a
Polyline
(previously it only supportedPolygon
). Thanks @Mesoptier! - Mafs now has
Plot.Inequality
for rendering the area greater than, less than, or between two functions.
- The
<Mafs />
component now has anonClick
prop.
- Fixes a regression introduced in v0.15.1 where the axis labels had a white fill regardless of the
--mafs-origin-color
custom property.
- Mafs now supports zooming! It's opt-in, and can be enabled by setting the
zoom
prop onMafs
. See the Mafs docs for more information.
CartesianCoordinates
is nowCoordinates.Cartesian
. In addition to Cartesian coordinates, you can now also useCoordinates.Polar
to display polar coordinates. See the Coordinates docs for more information.
- Fixes an issue (#95) where arrow markers in
Vector
were transformed incorrectly and looked comically large.
vec.Matrix
is now a 2x3 matrix instead of a 3x3 matrix. This is a potentially breaking change from a TypeScript perspective, but shouldn't have any real impact on behavior—other than making things faster! Thank you to @sritchie for identifying this opportunity and improving a lot of the code invec
.
- Mafs has had a mostly-internal update to correct the TypeScript types that were being exported. This is unlikely to affect existing code, unless you were importing
Vector2
orMatrix
from Mafs. The correct way to import those types is nowimport { vec } from 'mafs'
and then usevec.Vector2
andvec.Matrix
.
- All exported Mafs components now have
displayName
, making the React devtools a little easier to read.
- Introduces a new debug component,
Debug.ViewportInfo
.
- Fixes a subtle bug introduced in v0.11.1 involving Safari treating empty CSS elements the same as undefined ones.
- Fixes a tiny bug where
--mafs-user-transform
was not defined byMafs
, causing CSS to treat some transform strings as invalid.
- Mafs now exposes a bit of its internals to allow you to use your own custom components. See the documentation on Custom Components for more information.
- Fixes a bug where
Text
would have an ugly stroke when a custom color is set (#85).
VectorField
is nowPlot.VectorField
FunctionGraph
is nowPlot
- Several props from these components have changed. See the documentation on Plots for the latest guidance.
- Mafs' numerical function sampling algorithm has been improved.
- There is now a
Plot.OfY
. BothPlot.OfX
andPlot.OfY
usePlot.Parametric
under the hood.
-
Mafs now ships with the Computer Modern typeface, and makes it easy to use in your own project. It just requires a change to your CSS:
-@import "mafs/build/index.css"; +@import "mafs/core.css"; +@import "mafs/font.css"; /* optional */
"mafs/build/index.css"
is still included in the package to avoid breaking things. It will be removed in a future release.
- Ensures that
React.PropsWithChildren
is used for components that accept children, for React 18 compatibility reasons.
- Fixes a bug involving the ESM build.
- Added the
Transform
component - Added the
viewBox
prop
xAxisExtent
andyAxisExtent
have been replaced withviewBox
.
- When
pan
is enabled on aMafs
view, keyboard users can now focus on the view itself and use the arrow keys to pan.
MovablePoint
will no longer get stuck in its dragging state.
vec
is now exposed as an export frommafs
, inlining the previously separatevec-la
package and making it type-safe.
- Fixes a bug where cartesian coordinate lines would flicker due to some floating point rounding errors.
MovablePoint
can now be used directly, no longer is it hidden behinduseMovablePoint
. See the Movable Points docs.useMovablePoint
now returns asetPoint
function which allows you to set the point's position imperatively.
- Bundle is now transpiled to browserslist's
defaults
for compatibility.
- Smooth interpolation for parametric functions: the parametric function sampling algorithm now dynamically increases the number of samples depending on the roughness of a function. See PR #37.
- Fixes an issue where, given certain
constrain
functions inuseMovablePoint
, using the keyboard to move points didn't work (see PR #23). Also, keyboard movement was generally broken in certain cases.
- Axis labels looked odd in Firefox—they were misaligned. Internally, switching from
alignmentBaseline
todominantBaseline
fixed this.
- Not really a "bug", but Mafs incorrectly declared too strict of a dependency on React 16.8, causing a peerdependency warning when using React 17.
- Mafs no longer has a runtime dependency on gl-matrix-invert, gl-mat2, gl-mat3, or gl-mat4.
- The TypeScript types for
VectorField
no longer (erroneously) require thexyOpacity
andopacityStep
props.
- Added
Line.Segment
- Added Bezier curve example
FunctionGraph.Parametric
now supports decreasing values oft
, enabling functions to be evaluated "backwards".
- Dashed lines are now dashier (the dash array was changed from
4,3
to1,10
).
- Re-released as bundled by esbuild. Slightly smaller bundle with minified CSS. No behavioral changes.
- Re-released under MIT license. No code changes.
Improved the build process to roll up TypeScript types using api-extractor. No changes have been made to any APIs, but the exported types should more closely match what is actually exported.