thenickdude / chickenpaint

An HTML5 Port of the ChibiPaint multi-layer Oekaki painting tool
GNU General Public License v3.0
117 stars 21 forks source link

chickenpaint as an npm module or a react component - remove dependency on php boards #20

Closed blurymind closed 3 years ago

blurymind commented 3 years ago

I am wondering if there is perhaps a way to untangle the painting app from the php board stuff, and use it flexibly like an npm module, which can be inlcuded in a react component for example.

Do you think such a task is too big to do or perhaps already possible?

new ChickenPaint({
    uiElem: document.getElementById("chickenpaint-parent"),
    saveUrl: "save.php",
    postUrl: "complete.php",
    exitUrl: "index.php",
    resourcesRoot: "chickenpaint/"
});

do these need to be php? Cant we not rely on urls and instead just download the image or get its blob instead?

When one runs npm run build, where is the dist folder with the minified js? It seems to no longer create a dist folder after building.

Is there any reason chickenpaint is not registered on npm?

thenickdude commented 3 years ago

There's no impediment to registering Chickenpaint on npm, I'll do that.

Those URLs can be anything, or removed completely, they don't have to be PHP.

Build files are written to resources/js.

thenickdude commented 3 years ago

chickenpaint has now been published on npm:

https://www.npmjs.com/package/chickenpaint

thenickdude commented 3 years ago

Bumped version to 0.1.1 because the build scripts weren't including the right files

blurymind commented 3 years ago

While you have added it to npm, its api is kind of unfriendly for usage in other projects - it would be nice to have a method exposed for saving and loading the data, without having to hackily override classes.