Skip to content

Commit 4af7057

Browse files
authored
Update dependencies (#108)
1 parent a3d5da7 commit 4af7057

File tree

10 files changed

+370
-1125
lines changed

10 files changed

+370
-1125
lines changed

.babelrc

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
{
22
"presets": ["@babel/env"],
3-
"plugins": [
4-
["@babel/plugin-proposal-decorators", { "legacy": true }],
5-
"@babel/plugin-proposal-function-sent",
6-
"@babel/plugin-proposal-export-namespace-from",
7-
"@babel/plugin-proposal-numeric-separator",
8-
"@babel/plugin-proposal-throw-expressions",
9-
"@babel/plugin-syntax-dynamic-import",
10-
"@babel/plugin-syntax-import-meta",
11-
["@babel/plugin-proposal-class-properties", { "loose": false }],
12-
"@babel/plugin-proposal-json-strings",
13-
"@babel/plugin-transform-modules-umd"
14-
]
3+
"plugins": ["@babel/plugin-transform-modules-umd"]
154
}

.github/workflows/build.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,24 @@
44
name: Build
55

66
on:
7-
push:
8-
branches: [ master ]
9-
pull_request:
10-
branches: [ master ]
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
1111

1212
jobs:
13-
build:
13+
build:
14+
runs-on: ubuntu-latest
1415

15-
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [12.x, 14.x, 16.x]
1619

17-
strategy:
18-
matrix:
19-
node-version: [10.x, 12.x, 14.x]
20-
21-
steps:
22-
- uses: actions/checkout@v2
23-
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v2
25-
with:
26-
node-version: ${{ matrix.node-version }}
27-
- run: yarn
28-
- run: yarn build
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v2
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- run: yarn
27+
- run: yarn build

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ yarn.lock
3636

3737
# Config
3838
.babelrc
39+
.github
40+
.whitesource
3941
renovate.json
4042
webpack.config.js

.whitesource

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"issueSettings": {
66
"minSeverityLevel": "LOW"
77
}
8-
}
8+
}

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,54 +78,54 @@ See functions list below:
7878
const button = $('#button');
7979
```
8080

81-
-----
81+
---
8282

8383
`$$` - queries the DOM and obtains a collection of elements
8484

8585
```javascript
8686
const buttons = $$('#button');
8787
```
8888

89-
-----
89+
---
9090

9191
`enableListeners` - enables the custom `on` method for attaching of event listeners
9292

9393
```javascript
9494
enableListeners();
9595

9696
button.on('click', () => {
97-
console.log('clicked a single button');
97+
console.log('clicked a single button');
9898
});
9999

100100
buttons.on('click', () => {
101-
console.log('clicked a button in a collection');
101+
console.log('clicked a button in a collection');
102102
});
103103
```
104104

105-
-----
105+
---
106106

107107
`isElementVisibleInViewport` - accepts two arguments: DOM element and a boolean flag which states if the element should be partially visible. Returns boolean.
108108

109-
``` javascript
109+
```javascript
110110
const element = document.getElementById('element');
111111
const isVisible = isElementVisibleInViewport(element, true);
112112
```
113113

114-
-----
114+
---
115115

116-
- `getScrollPosition` - returns the scroll position of the passed DOM Element
116+
- `getScrollPosition` - returns the scroll position of the passed DOM Element
117117

118118
```javascript
119119
const element = document.getElementById('element');
120120
const scrollPosition = getScrollPosition(element);
121121
```
122122

123-
-----
123+
---
124124

125-
- `hasClass` - Returns boolean true if the element has the specified class, false otherwise.
126-
- `addClass` - Adds the specified class to an element
127-
- `removeClass` - Removes the specified class from an element
128-
- `toggleClass` - Toggles the specified class on an element
125+
- `hasClass` - Returns boolean true if the element has the specified class, false otherwise.
126+
- `addClass` - Adds the specified class to an element
127+
- `removeClass` - Removes the specified class from an element
128+
- `toggleClass` - Toggles the specified class on an element
129129

130130
```javascript
131131
const element = document.getElementById('element');
@@ -140,13 +140,13 @@ removeClass(element, 'test');
140140
* if false it will be removed.
141141
* If omitted, the classname will be toggled
142142
*/
143-
toggleClass(element, 'test', true)
143+
toggleClass(element, 'test', true);
144144
```
145145

146-
-----
146+
---
147147

148-
- `insertAfter` - Insert the supplied HTML String after the element
149-
- `insertBefore` - Insert the supplied HTML String before the element
148+
- `insertAfter` - Insert the supplied HTML String after the element
149+
- `insertBefore` - Insert the supplied HTML String before the element
150150

151151
```javascript
152152
const element = document.getElementById('element');
@@ -155,15 +155,15 @@ insertAfter(element, '<div>Test</div>');
155155
insertBefore(element, '<div>Test</div>');
156156
```
157157

158-
-----
158+
---
159159

160-
- `trigger` - Fires a custom (or built-in) event
160+
- `trigger` - Fires a custom (or built-in) event
161161

162162
```javascript
163163
const element = document.getElementById('element');
164164

165165
// The third argument is event data. Can be omitted
166-
trigger(element, 'click', { data: true })
166+
trigger(element, 'click', { data: true });
167167
```
168168

169169
## License

dist/dom-helpers.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
factory(mod.exports);
1111
global.domHelpers = mod.exports;
1212
}
13-
})(this, function (_exports) {
13+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
1414
"use strict";
1515

1616
Object.defineProperty(_exports, "__esModule", {
@@ -20,13 +20,17 @@
2020

2121
var _this = void 0;
2222

23-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
23+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2424

25-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
25+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2626

27-
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
27+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
2828

29-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
29+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
30+
31+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
32+
33+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3034

3135
var D = document;
3236
/**

dist/dom-helpers.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@three11/dom-helpers",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Helper functions for faster DOM scripting",
55
"main": "dist/dom-helpers.js",
66
"scripts": {
@@ -43,17 +43,8 @@
4343
"devDependencies": {
4444
"@babel/cli": "7.14.3",
4545
"@babel/core": "7.14.3",
46-
"@babel/plugin-proposal-class-properties": "7.13.0",
47-
"@babel/plugin-proposal-decorators": "7.14.2",
48-
"@babel/plugin-proposal-export-namespace-from": "7.14.2",
49-
"@babel/plugin-proposal-function-sent": "7.12.13",
50-
"@babel/plugin-proposal-json-strings": "7.14.2",
51-
"@babel/plugin-proposal-numeric-separator": "7.14.2",
52-
"@babel/plugin-proposal-throw-expressions": "7.12.13",
53-
"@babel/plugin-syntax-dynamic-import": "7.8.3",
54-
"@babel/plugin-syntax-import-meta": "7.10.4",
46+
"@babel/plugin-transform-modules-umd": "7.14.0",
5547
"@babel/preset-env": "7.14.2",
56-
"babel-loader": "8.2.2",
5748
"babel-minify": "0.5.1"
5849
}
5950
}

src/dom-helpers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export const isElementVisibleInViewport = (el, isPartiallyVisible = false) => {
5252
const { innerWidth, innerHeight } = window;
5353

5454
return isPartiallyVisible
55-
? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) && ((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
55+
? ((top > 0 && top < innerHeight) || (bottom > 0 && bottom < innerHeight)) &&
56+
((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
5657
: top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth;
5758
};
5859

0 commit comments

Comments
 (0)