- EchoLabel Upgrades: Now supports notifications, warnings, errors, spinners, and progress bars.
- Documentation Integration: Autocomplete includes links to both: WLJS and Wolfram documentation.
- Improved Code Pasting: Special handler converts unsupported Mathematica expressions using a local kernel.
- NB format Support: Enhanced parser of
.nb
files. - New
dragsignal
Event: Enables manual control over drag behavior for constrained interactions. - Code Formatter Fixes: Now it handels WLJS syntax sugar properly.
- Information Display: Switched to Wolfram's native
Information
output (image-based). - Docs & Tutorials: New guides including porting dynamics from Mathematica to WLJS.
- Autocomplete UI: More user-friendly info boxes for symbol suggestions.
- Better support of PlotLabel and Inset
- Better ticks for 3D plots
EchoLabel toolsโ
There is a very old symbol EchoLabel
, which is an operator form of Echo
with a label. We extended its properties, which allows user programs to various push notifications:
EchoLabel["Test"]["This is normal one"];
>> "Test" "This is normal one"
Print to notifications:
EchoLabel["Notification"]["This will always appear at the top"];
Warning messages:
EchoLabel["Warning"]["This will a warning"];
Error message:
EchoLabel["Error"]["This will an error"];
Spinner:
spinner = EchoLabel["Spinner"]["Hey. I am spinning"];
spinner["Cancel"]; (* or Delete[spinner] *)
Progress bar:
bar = EchoLabel["ProgressBar"]["I am progressing"];
bar["Set", 0.5];
bar["SetMessage", "Hey!"];
bar["Cancel"];
Links to documentationโ
We extended our autocomplete window to work with WLJS specific symbols. Clicking on ๐ icon will pop up a window with our documentation search results:
For Wolfram Language standard symbols an official WR documentation will be opened.
Pasting Mathematica codeโ
When you copy code from Wolfram Language documentation it may include some special elements like compressed graphics expressions or other, which can be understood by Mathematica, but not WLJS.
We added a special handler for such cases, that will automatically convert expressions using a local kernel:
i=(*VB[*)(FrontEndRef["a08ba99a-3516-4aa4-a284-d753c6a25ee2"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKJxpYJCVaWibqGpsamumaJCaa6CYaWZjoppibGiebJRqZpqYaAQCDiRWa"*)(*]VB*);
Make sure, that any kernel is connected to a notebook
This also works with Mathematica or Wolfram Player directly:
Better support of Mathematica notebooksโ
We made quite a big step towards .nb
format by writting a custom Box
converter from StandardForm
of Mathematica to StandardForm
of WLJS Notebook. Here are some examples:
Drag event expansionโ
You might have already used the drag
event handler on some graphics primitives. We have extended it with a sibling event, dragsignal
. Here is the catch:
dragsignal
allows you to capture a drag event without actually dragging the graphics primitive. Why bother? It gives you manual control over the position of the primitive, for example, for constrained dragging:
outer = RegionDifference[ Rectangle[{-1,-1}, {1,1}], RegionUnion[ Rectangle[{-0.9,-0.9}, {0.9,-0.4}] , Rectangle[{0.4,-0.9}, {0.9,0.4}] ] ]; outer = Rationalize[outer, 0]; (* WL14 bug *) RegionPlot[outer]; distanceOp = RegionDistance[outer, Translate[Rectangle[-{0.2,0.2}, {0.2,0.2}], #]]&; rect = {0.65, 0.15}; RegionPlot[outer, Epilog->{ Red, Translate[EventHandler[ Rectangle[-{0.2,0.2}, {0.2,0.2}], {"dragsignal" -> Function[target, rect = { If[distanceOp[{target[[1]], rect[[2]]}] > 0.01, target[[1]] , FixedPoint[If[distanceOp[{#, rect[[2]]}] > 0.01, # + 0.01 (target[[1]] - #) , # ]&, rect[[1]]] - 0.01 (target[[1]] - rect[[1]]) ], If[distanceOp[{rect[[1]], target[[2]]}] > 0.01, target[[2]] , FixedPoint[If[distanceOp[{rect[[1]], #}] > 0.01, # + 0.01 (target[[2]] - #) , # ]&, rect[[2]]] - 0.01 (target[[2]] - rect[[2]]) ] } ]} ], Offload[rect]] }]
(*VB[*)(FrontEndRef["4d06c1b4-b92f-483c-9c7b-69a29bacbc9c"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKm6QYmCUbJpnoJlkapemaWBgn61ommyfpmlkmGlkmJSYnJVsmAwCG6hY3"*)(*]VB*)
Evaluate the cell above and try to drag a rectangle. When you drag, it esimates the distance to the cutout and manually moves a rectangle to the closest position allowed.
Code Formatterโ
We have improved our code formatter, which relies on the official CodeFormatter
package:
It was broken for a long time, but now it can correctly escape our syntax sugar.
InformationDataโ
We removed our representation of Information
in a favour of Wolfram's standard one:
?Integrate
(*VB[*)(FrontEndRef["57588672-b8c7-443f-996e-b085b8c08b87"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKm5qbWliYmRvpJlkkm+uamBin6VpamqXqJhlYmAKFDCySLMwBc/UVCg=="*)(*]VB*)
As a drawback: it is picture and non-interactable.
Documentationโ
New examples, new tutorials!
See how to port or optimize dynamics from Mathematica to WLJS:
https://wljs.io/frontend/Advanced/Dynamics/Porting%20from%20MMA/
Better Autocompleteโ
We reformatted all autocomplete info boxes to make it beautiful:
Better support of PlotLabel and Insetโ
There was a complain, why in WLJS all labels have to be string. We changed that:
The same counts for Inset
:
Graphics[{Circle[], Inset[x^2 + y^2 == 1, {0, 0}]}, ImageSize->Small]
Better ticks for 3D plotsโ
It is only getting better!
NDSolve[{D[u[t, x], t] == D[u[t, x], x, x], u[0, x] == 0, u[t, 0] == Sin[t], u[t, 5] == 0}, u, {t, 0, 10}, {x, 0, 5}];
Plot3D[Evaluate[u[t, x] /. %], {t, 0, 10}, {x, 0, 5}, PlotRange -> All, ColorFunction -> "SunsetColors"]
Try this one