Skip to content

Commit

Permalink
1.0.5
Browse files Browse the repository at this point in the history
* Updated documentation

* Updated ease function

* Fixed breakpoint function null check bug

* Added line-clamp mixin

* Optimized DOM state methods

* Improved state module

* Implemented addDelegatedEventListener

* Added and updated mixins

* Removed default values column from config variables table in readme

* Updated version to 1.0.5
  • Loading branch information
André Ekeberg authored and björn committed Nov 1, 2019
1 parent 2bd1c1a commit b86d463
Show file tree
Hide file tree
Showing 11 changed files with 436 additions and 586 deletions.
22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.0.5] - 2019-11-01
### Added
- SCSS: Added viewport mixin
- SCSS: Added line-clamp mixin
- SCSS: Added visually-hidden mixin
- JS: Added addDelegatedEventListener method

### Changed
- SCSS: Updated scroll mixin to support a global config variable
- JS: Optimized state DOM methods

### Removed
- SCSS: Removed stagger-delay mixin
- JS: Removed timing.Interval

## [1.0.4] - 2019-08-01
### Changed
- SCSS: Fixed type checking in breakpoint function
Expand All @@ -13,18 +28,19 @@ All notable changes to this project will be documented in this file.

### Changed
- SCSS: Fixed bug where inline-layout did not pass along $align to inline-column
- SCSS: Switch third argument in the state mixin from $global to $local
- SCSS: Switched third argument in the state mixin from $global to $local

## [1.0.2] - 2019-04-29

### Removed
- JS: Remove references to not yet implemeted methods in state
- JS: Removed references to not yet implemeted methods in state

## [1.0.1] - 2019-04-29

### Removed
- JS: Remove references to not yet implemeted methods in state
- JS: Removed references to not yet implemeted methods in state

[1.0.5]: https://github.com/pocketsize/bolts-lib/releases/tag/1.0.5
[1.0.4]: https://github.com/pocketsize/bolts-lib/releases/tag/1.0.4
[1.0.3]: https://github.com/pocketsize/bolts-lib/releases/tag/1.0.3
[1.0.2]: https://github.com/pocketsize/bolts-lib/releases/tag/1.0.2
Expand Down
523 changes: 202 additions & 321 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bolts-lib",
"version": "1.0.4",
"version": "1.0.5",
"description": "Front-end helper library",
"main": "src/js/index.js",
"author": "Pocketsize <[email protected]> (https://www.pocketsize.se)",
Expand Down
6 changes: 3 additions & 3 deletions src/js/bolts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Bolts 1.0.4 | MIT License
* Bolts 1.0.5 | MIT License
*
* Developed by Pocketsize
* http://www.pocketsize.se/
Expand All @@ -19,11 +19,11 @@ function init(config = {}) {

config = Object.assign({}, defaults, config)

state.getDOMState()

detect.hoverCapability(config.detectHoverThreshold)
detect.imageOrientation()
detect.resizeEvents()

state.getDOMState()
}

export default bolts
2 changes: 1 addition & 1 deletion src/js/detect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Bolts 1.0.4 | MIT License
* Bolts 1.0.5 | MIT License
*
* Developed by Pocketsize
* http://www.pocketsize.se/
Expand Down
39 changes: 39 additions & 0 deletions src/js/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const matches = function(el, selector) {
var p = Element.prototype

var f = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || function (s) {
return [].indexOf.call(document.querySelectorAll(s), this) !== -1
}

return f.call(el, selector)
}

const delegatedEventListeners = {}

const addDelegatedEventListener = function (type, selector, callback) {
if (!delegatedEventListeners[type]) {
const listeners = (delegatedEventListeners[type] = [])

document.addEventListener(type, function (event) {
for (
let element = event.target;
element && element.parentNode;
element = element.parentNode
) {
for (const { selector, callback } of listeners) {
if (matches(element, selector)) {
callback.call(element, event)
}
}

if (event.cancelBubble) {
break
}
}
})
}

delegatedEventListeners[type].push({ selector, callback })
}

export { addDelegatedEventListener }
3 changes: 2 additions & 1 deletion src/js/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Bolts 1.0.4 | MIT License
* Bolts 1.0.5 | MIT License
*
* Developed by Pocketsize
* http://www.pocketsize.se/
Expand All @@ -10,6 +10,7 @@ export { default as state } from './state'
export { default as detect } from './detect'
export { default as timing } from './timing'
export { default as misc } from './misc'
export { addDelegatedEventListener } from './events'

export { bolts as bolts }
export default bolts
2 changes: 1 addition & 1 deletion src/js/misc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Bolts 1.0.4 | MIT License
* Bolts 1.0.5 | MIT License
*
* Developed by Pocketsize
* http://www.pocketsize.se/
Expand Down
Loading

0 comments on commit b86d463

Please sign in to comment.