uniform-ui 2.3.6 → 3.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/uniform.es5.js +1 -1
- data/lib/assets/javascripts/uniform.js +8 -21
- data/lib/assets/javascripts/uniform/checkbox.js +59 -16
- data/lib/assets/javascripts/uniform/component.js +20 -4
- data/lib/assets/javascripts/uniform/dropdown.js +78 -209
- data/lib/assets/javascripts/uniform/floating-label-input.js +63 -0
- data/lib/assets/javascripts/uniform/icons.js +12 -3
- data/lib/assets/javascripts/uniform/modal.js +13 -12
- data/lib/assets/javascripts/uniform/popover.js +45 -26
- data/lib/assets/javascripts/uniform/resizer.js +26 -30
- data/lib/assets/javascripts/uniform/select.js +188 -220
- data/lib/assets/javascripts/uniform/tooltip.js +11 -11
- data/lib/assets/stylesheets/uniform.scss +3 -7
- data/lib/assets/stylesheets/uniform/base.scss +20 -1
- data/lib/assets/stylesheets/uniform/components/buttons.scss +171 -184
- data/lib/assets/stylesheets/uniform/components/checkbox.scss +104 -0
- data/lib/assets/stylesheets/uniform/components/container.scss +3 -2
- data/lib/assets/stylesheets/uniform/components/dropdown.scss +8 -5
- data/lib/assets/stylesheets/uniform/components/floating-label-input.scss +29 -0
- data/lib/assets/stylesheets/uniform/components/input-group.scss +30 -0
- data/lib/assets/stylesheets/uniform/components/label.scss +21 -16
- data/lib/assets/stylesheets/uniform/components/loaders.scss +28 -51
- data/lib/assets/stylesheets/uniform/components/nav.scss +50 -87
- data/lib/assets/stylesheets/uniform/components/pointer.scss +83 -0
- data/lib/assets/stylesheets/uniform/components/select.scss +97 -107
- data/lib/assets/stylesheets/uniform/components/table.scss +31 -138
- data/lib/assets/stylesheets/uniform/components/thumb.scss +40 -25
- data/lib/assets/stylesheets/uniform/components/z-input.scss +20 -0
- data/lib/assets/stylesheets/uniform/defaults.scss +31 -7
- data/lib/assets/stylesheets/uniform/functions.scss +32 -7
- data/lib/assets/stylesheets/uniform/mixins.scss +110 -57
- data/lib/assets/stylesheets/uniform/utilities.scss +53 -0
- data/lib/assets/stylesheets/uniform/utilities/background.scss +9 -0
- data/lib/assets/stylesheets/uniform/utilities/borders.scss +85 -0
- data/lib/assets/stylesheets/uniform/utilities/effects.scss +172 -0
- data/lib/assets/stylesheets/uniform/utilities/layout.scss +174 -0
- data/lib/assets/stylesheets/uniform/utilities/position.scss +42 -0
- data/lib/assets/stylesheets/uniform/utilities/sizing.scss +54 -0
- data/lib/assets/stylesheets/uniform/utilities/spacing.scss +62 -0
- data/lib/assets/stylesheets/uniform/utilities/text.scss +158 -0
- data/lib/assets/stylesheets/uniform/variables.scss +104 -44
- data/lib/uniform/version.rb +1 -1
- metadata +24 -48
- data/lib/assets/javascripts/uniform.jquery.js +0 -152
- data/lib/assets/javascripts/uniform/dom-helpers.js +0 -158
- data/lib/assets/javascripts/uniform/floating-label.js +0 -54
- data/lib/assets/stylesheets/uniform-print.scss +0 -1
- data/lib/assets/stylesheets/uniform/components.scss +0 -11
- data/lib/assets/stylesheets/uniform/components/alert.scss +0 -72
- data/lib/assets/stylesheets/uniform/components/card.scss +0 -93
- data/lib/assets/stylesheets/uniform/components/form.scss +0 -149
- data/lib/assets/stylesheets/uniform/components/form/checkbox-collection.scss +0 -103
- data/lib/assets/stylesheets/uniform/components/form/checkbox.scss +0 -58
- data/lib/assets/stylesheets/uniform/components/form/floating-label.scss +0 -65
- data/lib/assets/stylesheets/uniform/components/form/input-group.scss +0 -56
- data/lib/assets/stylesheets/uniform/components/form/tristate.scss +0 -88
- data/lib/assets/stylesheets/uniform/components/grid.scss +0 -179
- data/lib/assets/stylesheets/uniform/components/row.scss +0 -67
- data/lib/assets/stylesheets/uniform/components/tooltip.scss +0 -41
- data/lib/assets/stylesheets/uniform/helpers.scss +0 -133
- data/lib/assets/stylesheets/uniform/helpers/border.scss +0 -28
- data/lib/assets/stylesheets/uniform/helpers/colors.scss +0 -24
- data/lib/assets/stylesheets/uniform/helpers/margin.scss +0 -27
- data/lib/assets/stylesheets/uniform/helpers/padding.scss +0 -9
- data/lib/assets/stylesheets/uniform/helpers/position.scss +0 -20
- data/lib/assets/stylesheets/uniform/helpers/sizes.scss +0 -38
- data/lib/assets/stylesheets/uniform/helpers/text.scss +0 -152
- data/lib/assets/stylesheets/uniform/print/grid.scss +0 -50
data/lib/uniform/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniform-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Ehmke
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -38,21 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
|
42
|
-
name: sass-media_query_combiner
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
description: Sass components and helpers for building a UI.
|
41
|
+
description: Sass components and utilities for building a UI.
|
56
42
|
email:
|
57
43
|
- benehmke@gmail.com
|
58
44
|
executables: []
|
@@ -61,56 +47,46 @@ extra_rdoc_files: []
|
|
61
47
|
files:
|
62
48
|
- lib/assets/config/manifest.js
|
63
49
|
- lib/assets/javascripts/uniform.es5.js
|
64
|
-
- lib/assets/javascripts/uniform.jquery.js
|
65
50
|
- lib/assets/javascripts/uniform.js
|
66
51
|
- lib/assets/javascripts/uniform/checkbox.js
|
67
52
|
- lib/assets/javascripts/uniform/component.js
|
68
|
-
- lib/assets/javascripts/uniform/dom-helpers.js
|
69
53
|
- lib/assets/javascripts/uniform/dropdown.js
|
70
|
-
- lib/assets/javascripts/uniform/floating-label.js
|
54
|
+
- lib/assets/javascripts/uniform/floating-label-input.js
|
71
55
|
- lib/assets/javascripts/uniform/icons.js
|
72
56
|
- lib/assets/javascripts/uniform/modal.js
|
73
57
|
- lib/assets/javascripts/uniform/popover.js
|
74
58
|
- lib/assets/javascripts/uniform/resizer.js
|
75
59
|
- lib/assets/javascripts/uniform/select.js
|
76
60
|
- lib/assets/javascripts/uniform/tooltip.js
|
77
|
-
- lib/assets/stylesheets/uniform-print.scss
|
78
61
|
- lib/assets/stylesheets/uniform.scss
|
79
62
|
- lib/assets/stylesheets/uniform/base.scss
|
80
|
-
- lib/assets/stylesheets/uniform/components.scss
|
81
|
-
- lib/assets/stylesheets/uniform/components/alert.scss
|
82
63
|
- lib/assets/stylesheets/uniform/components/buttons.scss
|
83
|
-
- lib/assets/stylesheets/uniform/components/
|
64
|
+
- lib/assets/stylesheets/uniform/components/checkbox.scss
|
84
65
|
- lib/assets/stylesheets/uniform/components/container.scss
|
85
66
|
- lib/assets/stylesheets/uniform/components/dropdown.scss
|
86
|
-
- lib/assets/stylesheets/uniform/components/
|
87
|
-
- lib/assets/stylesheets/uniform/components/
|
88
|
-
- lib/assets/stylesheets/uniform/components/form/checkbox.scss
|
89
|
-
- lib/assets/stylesheets/uniform/components/form/floating-label.scss
|
90
|
-
- lib/assets/stylesheets/uniform/components/form/input-group.scss
|
91
|
-
- lib/assets/stylesheets/uniform/components/form/tristate.scss
|
92
|
-
- lib/assets/stylesheets/uniform/components/grid.scss
|
67
|
+
- lib/assets/stylesheets/uniform/components/floating-label-input.scss
|
68
|
+
- lib/assets/stylesheets/uniform/components/input-group.scss
|
93
69
|
- lib/assets/stylesheets/uniform/components/label.scss
|
94
70
|
- lib/assets/stylesheets/uniform/components/loaders.scss
|
95
71
|
- lib/assets/stylesheets/uniform/components/modal.scss
|
96
72
|
- lib/assets/stylesheets/uniform/components/nav.scss
|
97
|
-
- lib/assets/stylesheets/uniform/components/
|
73
|
+
- lib/assets/stylesheets/uniform/components/pointer.scss
|
98
74
|
- lib/assets/stylesheets/uniform/components/select.scss
|
99
75
|
- lib/assets/stylesheets/uniform/components/table.scss
|
100
76
|
- lib/assets/stylesheets/uniform/components/thumb.scss
|
101
|
-
- lib/assets/stylesheets/uniform/components/
|
77
|
+
- lib/assets/stylesheets/uniform/components/z-input.scss
|
102
78
|
- lib/assets/stylesheets/uniform/defaults.scss
|
103
79
|
- lib/assets/stylesheets/uniform/functions.scss
|
104
|
-
- lib/assets/stylesheets/uniform/helpers.scss
|
105
|
-
- lib/assets/stylesheets/uniform/helpers/border.scss
|
106
|
-
- lib/assets/stylesheets/uniform/helpers/colors.scss
|
107
|
-
- lib/assets/stylesheets/uniform/helpers/margin.scss
|
108
|
-
- lib/assets/stylesheets/uniform/helpers/padding.scss
|
109
|
-
- lib/assets/stylesheets/uniform/helpers/position.scss
|
110
|
-
- lib/assets/stylesheets/uniform/helpers/sizes.scss
|
111
|
-
- lib/assets/stylesheets/uniform/helpers/text.scss
|
112
80
|
- lib/assets/stylesheets/uniform/mixins.scss
|
113
|
-
- lib/assets/stylesheets/uniform/
|
81
|
+
- lib/assets/stylesheets/uniform/utilities.scss
|
82
|
+
- lib/assets/stylesheets/uniform/utilities/background.scss
|
83
|
+
- lib/assets/stylesheets/uniform/utilities/borders.scss
|
84
|
+
- lib/assets/stylesheets/uniform/utilities/effects.scss
|
85
|
+
- lib/assets/stylesheets/uniform/utilities/layout.scss
|
86
|
+
- lib/assets/stylesheets/uniform/utilities/position.scss
|
87
|
+
- lib/assets/stylesheets/uniform/utilities/sizing.scss
|
88
|
+
- lib/assets/stylesheets/uniform/utilities/spacing.scss
|
89
|
+
- lib/assets/stylesheets/uniform/utilities/text.scss
|
114
90
|
- lib/assets/stylesheets/uniform/variables.scss
|
115
91
|
- lib/uniform.rb
|
116
92
|
- lib/uniform/version.rb
|
@@ -118,7 +94,7 @@ homepage: http://bemky.github.io/uniform/
|
|
118
94
|
licenses:
|
119
95
|
- MIT
|
120
96
|
metadata: {}
|
121
|
-
post_install_message:
|
97
|
+
post_install_message:
|
122
98
|
rdoc_options: []
|
123
99
|
require_paths:
|
124
100
|
- lib
|
@@ -129,12 +105,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
105
|
version: '0'
|
130
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
107
|
requirements:
|
132
|
-
- - "
|
108
|
+
- - ">"
|
133
109
|
- !ruby/object:Gem::Version
|
134
|
-
version:
|
110
|
+
version: 1.3.1
|
135
111
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
137
|
-
signing_key:
|
112
|
+
rubygems_version: 3.2.3
|
113
|
+
signing_key:
|
138
114
|
specification_version: 4
|
139
115
|
summary: Sass UI
|
140
116
|
test_files: []
|
@@ -1,152 +0,0 @@
|
|
1
|
-
import * as Uniform from 'uniform';
|
2
|
-
|
3
|
-
window.Uniform = Uniform;
|
4
|
-
if($) {
|
5
|
-
/*
|
6
|
-
Dropdown
|
7
|
-
*/
|
8
|
-
$.fn.uniformDropdown = function() {
|
9
|
-
return this.each(function(){
|
10
|
-
var el = $(this);
|
11
|
-
var options = {
|
12
|
-
el: this
|
13
|
-
};
|
14
|
-
|
15
|
-
if (el.data('dropdown-align') !== undefined) options.align = el.data('dropdown-align');
|
16
|
-
if (el.data('dropdown-trigger') !== undefined) options.trigger = el.data('dropdown-trigger');
|
17
|
-
if (el.data('dropdown-show_arrow') !== undefined) options.show_arrow = el.data('dropdown-show_arrow');
|
18
|
-
if (el.data('dropdown-square') !== undefined) options.square = el.data('dropdown-square');
|
19
|
-
if (el.data('dropdown-hide_sm') !== undefined) options.hide_sm = el.data('dropdown-hide_sm');
|
20
|
-
if (el.data('dropdown-content') !== undefined) options.content = `<div class='pad'>${el.data('dropdown-content')}</div>`;
|
21
|
-
if (el.data('dropdown-target') !== undefined) options.content = $(el.data('dropdown-target'))[0];
|
22
|
-
var dropdown = new Uniform.Dropdown(options);
|
23
|
-
dropdown.on('*', function (event_key, dropdown) {
|
24
|
-
el.trigger('dropdown-' + event_key, dropdown);
|
25
|
-
});
|
26
|
-
dropdown.render();
|
27
|
-
});
|
28
|
-
};
|
29
|
-
|
30
|
-
|
31
|
-
/*
|
32
|
-
Checkbox
|
33
|
-
*/
|
34
|
-
$.fn.uniformCheckbox = function() {
|
35
|
-
return this.each(function(){
|
36
|
-
var el = $(this);
|
37
|
-
var checkbox = new Uniform.Checkbox({
|
38
|
-
el: this
|
39
|
-
});
|
40
|
-
checkbox.render();
|
41
|
-
});
|
42
|
-
};
|
43
|
-
$.fn.uniformRadio = $.fn.uniformCheckbox;
|
44
|
-
|
45
|
-
|
46
|
-
/*
|
47
|
-
FloatingLabel
|
48
|
-
*/
|
49
|
-
$.fn.uniformFloatingLabel = function() {
|
50
|
-
return this.each(function(){
|
51
|
-
new Uniform.FloatingLabel({
|
52
|
-
el: this
|
53
|
-
}).render();
|
54
|
-
});
|
55
|
-
};
|
56
|
-
|
57
|
-
|
58
|
-
/*
|
59
|
-
Modal
|
60
|
-
*/
|
61
|
-
$.fn.uniformModal = function() {
|
62
|
-
return this.click(function(){
|
63
|
-
var el = $(this);
|
64
|
-
var options = {
|
65
|
-
klass: el.data('modal-klass'),
|
66
|
-
content: el.data('modal-content')
|
67
|
-
};
|
68
|
-
if (el.data('modal-target')) {
|
69
|
-
var target = $(el.data('modal-target')).clone()
|
70
|
-
target.removeClass('hidden');
|
71
|
-
options.content = target[0];
|
72
|
-
}
|
73
|
-
var modal = new Uniform.Modal(options).render();
|
74
|
-
|
75
|
-
modal.on('*', function (event_type, modal) {
|
76
|
-
el.trigger('modal-' + event_type, modal);
|
77
|
-
});
|
78
|
-
})
|
79
|
-
};
|
80
|
-
|
81
|
-
|
82
|
-
/*
|
83
|
-
Resizer
|
84
|
-
*/
|
85
|
-
$.fn.uniformResizer = function() {
|
86
|
-
return this.each(function(){
|
87
|
-
new Uniform.Resizer({
|
88
|
-
el: this
|
89
|
-
});
|
90
|
-
});
|
91
|
-
};
|
92
|
-
|
93
|
-
|
94
|
-
/*
|
95
|
-
Select
|
96
|
-
*/
|
97
|
-
$.fn.uniformSelect = function() {
|
98
|
-
return this.each(function(){
|
99
|
-
var options = {
|
100
|
-
el: this
|
101
|
-
};
|
102
|
-
Object.assign(options, $(this).data());
|
103
|
-
new Uniform.Select(options).render();
|
104
|
-
});
|
105
|
-
};
|
106
|
-
|
107
|
-
|
108
|
-
/*
|
109
|
-
Tooltip
|
110
|
-
*/
|
111
|
-
$.fn.uniformTooltip = function() {
|
112
|
-
return this.each(function(){
|
113
|
-
var el = $(this);
|
114
|
-
var tooltip = new Uniform.Tooltip({
|
115
|
-
message: el.data('tooltip-message'),
|
116
|
-
container: el.data('tooltip-container'),
|
117
|
-
el: this
|
118
|
-
});
|
119
|
-
tooltip.on('*', function (event_type, tooltip) {
|
120
|
-
el.trigger('tooltip-' + event_type, tooltip);
|
121
|
-
});
|
122
|
-
tooltip.render();
|
123
|
-
});
|
124
|
-
};
|
125
|
-
|
126
|
-
$.fn.uniformTristate = function () {
|
127
|
-
return this.each(function(){
|
128
|
-
var el = $(this);
|
129
|
-
function updateTristateStatus(checked_input){
|
130
|
-
if (checked_input.length == 0) {
|
131
|
-
el.addClass('-null');
|
132
|
-
$(el.find('input')[1]).prop('checked', true);
|
133
|
-
} else {
|
134
|
-
var index = checked_input.index();
|
135
|
-
var klass = index == 0 ? "-true" : (index == 1 ? "-null" : "-false");
|
136
|
-
el.removeClass('-true -null -false');
|
137
|
-
el.addClass(klass);
|
138
|
-
}
|
139
|
-
}
|
140
|
-
el.on('change', 'input', function (e) {
|
141
|
-
updateTristateStatus($(e.currentTarget));
|
142
|
-
});
|
143
|
-
updateTristateStatus(el.find('input:checked'));
|
144
|
-
el.on('blur', 'input', function (e) {
|
145
|
-
el.removeClass('-focus');
|
146
|
-
});
|
147
|
-
el.on('focus', 'input', function (e) {
|
148
|
-
el.addClass('-focus');
|
149
|
-
});
|
150
|
-
});
|
151
|
-
}
|
152
|
-
}
|
@@ -1,158 +0,0 @@
|
|
1
|
-
export function hasClass (el, className) {
|
2
|
-
var test;
|
3
|
-
if(el.classList)
|
4
|
-
test = el.classList.contains(className)
|
5
|
-
else
|
6
|
-
test = new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
|
7
|
-
return test
|
8
|
-
}
|
9
|
-
|
10
|
-
export function addClass(el, className) {
|
11
|
-
if (el.classList){
|
12
|
-
each(className.split(" "), function(className){
|
13
|
-
el.classList.add(className);
|
14
|
-
});
|
15
|
-
} else
|
16
|
-
el.className += ' ' + className;
|
17
|
-
}
|
18
|
-
|
19
|
-
export function removeClass(el, className) {
|
20
|
-
var removeClassFunction = function (el) {
|
21
|
-
if (el.classList)
|
22
|
-
className.split(" ").forEach((x) => el.classList.remove(x));
|
23
|
-
else
|
24
|
-
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
|
25
|
-
}
|
26
|
-
if (NodeList.prototype.isPrototypeOf(el))
|
27
|
-
each(el, removeClassFunction)
|
28
|
-
else
|
29
|
-
removeClassFunction(el);
|
30
|
-
}
|
31
|
-
|
32
|
-
export function toggleClass(el, className, toggle) {
|
33
|
-
if (el.classList) {
|
34
|
-
el.classList.toggle(className, toggle);
|
35
|
-
} else {
|
36
|
-
var classes = el.className.split(' ');
|
37
|
-
var existingIndex = classes.indexOf(className);
|
38
|
-
|
39
|
-
if (toggle === false || (toggle !== true && existingIndex >= 0))
|
40
|
-
classes.splice(existingIndex, 1);
|
41
|
-
else
|
42
|
-
classes.push(className);
|
43
|
-
|
44
|
-
el.className = classes.join(' ');
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
export function trigger(el, eventName) {
|
49
|
-
var event = document.createEvent('HTMLEvents');
|
50
|
-
event.initEvent(eventName, true, false);
|
51
|
-
el.dispatchEvent(event);
|
52
|
-
}
|
53
|
-
|
54
|
-
export function each (elements, method){
|
55
|
-
for(var i=0; i < elements.length; i++){
|
56
|
-
method(elements[i], i);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
export function map (elements, method){
|
61
|
-
var results = [];
|
62
|
-
for(var i=0; i < elements.length; i++){
|
63
|
-
results.push(method(elements[i], i));
|
64
|
-
}
|
65
|
-
return results;
|
66
|
-
}
|
67
|
-
|
68
|
-
export function is_visible(element){
|
69
|
-
return element.offsetParent !== null;
|
70
|
-
}
|
71
|
-
|
72
|
-
export function is_focus(element){
|
73
|
-
return document.activeElement === element;
|
74
|
-
}
|
75
|
-
|
76
|
-
export function is_empty(element){
|
77
|
-
return element.innerHTML === "";
|
78
|
-
}
|
79
|
-
|
80
|
-
export function css (el, rule) {
|
81
|
-
return getComputedStyle(el)[rule];
|
82
|
-
}
|
83
|
-
|
84
|
-
export function remove (el) {
|
85
|
-
el.parentNode.removeChild(el);
|
86
|
-
}
|
87
|
-
|
88
|
-
export function createElement(html) {
|
89
|
-
var container = document.createElement('div');
|
90
|
-
container.innerHTML = html;
|
91
|
-
return container.children[0];
|
92
|
-
}
|
93
|
-
|
94
|
-
export function closest(el, selector) {
|
95
|
-
if(el.closest) return el.closest(selector);
|
96
|
-
while (el) {
|
97
|
-
if (Element.prototype.matches ? el.matches(selector) : el.msMatchesSelector(selector)) {
|
98
|
-
return el;
|
99
|
-
}
|
100
|
-
el = el.parentElement;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
|
104
|
-
export function ancestors(el) {
|
105
|
-
var ancestors = [];
|
106
|
-
el = el.parentElement;
|
107
|
-
while (el){
|
108
|
-
ancestors.push(el);
|
109
|
-
el = el.parentElement;
|
110
|
-
}
|
111
|
-
return ancestors;
|
112
|
-
}
|
113
|
-
|
114
|
-
export function filter(nodes, predicate){
|
115
|
-
var filteredNodes = [];
|
116
|
-
each(nodes, function(node){
|
117
|
-
if(predicate(node)) filteredNodes.push(node);
|
118
|
-
});
|
119
|
-
return filteredNodes;
|
120
|
-
}
|
121
|
-
|
122
|
-
export function offset(el){
|
123
|
-
var rect = el.getBoundingClientRect();
|
124
|
-
return {
|
125
|
-
top: rect.top + window.scrollY,
|
126
|
-
left: rect.left + window.scrollX
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
export function offsetToViewport(el){
|
131
|
-
var rect = el.getBoundingClientRect();
|
132
|
-
return {
|
133
|
-
top: rect.top,
|
134
|
-
left: rect.left
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
export function outerHeight(el){
|
139
|
-
var height = el.offsetHeight;
|
140
|
-
var style = getComputedStyle(el);
|
141
|
-
|
142
|
-
height += parseInt(style.marginTop) + parseInt(style.marginBottom);
|
143
|
-
return height;
|
144
|
-
}
|
145
|
-
|
146
|
-
export function outerWidth(el){
|
147
|
-
var width = el.offsetWidth;
|
148
|
-
var style = getComputedStyle(el);
|
149
|
-
|
150
|
-
width += parseInt(style.marginLeft) + parseInt(style.marginRight);
|
151
|
-
return width;
|
152
|
-
}
|
153
|
-
|
154
|
-
export function uniqueId(prefix){
|
155
|
-
window.idCounter || (window.idCounter = 0);
|
156
|
-
var id = ++window.idCounter + '';
|
157
|
-
return prefix ? prefix + id : id;
|
158
|
-
}
|