f9b2d7d19a
Previously, codec classes were defined and registered in the same file as the class they targeted. This prevented efficient tree-shaking: as soon as the target class was imported (e.g. `StyleSheet`), the corresponding codec was also imported (`StyleSheetCodec`). As a result, a large amount of codec code (and dependent code) was present in applications incorporating maxGraph, even if they didn't use the codec function. As there are currently many problems with the codec function that make it almost unusable, this was a great waste. Codecs are no longer registered by default, which reduces side effects and coupling. It also greatly improves tree-shaking. For example, in the `ts-example` application included in this repository which doesn't use the "codec" feature, the size of the minified `maxGraph` chunk goes from `568.58 kB` to `467.90 kB`, which corresponds to a size reduction of `17.7%`! BREAKING CHANGE: Codecs supplied by `maxGraph` are no longer registered by default. They MUST be registered before performing an `encode` or `decode`. You can use one of the following functions to register codecs: - `registerAllCodecs` - `registerCoreCodecs` - `registerEditorCodecs` |
||
---|---|---|
.. | ||
src | ||
README.md | ||
favicon.svg | ||
index.html | ||
package.json | ||
tsconfig.json | ||
vite.config.js |
README.md
TypeScript project using the maxGraph npm package
Initialized from https://github.com/vitejs/vite/tree/v2.9.8/packages/create-vite/template-vanilla-ts
Setup
Initialize all packages
From the repository root, run
npm install
.
Build maxgraph@core
From the
packages/core
directory, runnpm run generate-esm
.
Run
Run npm run dev
and go to http://localhost:5173/
If you want to bundle the application, run npm run build
and then run npm run preview
to access to a preview of the
bundle application.