Skip to content

Commit

Permalink
0.3.0.
Browse files Browse the repository at this point in the history
0.3.0.
  • Loading branch information
b4rtaz authored Jan 14, 2024
2 parents b86f1e4 + fd37baa commit 8a225ce
Show file tree
Hide file tree
Showing 91 changed files with 6,616 additions and 182 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.0

This version changed the license to MIT.

## 0.2.0

This version improves support for UMD bundles.
Expand Down
68 changes: 5 additions & 63 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,67 +1,9 @@
# Commercial license
The MIT License (MIT)

Commercial license for Mini Canvas Editor
Copyright (c) 2024 N4NO.com

Copyright (C) 2023 N4NO.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

This Software License AGREEMENT is between N4NO.com and YOU (including your agents and affiliates).
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

1. DEFINITIONS

1.1. SOFTWARE means Mini Canvas Editor by N4NO.com

1.2. MODIFICATION means any change, revision, adaptation, or derivative of SOFTWARE produced by YOU.

1.3. LICENSED DEVELOPER shall mean an individual person permitted to use SOFTWARE and make MODIFICATIONS for APPLICATIONS, whether such person is YOUR employee or a consultant or contractor providing services to YOU.

1.4. END USER means end user of APPLICATION, who acquires a license to such solely for their own use and not for distribution, resale, user interface design, or software development purposes.

1.5. APPLICATION means application, or elements that LICENSED DEVELOPER develop using SOFTWARE or MODIFICATION in accordance with AGREEMENT.

2. LICENSES

2.1. HOBBY LICENSE

2.1.1. HOBBY LICENSE grants you a right to use SOFTWARE to create one (1) APPLICATION.

2.1.2. HOBBY LICENSE grants permission for one (1) LICENSED DEVELOPER to access and use SOFTWARE.

2.2. TEAM LICENSE

2.2.1. TEAM LICENSE grants you a right to use SOFTWARE to create two (2) APPLICATIONS.

2.2.2. TEAM LICENSE grants permission for four (4) LICENSED DEVELOPERS to access and use SOFTWARE.

2.3. ENTERPRISE LICENSE

2.3.1. ENTERPRISE LICENSE grants you a right to use SOFTWARE to create unlimited APPLICATIONS.

2.3.2. ENTERPRISE LICENSE grants permission for unlimited LICENSED DEVELOPERS to access and use SOFTWARE.

3. GRANT OF LICENSE

3.1. This is a license agreement and not an agreement for sale.

3.2. N4NO.com grants to YOU a revocable, non-exclusive, non-transferable license: (i) for use of SOFTWARE by the number of LICENSED DEVELOPERS and for the number of MODIFICATIONS and APPLICATIONS as dictated by your purchased license; (ii) for YOU to distribute SOFTWARE and/or MODIFICATIONS to an unlimited number of END USERS solely as integrated into APPLICATIONS; and (iii) for END USERS to use SOFTWARE as incorporated into your APPLICATIONS in accordance with the terms of AGREEMENT.

4. RECEIVE UPDATES

4.1. YOU will be eligible to receive all major and minor updates for SOFTWARE with no limitation period.

5. RENTAL

5.1. You may not rent, lease, or lend SOFTWARE.

6. TRANSFER

6.1. You may not permanently or temporarily transfer any of your rights under AGREEMENT to any individual or business or government entity without prior written approval from N4NO.com.

7. WARRANTY

7.1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

8. TERMINATION AND REFUNDS

8.1. Without prejudice to any other rights or remedies, N4NO.com will terminate AGREEMENT upon your failure to comply with all the terms and conditions of AGREEMENT. In such events, YOU must destroy all copies of SOFTWARE and all of its component parts including any related documentation and must remove any and all use of N4NO.com intellectual property from any applications distributed by YOU, whether in native, altered or compiled states.

8.2. YOU has an unconditional right to terminate before the first fourteen (14) days of purchase of SOFTWARE and shall be entitled to a full refund.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 changes: 5 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Mini Canvas Editor

[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fsummer-heart-0930.chufeiyun1688.workers.dev%3A443%2Fhttps%2Factions-badge.atrox.dev%2Fimg-js%2Fmini-canvas-editor%2Fbadge%3Fref%3Dmain&style=flat-square)](https://actions-badge.atrox.dev/img-js/mini-canvas-editor/goto?ref=main) [![View this project on NPM](https://img.shields.io/npm/v/mini-canvas-editor.svg?style=flat-square)](https://npmjs.org/package/mini-canvas-editor)
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fsummer-heart-0930.chufeiyun1688.workers.dev%3A443%2Fhttps%2Factions-badge.atrox.dev%2Fimg-js%2Fmini-canvas-editor%2Fbadge%3Fref%3Dmain&style=flat-square)](https://actions-badge.atrox.dev/img-js/mini-canvas-editor/goto?ref=main) [![License: MIT](https://img.shields.io/badge/license-MIT-green?style=flat-square)](/LICENSE) [![View this project on NPM](https://img.shields.io/npm/v/mini-canvas-editor.svg?style=flat-square)](https://npmjs.org/package/mini-canvas-editor)

Canvas editor component for JavaScript application. Works with any front-end framework. Easy to integrate and use. Well-known graphical interface. Edit images, draw shapes, add texts and more. Gzipped size less than 100 KB. Uses Fabric.js internally.

Expand Down Expand Up @@ -55,9 +55,9 @@ Add the below code to your head section in HTML document.
```html
<head>
...
<link href="https://cdn.jsdelivr.net/npm/mini-canvas-editor@0.2.0/css/editor.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/mini-canvas-core@0.2.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mini-canvas-editor@0.2.0/dist/index.umd.js"></script>
<link href="https://cdn.jsdelivr.net/npm/mini-canvas-editor@0.3.0/css/editor.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/mini-canvas-core@0.3.0/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mini-canvas-editor@0.3.0/dist/index.umd.js"></script>
```

Create the editor by:
Expand All @@ -68,14 +68,4 @@ miniCanvasEditor.Editor.createBlank(placeholder, 200, 300, {});

## 💡 License

Pick one license that fits your needs.

| License | Details | |
| ---------------- | - | - |
| 🍪 Hobby | **1** application<br />**1** developer<br />1 year updates | [📦 Buy license](https://buy.stripe.com/14k8yq3p048L7fO4gj) |
| 🍰 Standard | **2** applications<br />**up to 4** developers<br />1 year updates | |
| 🎂 Enterprise | **unlimited** applications<br />**unlimited** developers<br />1 year updates | |

The license is perpetual. By buying the license you get an access to the source code of the editor.

See the [LICENSE](/LICENSE) file for more details.
This project is released under the MIT license.
1 change: 1 addition & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib/
9 changes: 9 additions & 0 deletions core/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2024 N4NO.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7 changes: 7 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Mini Canvas

This package contains the core features for [Mini Canvas Editor](https://github.com/img-js/mini-canvas-editor).

## 💡 License

See the [LICENSE](/LICENSE) file for more details.
98 changes: 98 additions & 0 deletions core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"name": "mini-canvas-core",
"description": "Core library for Mini Canvas Editor.",
"version": "0.3.0",
"license": "SEE LICENSE IN LICENSE",
"type": "module",
"main": "./lib/cjs/index.browser.cjs",
"types": "./lib/index.browser.d.ts",
"exports": {
".": {
"types": {
"require": "./lib/index.browser.d.ts",
"default": "./lib/index.browser.d.ts"
},
"default": {
"require": "./lib/cjs/index.browser.cjs",
"default": "./lib/esm/index.browser.js"
}
},
"./node": {
"types": {
"require": "./lib/index.node.d.ts",
"default": "./lib/index.node.d.ts"
},
"default": {
"require": "./lib/cjs/index.node.cjs",
"default": "./lib/esm/index.node.js"
}
}
},
"typesVersions": {
"*": {
".": [
"./lib/index.browser.d.ts"
],
"node": [
"./lib/index.node.d.ts"
]
}
},
"sideEffects": false,
"files": [
"lib/",
"dist/"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "https://github.com/b4rtaz/mini-canvas-editor.git"
},
"author": {
"name": "N4NO",
"url": "https://n4no.com/"
},
"homepage": "https://n4no.com/",
"scripts": {
"prepare": "cp ../LICENSE LICENSE",
"clean": "rm -rf lib && rm -rf node_modules/.cache/rollup-plugin-typescript2",
"build": "pnpm clean && rollup -c",
"start": "pnpm clean && rollup -c --watch",
"eslint": "eslint ./src --ext .ts",
"prettier": "prettier --check ./src",
"prettier:fix": "prettier --write ./src"
},
"dependencies": {
"fabric": "6.0.0-beta14"
},
"devDependencies": {
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"rollup": "^4.1.4",
"rollup-plugin-dts": "^6.1.0",
"rollup-plugin-typescript2": "^0.36.0",
"@rollup/plugin-node-resolve": "^15.2.2",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-replace": "^5.0.4",
"prettier": "^3.0.3",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.51.0"
},
"keywords": [
"canvas",
"editor",
"image",
"image editor",
"photo editor",
"photo",
"javascript image editor",
"paint",
"js paint",
"image crop",
"image resize",
"inpainting"
]
}
76 changes: 76 additions & 0 deletions core/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import dts from 'rollup-plugin-dts';
import typescript from 'rollup-plugin-typescript2';
import replace from '@rollup/plugin-replace';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import fs from 'fs';

const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
const external = Object.keys(packageJson.dependencies);

const ts = typescript({
useTsconfigDeclarationDir: true
});

function bundle(fileName, node) {
return [
{
input: './src/index.ts',
plugins: [
node ? replace({
preventAssignment: true,
delimiters: ['', ''],
values: {
'\'fabric\'': '\'fabric/node\'',
}
}) : false,
ts,
terser()
],
cache: false,
external,
output: [
{
file: `./lib/cjs/${fileName}.cjs`,
format: 'cjs'
},
{
file: `./lib/esm/${fileName}.js`,
format: 'es'
}
]
},
{
input: `./build/index.d.ts`,
output: [
{
file: `./lib/${fileName}.d.ts`,
format: 'es'
}
],
plugins: [dts()],
}
];
}

export default [
...bundle('index.browser', false),
...bundle('index.node', true),
{
input: './src/index.ts',
plugins: [
nodeResolve({
browser: true,
}),
ts,
terser()
],
output: [
{
file: './dist/index.umd.js',
format: 'umd',
name: 'miniCanvasCore'
}
]
}
];
12 changes: 12 additions & 0 deletions core/src/canvas-grid.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export function createCanvasGrid(): HTMLCanvasElement {
const canvas = document.createElement('canvas');
canvas.width = 10;
canvas.height = 10;
const context = canvas.getContext('2d')!;
context.fillStyle = '#ffffff';
context.fillRect(0, 0, 10, 10);
context.fillStyle = '#f0f0f0';
context.fillRect(0, 0, 5, 5);
context.fillRect(5, 5, 5, 5);
return canvas;
}
7 changes: 7 additions & 0 deletions core/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export * from 'fabric';
export * from './replacer';
export * from './shapes';
export * from './mce-canvas';
export * from './mce-image-json';
export * from './mce-layer';
export * from './mce-static-canvas';
28 changes: 28 additions & 0 deletions core/src/mce-canvas-common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { StaticCanvas } from 'fabric';
import { MceRect } from './shapes';
import { MceLayer } from './mce-layer';

export class MceCanvasCommon {
public constructor(private readonly canvas: StaticCanvas & { workspaceBackground: MceRect }) {}

public readonly getWorkspaceObjects = () => {
return this.canvas.getObjects().filter(object => object !== this.canvas.workspaceBackground);
};

public readonly getLayers = (): MceLayer[] => {
const objects = this.canvas.getObjects();
const layers: MceLayer[] = [];
for (let i = 0; i < objects.length; i++) {
const object = objects[i];
if (object !== this.canvas.workspaceBackground) {
layers.push({
index: layers.length,
realIndex: i,
name: object.get('label') ?? object.type,
type: object.type
});
}
}
return layers;
};
}
Loading

0 comments on commit 8a225ce

Please sign in to comment.