WLJS LogoWLJS Notebook

Structure

A template repository is available at Github wljs-plugin-template

Most extensions have the following folder structure

name-of-package/
	package.json       <--- most important
	src/ 
		Kernel.wl      <--- usually loaded to Evaluation Kernel
		Frontend.wl    <--- usually loaded to Main Kernel
		kernel.js      <--- usually some JS libraries
	dist/
		kernel.js      <--- bundled JS libraries (if applicable)
		kernel.min.js
	templates/         <--- usually WLX templates for UI element
		Button.wlx
		Item.wlx
		...
	...

The most important file is package.json, while the rest is only the recommendation, but you will anyway configure all paths in JSON file.

package.json

This is standard package declaration file from NodeJS, but modified with extra field for WLJS-specific features

package.json
{
  "name": "<name-of-package>",
  "version": "<X.Y.Z>",
  "description": "<short-description>",
  "wljs-meta": {
    "js": "dist/kernel.js" | Array<string>, //will be injected to HEAD
    "minjs": "dist/kernel.min.js" | Array<string>, //will used when exported to HTML
    "kernel": "src/Kernel.wl" | Array<string>, //loaded to Evaluation Kernel
    "deferred": "src/package" | Array<string>, //will be exposed to PATH of Evaluation Kernel
    "frontend": "src/Frontend.wl" | Array<string>, //loaded to Main Kernel
    "category": "<catergory-name>",
    "priority": 5000, 
    "menu": [ //top-menu items
        {
          "label": "<label>",
          "event": "<unique-event-id>",
          "section": "kernel" | "edit" | "view" | "file" | "misc",
          "spawnWindow": true | false, 
          "accelerator": [
            "<hotkey-mac>",
            "<hotkey-winlin>"
	      ],         
          "type": "button" //reserved
        }
    ]
  }
  ...
}

All fields inside wljs-meta are optional, there is no need in putting all listed in the example above.

It is worth to note, that deferred can be used to load paclets or standard Wolfram Packages to Evaluation Kernel, since the content will not be loaded to the kernel, but only exposed to be required later by Needs.

Documentation is not yet complete. Please open on issue on Github for us to prioritize this direction.

Please see examples in this section for more information.

On this page