-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Luna Painter | ||
|
||
Simple drawing tool. | ||
|
||
## Demo | ||
|
||
https://luna.liriliri.io/?path=/story/painter | ||
|
||
## Install | ||
|
||
Add the following script and style to your page. | ||
|
||
```html | ||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-painter/luna-painter.css" /> | ||
<script src="//cdn.jsdelivr.net/npm/luna-painter/luna-painter.js"></script> | ||
``` | ||
|
||
You can also get it on npm. | ||
|
||
```bash | ||
npm install luna-painter --save | ||
``` | ||
|
||
```javascript | ||
import 'luna-painter/luna-painter.css' | ||
import LunaPainter from 'luna-painter' | ||
``` | ||
|
||
## Usage | ||
|
||
```javascript | ||
const container = document.getElementById('container') | ||
const painer = new LunaPainter(container) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Component, { IComponentOptions } from '../share/Component' | ||
|
||
export interface IOptions extends IComponentOptions { | ||
width?: number | ||
height?: number | ||
} | ||
|
||
/** | ||
* Simple drawing tool. | ||
* | ||
* @example | ||
* const container = document.getElementById('container') | ||
* const painer = new LunaPainter(container) | ||
*/ | ||
export default class Painter extends Component<IOptions> { | ||
constructor(container: HTMLElement, options: IOptions) { | ||
super(container, { compName: 'painer' }, options) | ||
|
||
this.initOptions(options, {}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "painter", | ||
"version": "0.1.0", | ||
"description": "Simple drawing tool" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'luna-painter' | ||
import Painter from 'luna-painter.js' | ||
import story from '../share/story' | ||
import readme from './README.md' | ||
|
||
const def = story( | ||
'painter', | ||
(container) => { | ||
const painter = new Painter(container) | ||
|
||
return painter | ||
}, | ||
{ | ||
readme, | ||
source: __STORY__, | ||
} | ||
) | ||
|
||
export default def | ||
|
||
export const { painter } = def |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters