Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unhappychoice/cycle-cropper
:recycle: Cycle.js component for https://github.com/fengyuanchen/cropperjs
https://github.com/unhappychoice/cycle-cropper
cropper cropperjs cycle-cropper cyclejs image typescript
Last synced: 23 days ago
JSON representation
:recycle: Cycle.js component for https://github.com/fengyuanchen/cropperjs
- Host: GitHub
- URL: https://github.com/unhappychoice/cycle-cropper
- Owner: unhappychoice
- License: mit
- Created: 2017-11-24T17:03:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-09T08:05:35.000Z (28 days ago)
- Last Synced: 2024-10-11T13:37:53.763Z (26 days ago)
- Topics: cropper, cropperjs, cycle-cropper, cyclejs, image, typescript
- Language: TypeScript
- Homepage:
- Size: 287 KB
- Stars: 6
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# cycle-cropper
[![npm version](https://badge.fury.io/js/cycle-cropper.svg)](https://badge.fury.io/js/cycle-cropper)
[![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/unhappychoice/cycle-cropper.svg)](https://libraries.io/github/unhappychoice/cycle-cropper)
![npm bundle size](https://img.shields.io/bundlephobia/min/cycle-cropper.svg)
![npm](https://img.shields.io/npm/dt/cycle-cropper.svg)
![GitHub](https://img.shields.io/github/license/unhappychoice/cycle-cropper.svg)cycle-cropper is component for [cropper.js](https://github.com/fengyuanchen/cropperjs)
### Usage
```typescript
import {CropperComponent} from "cycle-cropper";const main = (sources: Sources): Sinks => {
const imageInput$ = sources.DOM.select(".image");const cropperSinks = CropperComponent({
DOM: sources.DOM,
image$: imageInput$,
props$: Stream.of({ aspectRatio: 1 }) // cropper options
});const imageData$ = cropperSinks.crop$
.compose(sampleCombine(cropperSinks.cropper$))
.map(([_, cropper]) => cropper.getCroppedCanvas().toDataURL())const dom$ = Stream.of([p("Image Cropper")].concat(cropperSinks.DOM));
return { DOM: dom$ };
};run(main, {
DOM: makeDOMDriver("#app")
});```
### License
see [LICENSE](./LICENSE)