@nuwatop/code-canvas-core
v0.1.0
Published
Core components and utilities for code-canvas visualization editor
Maintainers
Readme
@nuwatop/code-canvas-core
Core components and utilities for code-canvas visualization editor.
Installation
npm install @nuwatop/code-canvas-coreUsage
Configuration
Before using the core package, you need to configure the request and upload handlers:
import { setCoreConfig } from '@nuwatop/code-canvas-core';
setCoreConfig({
request: async (config) => {
// Your request implementation
return await fetch(config.baseURL, {
method: 'GET',
headers: config.headers
});
},
upload: async (file, config) => {
// Your upload implementation
const formData = new FormData();
formData.append('file', file);
return await fetch(config?.url || '/upload', {
method: 'POST',
body: formData,
headers: config?.headers
});
}
});Components
All And-* components are available for import:
import { AndButton, AndInput, AndText } from '@nuwatop/code-canvas-core';Runtime
Initialize the runtime module:
import { initRuntime } from '@nuwatop/code-canvas-core/runtime';
initRuntime({
utils: yourUtils,
moduleLoader: async (moduleName) => {
// Load your module
return await import(`./modules/${moduleName}`);
}
});License
MIT
