Skip to content

Commit

Permalink
Merge pull request #210 from Mawi137/new-project-structure
Browse files Browse the repository at this point in the history
New project structure
  • Loading branch information
Mawi137 authored Sep 26, 2019
2 parents 4fbfe0d + 52ec52c commit 6198c89
Show file tree
Hide file tree
Showing 45 changed files with 6,451 additions and 408 deletions.
55 changes: 46 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
$ cat .gitignore
node_modules/
dist/
documentation/
.ng_build/

*.log
*.tgz
.idea/
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
4 changes: 2 additions & 2 deletions license.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Martijn Willekens
Copyright (c) 2019 Martijn Willekens

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ 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.
SOFTWARE.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ That event is then passed to the image cropper through `imageChangedEvent` which
Everytime you release the mouse, the `imageCropped` event will be triggerd with the cropped image as a Base64 string in its payload.

## API
All inputs are optional. Either the `imageChangedEvent` or `imageBase64` should be set to load an image into the cropper.
All inputs are optional. Either the `imageChangedEvent`, `imageBase64` or `imageFile` should be set to load an image into the cropper.
### Inputs
| Name | Type | Default | Description |
| -------------------------- |---------- | ------------ | --------------- |
| `imageChangedEvent` | FileEvent | | The change event from your file input (set to `null` to reset the cropper) |
| `imageFileChanged` | Blob(File)| | The file you want to change (set to `null` to reset the cropper) |
| `imageFile` | Blob(File)| | The file you want to change (set to `null` to reset the cropper) |
| `imageBase64` | string | | If you don't want to use a file input, you can set a base64 image directly and it will be loaded into the cropper |
| `format` | string | png | Output format (png, jpeg, webp, bmp, ico) (not all browsers support all types, png is always supported, others are optional) |
| `outputType` | string | both | Output type ('base64', 'file' or 'both'). Converting the image to a Blob can be quite a heavy operation. With this option, you could choose to only get the base64 which will improve the speed of cropping significantly |
| `outputType` | string | base64 | Output type ('base64', 'file' or 'both'). Converting the image to a Blob can be quite a heavy operation. With this option, you could choose to only get the base64 which will improve the speed of cropping significantly |
| `aspectRatio` | number | 1 / 1 | The width / height ratio (e.g. 1 / 1 for a square, 4 / 3, 16 / 9 ...) |
| `maintainAspectRatio` | boolean | true | Keep width and height of cropped image equal according to the aspectRatio |
| `containWithinAspectRatio` | boolean | false | When set to true, padding will be added around the image to make it fit to the aspect ratio |
Expand All @@ -108,8 +108,6 @@ All inputs are optional. Either the `imageChangedEvent` or `imageBase64` should
| Name | Type | Description |
| ----------------------- | ----------------- | ----------- |
| `imageCropped` | ImageCroppedEvent | Emits an ImageCroppedEvent each time the image is cropped |
| **(DEPRECATED)** `imageCroppedBase64` | string | Emits a Base64 string of the cropped image each time it is cropped |
| **(DEPRECATED)** `imageCroppedFile` | File | Emits the cropped image as a file each time it is cropped |
| `imageLoaded` | void | Emits when the image was loaded into the cropper |
| `cropperReady` | void | Emits when the cropper is ready to be interacted |
| `startCropImage` | void | Emits when the component started cropping the image |
Expand Down
149 changes: 149 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ngx-image-cropper": {
"projectType": "library",
"root": "projects/ngx-image-cropper",
"sourceRoot": "projects/ngx-image-cropper/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/ngx-image-cropper/tsconfig.lib.json",
"project": "projects/ngx-image-cropper/ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ngx-image-cropper/src/test.ts",
"tsConfig": "projects/ngx-image-cropper/tsconfig.spec.json",
"karmaConfig": "projects/ngx-image-cropper/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/ngx-image-cropper/tsconfig.lib.json",
"projects/ngx-image-cropper/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"demo-app": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"root": "projects/demo-app",
"sourceRoot": "projects/demo-app/src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/demo-app",
"index": "projects/demo-app/src/index.html",
"main": "projects/demo-app/src/main.ts",
"polyfills": "projects/demo-app/src/polyfills.ts",
"tsConfig": "projects/demo-app/tsconfig.app.json",
"aot": false,
"assets": [
"projects/demo-app/src/favicon.ico",
"projects/demo-app/src/assets"
],
"styles": [
"projects/demo-app/src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "projects/demo-app/src/environments/environment.ts",
"with": "projects/demo-app/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "demo-app:build"
},
"configurations": {
"production": {
"browserTarget": "demo-app:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "demo-app:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": "projects/demo-app/src/polyfills.ts",
"tsConfig": "projects/demo-app/tsconfig.spec.json",
"assets": [
"projects/demo-app/src/favicon.ico",
"projects/demo-app/src/assets"
],
"styles": [
"projects/demo-app/src/styles.scss"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/demo-app/tsconfig.app.json",
"projects/demo-app/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}},
"defaultProject": "demo-app"
}
3 changes: 0 additions & 3 deletions index.ts

This file was deleted.

97 changes: 0 additions & 97 deletions karma.conf.js

This file was deleted.

6 changes: 0 additions & 6 deletions ng-package.json

This file was deleted.

Loading

0 comments on commit 6198c89

Please sign in to comment.