Closed kolibril13 closed 1 year ago
I just released version 0.2.0 which doesn't need the prefixing with https://esm.sh anymore, and some bugs are fixed.
So these examples now work out of the box (modulo the default export, see below).
For mafs you need to load some CSS:
%%html
<link rel="stylesheet" href="https://unpkg.com/mafs@0.16.0/core.css">
(This works in the notebook.)
I've put in the documentation a note about having a default export (e.g. export default function HellowFx()
) https://github.com/widgetti/ipyreact#facts
For completeness, this works:
%%react
import { Mafs, Coordinates } from "mafs"
export default function HelloFx() {
return (
<Mafs>
<Coordinates.Cartesian />
</Mafs>
)
}
This is absolutely amazing!!! and it even works in VS Code:
I did some testing, and a lot of things are working out of the box, thank you so much for these gold gems!
One thing that did not work are these draggable elements, e.g. from this example https://mafs.dev/guides/display/lines
%%react
import { Mafs, Line, Coordinates, useMovablePoint } from "mafs"
import * as React from 'react';
export default function HelloFx() {
const point1 = useMovablePoint([-2, -1])
const point2 = useMovablePoint([2, 1])
return (
<Mafs viewBox={{ x: [-2, 2], y: [-1, 1] }}>
<Coordinates.Cartesian />
<Line.Segment
point1={point1.point}
point2={point2.point}
/>
{point1.element}
{point2.element}
</Mafs>
)
}
I could pin the issue to
{point1.element}
and {point2.element}
causing the message: Error Cannot convert undefined or null to object
and it even works in VS Code:
Was wondering about that!
Thank you so much for these gold gems!
❤️
I really don't know why this doesn't work. I tried to debug it, but I got nowhere, I hope you have more success by now. Note that we are using React 18, maybe that matters?
Thanks for your efforts! I will do some further investigations on this and will contribute the results. Either as documentation (hopefully) or as a bug report.
😍
Some react components work out of the box, e.g. https://mui.com/material-ui/react-rating/, some others dont.
works
Does not work
I went to a tldraw react code sandbox, https://codesandbox.io/s/n539u?file=/src/App.tsx copied the code and pasted it into a notebook, but now I get an "Unable to resolve specifier" error :
tldraw does not work
mafs.dev does not work
from https://mafs.dev/guides/get-started/installation .