Skip to content

Commit

Permalink
Updated readme and license 💳
Browse files Browse the repository at this point in the history
  • Loading branch information
actuallyakash committed Jun 3, 2021
1 parent 7938f37 commit cce9f98
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 26 deletions.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2013-2016

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.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
enableLock: true,
lockIcon: '🔒',
unlockIcon: '🔓',
onDragEnd: function( data) {
onDragEnd: function( data ) {
console.log(data);
}
});
Expand Down
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "spacersjs",
"version": "1.0.0",
"description": "when you need more space",
"main": "spacers/spacers.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/actuallyakash/spacers.git"
},
"keywords": [
"spacers",
"margin",
"padding",
"dragging"
],
"author": "actuallyakash",
"license": "MIT",
"bugs": {
"url": "https://github.com/actuallyakash/spacers/issues"
},
"homepage": "https://github.com/actuallyakash/spacers#readme"
}
85 changes: 61 additions & 24 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,61 @@
## TODO: options needed


## Done

* element (selector on which the spacer is implemented) | type: string
* appendHtml (to append spacer divs ) | type: string | values: (begin, end) | ref: https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML#visualization_of_position_names | default: afterbegin
* padding (to enable padding, which'll be default behaviour) | type: boolean
* margin (to enable margin) | type: boolean
* onDragEnd (a function for using the values when drag is ended) | type: function | ref: interactjs
* containedArea (use if you're not able to find the element (ex- iframe)) | type: object
* spacerClass (for adding classes in the spacers) | type: string
* defaultSpacing (default margin/padding values) | type: string
* defaultPadding (an object with top, bottom, left, right values) | type: object
* defaultMargin (an object with top, bottom, left, right values) | type: object
* spacingUnit (to change default spacing unit of spacers like em, rem, in, cm ..etc) | type: string
* showOnHover (to show spacers only on hover) | type: boolean
* showSpacingValue (to show the margin/padding number in the center of spacer) | type: boolean
* showLabel: (to show the label beside spacing value) | type: string
* enableLock: (to link opposite spacers) | type: boolean
* lockIcon
default - <span class="lock"></span>
* unlockIcon
default - <span class="unlock"></span>
spacers
-------

[1]: <https://github.com/actuallyakash/spacers>

_when you need more space_

#### Demo

[http://actuallyakash.github.io/spacers](http://actuallyakash.github.io/spacers/)

#### Package Managers

```sh
# Bower
bower install --save spacersjs

# NPM
npm install spacersjs
```

### Settings

**Option**|**Type**|**Default**|**Description**
-----|-----|-----|-----
element|string|null|Selector on which the spacer have to be initialized
appendHtml|string|begin|To append spacer divs after or before the tag. Use `begin` to append in the beginning and `end` to append after the selector.
padding|boolean|true|To enable padding, which is default behaviour
margin|boolean|false|To enable margin
onDragEnd|boolean|null|Function for using the spacer values when drag is ended
containedArea|object (DOM node | jQuery object)|window.document|Use if you're not able to find the element (ex- when using iframe)
spacerClass|object|null|For adding custom classes in the spacers
defaultSpacing|string|null|Default margin/padding values
defaultPadding|object|null|an object with top, bottom, left, right values
defaultMargin|object|null|an object with top, bottom, left, right values
spacingUnit|object|px|Change default spacing unit of spacers like em, rem, in, cm ..etc
showOnHover|string|false|Show spacers only on hover
showSpacingValue|boolean|false|Show the margin/padding values at the center of spacer
showLabel|string|null|Show the label beside spacing value
enableLock|boolean|false|Link opposite spacers
lockIcon|string|<span class="lock"></span>|HTML string for lock icon
unlockIcon|string|<span class="unlock"></span>|HTML string for unlock icon

#### Example

Initialize with:

```javascript
spacers({
element: '.inner-element'
});
```

#### Dependencies

Voila! It works without any dependencies.

#### License

Copyright (c) 2021 Akash Gupta
Licensed under the MIT license.
1 change: 1 addition & 0 deletions spacers/spacers.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
--padding-bg: plum;
--margin-bg: #463626;
}

/* Spacers Styling */
.spacer {
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion spacers/spacers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function spacers( options ) {
enablePadding ? spacingProperties.push( 'padding' ) : '';
let spacingDimensions = [ 'top', 'right', 'bottom', 'left' ];
let showSpacingValue = options.showSpacingValue == undefined || options.showSpacingValue == true ? true : false;
let showLabel = options.showLabel ? options.showLabel : false;
let showLabel = options.showLabel ? options.showLabel : '';

margin = {
top: options.defaultMargin ? options.defaultMargin.top : '',
Expand Down

0 comments on commit cce9f98

Please sign in to comment.