@base-framework/base 2.6.1 → 2.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/base.js +1 -0
- package/package.json +30 -26
- package/.jshintrc +0 -3
- package/base.js +0 -41
- package/base.min.js +0 -1
- package/core.js +0 -1
- package/data-tracker.js +0 -351
- package/es5/base.js +0 -2968
- package/es5/modules/ajax.js +0 -663
- package/es5/modules/animation.js +0 -188
- package/es5/modules/animations.js +0 -1080
- package/es5/modules/atom.js +0 -65
- package/es5/modules/component.js +0 -1310
- package/es5/modules/data-binder.js +0 -1131
- package/es5/modules/data.js +0 -1808
- package/es5/modules/date.js +0 -525
- package/es5/modules/form-validator.js +0 -324
- package/es5/modules/history.js +0 -126
- package/es5/modules/html-builder.js +0 -461
- package/es5/modules/layout.js +0 -1679
- package/es5/modules/mouse.js +0 -124
- package/es5/modules/nav-link.js +0 -123
- package/es5/modules/olderversions/animations-ease.js +0 -1095
- package/es5/modules/olderversions/animations-update.js +0 -1048
- package/es5/modules/olderversions/base-animations.js +0 -636
- package/es5/modules/olderversions/base-component-class.js +0 -100
- package/es5/modules/olderversions/base-data-binder-1.js +0 -407
- package/es5/modules/olderversions/base-data-binder-class.js +0 -358
- package/es5/modules/olderversions/base-layout-parser-class.js +0 -172
- package/es5/modules/olderversions/base-mode-1.js +0 -777
- package/es5/modules/olderversions/base-model-class.js +0 -585
- package/es5/modules/olderversions/data-binder/element-binding/base-data-binder-class.js +0 -358
- package/es5/modules/olderversions/data-binder/element-binding/base-model-class.js +0 -585
- package/es5/modules/olderversions/data-binder/model-binding/base-data-binder-class.js +0 -353
- package/es5/modules/olderversions/data-binder/model-binding/base-model-class.js +0 -604
- package/es5/modules/olderversions/data-binder-update-watcher.js +0 -640
- package/es5/modules/olderversions/data-tracker.js +0 -187
- package/es5/modules/olderversions/event-update.js +0 -666
- package/es5/modules/olderversions/nav-link.js +0 -119
- package/es5/modules/olderversions/router-with-templates-1.js +0 -785
- package/es5/modules/olderversions/router-with-templates.js +0 -701
- package/es5/modules/prototypes/ajax.js +0 -657
- package/es5/modules/prototypes/atom.js +0 -65
- package/es5/modules/prototypes/component.js +0 -972
- package/es5/modules/prototypes/data-binder.js +0 -1089
- package/es5/modules/prototypes/data.js +0 -1290
- package/es5/modules/prototypes/html-builder.js +0 -414
- package/es5/modules/prototypes/layout.js +0 -879
- package/es5/modules/router.js +0 -1680
- package/es5/modules/state.js +0 -274
- package/es6/.jshintrc +0 -3
- package/es6/base.js +0 -41
- package/es6/core.js +0 -1
- package/es6/data-tracker.js +0 -351
- package/es6/events.js +0 -602
- package/es6/legacy/es5/base.js +0 -2968
- package/es6/legacy/es5/modules/ajax.js +0 -663
- package/es6/legacy/es5/modules/animation.js +0 -188
- package/es6/legacy/es5/modules/animations.js +0 -1080
- package/es6/legacy/es5/modules/atom.js +0 -65
- package/es6/legacy/es5/modules/component.js +0 -1310
- package/es6/legacy/es5/modules/data-binder.js +0 -1131
- package/es6/legacy/es5/modules/data.js +0 -1808
- package/es6/legacy/es5/modules/date.js +0 -525
- package/es6/legacy/es5/modules/form-validator.js +0 -324
- package/es6/legacy/es5/modules/history.js +0 -126
- package/es6/legacy/es5/modules/html-builder.js +0 -461
- package/es6/legacy/es5/modules/layout.js +0 -1679
- package/es6/legacy/es5/modules/mouse.js +0 -124
- package/es6/legacy/es5/modules/nav-link.js +0 -123
- package/es6/legacy/es5/modules/olderversions/animations-ease.js +0 -1095
- package/es6/legacy/es5/modules/olderversions/animations-update.js +0 -1048
- package/es6/legacy/es5/modules/olderversions/base-animations.js +0 -636
- package/es6/legacy/es5/modules/olderversions/base-component-class.js +0 -100
- package/es6/legacy/es5/modules/olderversions/base-data-binder-1.js +0 -407
- package/es6/legacy/es5/modules/olderversions/base-data-binder-class.js +0 -358
- package/es6/legacy/es5/modules/olderversions/base-layout-parser-class.js +0 -172
- package/es6/legacy/es5/modules/olderversions/base-mode-1.js +0 -777
- package/es6/legacy/es5/modules/olderversions/base-model-class.js +0 -585
- package/es6/legacy/es5/modules/olderversions/data-binder/element-binding/base-data-binder-class.js +0 -358
- package/es6/legacy/es5/modules/olderversions/data-binder/element-binding/base-model-class.js +0 -585
- package/es6/legacy/es5/modules/olderversions/data-binder/model-binding/base-data-binder-class.js +0 -353
- package/es6/legacy/es5/modules/olderversions/data-binder/model-binding/base-model-class.js +0 -604
- package/es6/legacy/es5/modules/olderversions/data-binder-update-watcher.js +0 -640
- package/es6/legacy/es5/modules/olderversions/data-tracker.js +0 -187
- package/es6/legacy/es5/modules/olderversions/event-update.js +0 -666
- package/es6/legacy/es5/modules/olderversions/nav-link.js +0 -119
- package/es6/legacy/es5/modules/olderversions/router-with-templates-1.js +0 -785
- package/es6/legacy/es5/modules/olderversions/router-with-templates.js +0 -701
- package/es6/legacy/es5/modules/prototypes/ajax.js +0 -657
- package/es6/legacy/es5/modules/prototypes/atom.js +0 -65
- package/es6/legacy/es5/modules/prototypes/component.js +0 -972
- package/es6/legacy/es5/modules/prototypes/data-binder.js +0 -1089
- package/es6/legacy/es5/modules/prototypes/data.js +0 -1290
- package/es6/legacy/es5/modules/prototypes/html-builder.js +0 -414
- package/es6/legacy/es5/modules/prototypes/layout.js +0 -879
- package/es6/legacy/es5/modules/router.js +0 -1680
- package/es6/legacy/es5/modules/state.js +0 -274
- package/es6/main.js +0 -1331
- package/es6/modules/ajax/ajax.js +0 -514
- package/es6/modules/animation/animation.js +0 -236
- package/es6/modules/animations/animation-controller.js +0 -231
- package/es6/modules/animations/animation.js +0 -64
- package/es6/modules/animations/attr-movement.js +0 -66
- package/es6/modules/animations/css-movement.js +0 -170
- package/es6/modules/animations/movement.js +0 -131
- package/es6/modules/animations/value.js +0 -187
- package/es6/modules/atom/atom.js +0 -54
- package/es6/modules/component/component.js +0 -230
- package/es6/modules/component/event-helper.js +0 -119
- package/es6/modules/component/jot.js +0 -144
- package/es6/modules/component/state-helper.js +0 -262
- package/es6/modules/component/unit.js +0 -551
- package/es6/modules/data/attrs.js +0 -40
- package/es6/modules/data/basic-data.js +0 -500
- package/es6/modules/data/data-utils.js +0 -29
- package/es6/modules/data/data.js +0 -3
- package/es6/modules/data/deep-data.js +0 -541
- package/es6/modules/data/model-service.js +0 -528
- package/es6/modules/data/model.js +0 -133
- package/es6/modules/data/simple-data.js +0 -33
- package/es6/modules/data-binder/connection-tracker.js +0 -113
- package/es6/modules/data-binder/connection.js +0 -16
- package/es6/modules/data-binder/data-binder.js +0 -352
- package/es6/modules/data-binder/data-pub-sub.js +0 -141
- package/es6/modules/data-binder/data-source.js +0 -56
- package/es6/modules/data-binder/element-source.js +0 -219
- package/es6/modules/data-binder/one-way-connection.js +0 -46
- package/es6/modules/data-binder/one-way-source.js +0 -43
- package/es6/modules/data-binder/source.js +0 -36
- package/es6/modules/data-binder/two-way-connection.js +0 -75
- package/es6/modules/data-binder/two-way-source.js +0 -41
- package/es6/modules/date/date.js +0 -544
- package/es6/modules/history/history.js +0 -89
- package/es6/modules/html-builder/html-builder.js +0 -434
- package/es6/modules/import/import.js +0 -390
- package/es6/modules/layout/layout-builder.js +0 -1269
- package/es6/modules/layout/layout-parser.js +0 -134
- package/es6/modules/layout/watcher-helper.js +0 -282
- package/es6/modules/mouse/mouse.js +0 -114
- package/es6/modules/router/component-helper.js +0 -163
- package/es6/modules/router/history-controller.js +0 -216
- package/es6/modules/router/nav-link.js +0 -124
- package/es6/modules/router/route.js +0 -401
- package/es6/modules/router/router.js +0 -789
- package/es6/modules/router/utils.js +0 -31
- package/es6/modules/state/state-target.js +0 -91
- package/es6/modules/state/state.js +0 -171
- package/es6/package-lock.json +0 -13
- package/es6/package.json +0 -28
- package/es6/shared/objects.js +0 -99
- package/events.js +0 -602
- package/legacy/es5/base.js +0 -2968
- package/legacy/es5/modules/ajax.js +0 -663
- package/legacy/es5/modules/animation.js +0 -188
- package/legacy/es5/modules/animations.js +0 -1080
- package/legacy/es5/modules/atom.js +0 -65
- package/legacy/es5/modules/component.js +0 -1310
- package/legacy/es5/modules/data-binder.js +0 -1131
- package/legacy/es5/modules/data.js +0 -1808
- package/legacy/es5/modules/date.js +0 -525
- package/legacy/es5/modules/form-validator.js +0 -324
- package/legacy/es5/modules/history.js +0 -126
- package/legacy/es5/modules/html-builder.js +0 -461
- package/legacy/es5/modules/layout.js +0 -1679
- package/legacy/es5/modules/mouse.js +0 -124
- package/legacy/es5/modules/nav-link.js +0 -123
- package/legacy/es5/modules/olderversions/animations-ease.js +0 -1095
- package/legacy/es5/modules/olderversions/animations-update.js +0 -1048
- package/legacy/es5/modules/olderversions/base-animations.js +0 -636
- package/legacy/es5/modules/olderversions/base-component-class.js +0 -100
- package/legacy/es5/modules/olderversions/base-data-binder-1.js +0 -407
- package/legacy/es5/modules/olderversions/base-data-binder-class.js +0 -358
- package/legacy/es5/modules/olderversions/base-layout-parser-class.js +0 -172
- package/legacy/es5/modules/olderversions/base-mode-1.js +0 -777
- package/legacy/es5/modules/olderversions/base-model-class.js +0 -585
- package/legacy/es5/modules/olderversions/data-binder/element-binding/base-data-binder-class.js +0 -358
- package/legacy/es5/modules/olderversions/data-binder/element-binding/base-model-class.js +0 -585
- package/legacy/es5/modules/olderversions/data-binder/model-binding/base-data-binder-class.js +0 -353
- package/legacy/es5/modules/olderversions/data-binder/model-binding/base-model-class.js +0 -604
- package/legacy/es5/modules/olderversions/data-binder-update-watcher.js +0 -640
- package/legacy/es5/modules/olderversions/data-tracker.js +0 -187
- package/legacy/es5/modules/olderversions/event-update.js +0 -666
- package/legacy/es5/modules/olderversions/nav-link.js +0 -119
- package/legacy/es5/modules/olderversions/router-with-templates-1.js +0 -785
- package/legacy/es5/modules/olderversions/router-with-templates.js +0 -701
- package/legacy/es5/modules/prototypes/ajax.js +0 -657
- package/legacy/es5/modules/prototypes/atom.js +0 -65
- package/legacy/es5/modules/prototypes/component.js +0 -972
- package/legacy/es5/modules/prototypes/data-binder.js +0 -1089
- package/legacy/es5/modules/prototypes/data.js +0 -1290
- package/legacy/es5/modules/prototypes/html-builder.js +0 -414
- package/legacy/es5/modules/prototypes/layout.js +0 -879
- package/legacy/es5/modules/router.js +0 -1680
- package/legacy/es5/modules/state.js +0 -274
- package/main.js +0 -1331
- package/modules/ajax/ajax.js +0 -514
- package/modules/animation/animation.js +0 -236
- package/modules/animations/animation-controller.js +0 -231
- package/modules/animations/animation.js +0 -64
- package/modules/animations/attr-movement.js +0 -66
- package/modules/animations/css-movement.js +0 -170
- package/modules/animations/movement.js +0 -131
- package/modules/animations/value.js +0 -187
- package/modules/atom/atom.js +0 -54
- package/modules/component/component.js +0 -230
- package/modules/component/event-helper.js +0 -119
- package/modules/component/jot.js +0 -144
- package/modules/component/state-helper.js +0 -262
- package/modules/component/unit.js +0 -551
- package/modules/data/attrs.js +0 -40
- package/modules/data/basic-data.js +0 -500
- package/modules/data/data-utils.js +0 -29
- package/modules/data/data.js +0 -3
- package/modules/data/deep-data.js +0 -541
- package/modules/data/model-service.js +0 -528
- package/modules/data/model.js +0 -133
- package/modules/data/simple-data.js +0 -33
- package/modules/data-binder/connection-tracker.js +0 -113
- package/modules/data-binder/connection.js +0 -16
- package/modules/data-binder/data-binder.js +0 -352
- package/modules/data-binder/data-pub-sub.js +0 -141
- package/modules/data-binder/data-source.js +0 -56
- package/modules/data-binder/element-source.js +0 -219
- package/modules/data-binder/one-way-connection.js +0 -46
- package/modules/data-binder/one-way-source.js +0 -43
- package/modules/data-binder/source.js +0 -36
- package/modules/data-binder/two-way-connection.js +0 -75
- package/modules/data-binder/two-way-source.js +0 -41
- package/modules/date/date.js +0 -544
- package/modules/history/history.js +0 -89
- package/modules/html-builder/html-builder.js +0 -434
- package/modules/import/import.js +0 -390
- package/modules/layout/layout-builder.js +0 -1269
- package/modules/layout/layout-parser.js +0 -134
- package/modules/layout/watcher-helper.js +0 -282
- package/modules/mouse/mouse.js +0 -114
- package/modules/router/component-helper.js +0 -163
- package/modules/router/history-controller.js +0 -216
- package/modules/router/nav-link.js +0 -124
- package/modules/router/route.js +0 -401
- package/modules/router/router.js +0 -789
- package/modules/router/utils.js +0 -31
- package/modules/state/state-target.js +0 -91
- package/modules/state/state.js +0 -171
- package/shared/objects.js +0 -99
- package/update +0 -16
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import {Movement} from './movement.js';
|
|
2
|
-
import {base} from '../../core.js';
|
|
3
|
-
|
|
4
|
-
export class CssMovement extends Movement
|
|
5
|
-
{
|
|
6
|
-
constructor(element, settings)
|
|
7
|
-
{
|
|
8
|
-
this.style = element.style;
|
|
9
|
-
super(element, settings);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/* this will get start value of the property being animated.
|
|
13
|
-
@param (string) value = the value being modified
|
|
14
|
-
@return (string) the type of units */
|
|
15
|
-
getStartValue(value, end)
|
|
16
|
-
{
|
|
17
|
-
let start = 0;
|
|
18
|
-
if(typeof value === 'undefined')
|
|
19
|
-
{
|
|
20
|
-
let element = this.element,
|
|
21
|
-
property = this.property,
|
|
22
|
-
method = this.method;
|
|
23
|
-
if(method)
|
|
24
|
-
{
|
|
25
|
-
let values = base.getCss(element, property);
|
|
26
|
-
if(values !== 'none')
|
|
27
|
-
{
|
|
28
|
-
let cssPattern = new RegExp('(?:' + method + '\((.+)\))', 'g');
|
|
29
|
-
values.replace(cssPattern, (fullMatch, params) =>
|
|
30
|
-
{
|
|
31
|
-
start = (typeof params === 'string')? params.split(',') : null;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
else
|
|
35
|
-
{
|
|
36
|
-
let unit,
|
|
37
|
-
pattern = /\d+/g,
|
|
38
|
-
length = end.length;
|
|
39
|
-
start = [];
|
|
40
|
-
for(var i = 0; i < length; i++)
|
|
41
|
-
{
|
|
42
|
-
/* we want to ensure that we add the same units */
|
|
43
|
-
unit = end[i].replace(pattern, '');
|
|
44
|
-
start.push(0 + unit);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
else
|
|
49
|
-
{
|
|
50
|
-
let params = base.getCss(element, property);
|
|
51
|
-
start = (typeof params === 'string')? params.split(' ') : null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else
|
|
55
|
-
{
|
|
56
|
-
start = this.getCssValue(value);
|
|
57
|
-
}
|
|
58
|
-
return start;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
getEndValue(text)
|
|
62
|
-
{
|
|
63
|
-
return this.getCssValue(text);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/* this will get the number from an value and remove
|
|
67
|
-
any other marks including chars.
|
|
68
|
-
@param (mixed) text = the text to get the value from
|
|
69
|
-
@return (number) the number value */
|
|
70
|
-
getCssValue(text)
|
|
71
|
-
{
|
|
72
|
-
let textType = typeof text;
|
|
73
|
-
if(textType !== 'undefined')
|
|
74
|
-
{
|
|
75
|
-
let value;
|
|
76
|
-
|
|
77
|
-
if(textType === 'string')
|
|
78
|
-
{
|
|
79
|
-
/* this will check to setup the css value by
|
|
80
|
-
checking if we are using a css method
|
|
81
|
-
e.g. transform: translate3d() */
|
|
82
|
-
let cssPattern = /(?:(\w+\s*)\((.+)\))/g;
|
|
83
|
-
text.replace(cssPattern, (fullMatch, method, params) =>
|
|
84
|
-
{
|
|
85
|
-
value = (typeof params === 'string')? params.split(',') : null;
|
|
86
|
-
self.setMethod(method);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
if(value === undefined)
|
|
90
|
-
{
|
|
91
|
-
/* this will check to split by space to allow
|
|
92
|
-
short hand */
|
|
93
|
-
value = text.split(' ');
|
|
94
|
-
}
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
else
|
|
98
|
-
{
|
|
99
|
-
return text;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return 0;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/* this will create a new value object array for the
|
|
106
|
-
property values to be updated.
|
|
107
|
-
@param (object) settings
|
|
108
|
-
@return (array) the values array */
|
|
109
|
-
createValue(settings)
|
|
110
|
-
{
|
|
111
|
-
let valueArray = [],
|
|
112
|
-
values = this.getValue(settings);
|
|
113
|
-
if(values)
|
|
114
|
-
{
|
|
115
|
-
if(Array.isArray(values.end))
|
|
116
|
-
{
|
|
117
|
-
let start = values.start,
|
|
118
|
-
end = values.end;
|
|
119
|
-
for(var i = 0, length = end.length; i < length; i++)
|
|
120
|
-
{
|
|
121
|
-
valueArray.push(new Value({
|
|
122
|
-
start: start[i],
|
|
123
|
-
end: end[i]
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
else
|
|
128
|
-
{
|
|
129
|
-
valueArray.push(new Value(values));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return valueArray;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
setMethod(method)
|
|
136
|
-
{
|
|
137
|
-
if(typeof this.method !== 'string')
|
|
138
|
-
{
|
|
139
|
-
this.method = method;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
updateValue(delta)
|
|
144
|
-
{
|
|
145
|
-
let valueArray = [],
|
|
146
|
-
values = this.value;
|
|
147
|
-
if(values.length)
|
|
148
|
-
{
|
|
149
|
-
for(var i = 0, length = values.length; i < length; i++)
|
|
150
|
-
{
|
|
151
|
-
valueArray.push(values[i].update(delta));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return valueArray;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
update(value)
|
|
158
|
-
{
|
|
159
|
-
let method = this.method;
|
|
160
|
-
if(method)
|
|
161
|
-
{
|
|
162
|
-
value = method + '(' + value.join(', ') + ')';
|
|
163
|
-
}
|
|
164
|
-
else
|
|
165
|
-
{
|
|
166
|
-
value = value.join(' ');
|
|
167
|
-
}
|
|
168
|
-
this.style[this.property] = value;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import {CssMovement} from './css-movement.js';
|
|
2
|
-
import {AttrMovement} from './attr-movement.js';
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
Movement class
|
|
6
|
-
|
|
7
|
-
this will create a movement object that can
|
|
8
|
-
update the property when animated. this is an abstract
|
|
9
|
-
class and should be extended to use.
|
|
10
|
-
|
|
11
|
-
@param (object) element
|
|
12
|
-
@param (object) settings
|
|
13
|
-
*/
|
|
14
|
-
export class Movement
|
|
15
|
-
{
|
|
16
|
-
constructor(element, settings)
|
|
17
|
-
{
|
|
18
|
-
this.element = element;
|
|
19
|
-
this.property = null;
|
|
20
|
-
this.value = null;
|
|
21
|
-
|
|
22
|
-
this.setup(settings);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
setup(settings)
|
|
26
|
-
{
|
|
27
|
-
this.setupProperty(settings);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/* this will return a new movement object by the
|
|
31
|
-
property type.
|
|
32
|
-
@param (object) element
|
|
33
|
-
@param (object) settings
|
|
34
|
-
@return (object) the new movement */
|
|
35
|
-
setupMovementType(element, settings)
|
|
36
|
-
{
|
|
37
|
-
let movement,
|
|
38
|
-
type = this.getType(element, settings);
|
|
39
|
-
switch(type)
|
|
40
|
-
{
|
|
41
|
-
case 'css':
|
|
42
|
-
movement = new CssMovement(element, settings);
|
|
43
|
-
break;
|
|
44
|
-
case 'attr':
|
|
45
|
-
movement = new AttrMovement(element, settings);
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
return movement;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
getType(element, settings)
|
|
52
|
-
{
|
|
53
|
-
return (element.style && settings.property in element.style)? 'css' : 'attr';
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* this will create a new value object for the
|
|
57
|
-
property value to be updated.
|
|
58
|
-
@param (object) settings
|
|
59
|
-
@return (object) the value object */
|
|
60
|
-
createValue(settings)
|
|
61
|
-
{
|
|
62
|
-
let values = this.getValue(settings);
|
|
63
|
-
return new Value(values);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/* this will get the start and end values of the
|
|
67
|
-
movement to be used to create a new value object.
|
|
68
|
-
@param (object) settings
|
|
69
|
-
@return (object) the start and end values */
|
|
70
|
-
getValue(settings)
|
|
71
|
-
{
|
|
72
|
-
let endValue = this.getEndValue(settings.endValue),
|
|
73
|
-
startValue = this.getStartValue(settings.startValue, endValue);
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
start: startValue,
|
|
77
|
-
end: endValue
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/* this will get start value of the property being animated.
|
|
82
|
-
@param (string) value = the value being modified
|
|
83
|
-
@return (string) the type of units */
|
|
84
|
-
getStartValue(value, end)
|
|
85
|
-
{
|
|
86
|
-
return value;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
getEndValue(text)
|
|
90
|
-
{
|
|
91
|
-
return text;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setupProperty(settings)
|
|
95
|
-
{
|
|
96
|
-
this.property = settings.property;
|
|
97
|
-
this.value = this.createValue(settings);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/* this will update the value object
|
|
101
|
-
@param (number) delta
|
|
102
|
-
return (mixed) the proprety value */
|
|
103
|
-
updateValue(delta)
|
|
104
|
-
{
|
|
105
|
-
return this.value.update(delta);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
step(delta)
|
|
109
|
-
{
|
|
110
|
-
var value = this.updateValue(delta);
|
|
111
|
-
this.update(value);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/* this should be overridden by the update
|
|
115
|
-
property type being animated.
|
|
116
|
-
@param (mixed) value */
|
|
117
|
-
update(value)
|
|
118
|
-
{
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/* this is a static moethod that can create
|
|
124
|
-
anewinstance of amovement by thepreopty type.
|
|
125
|
-
@param (object) element
|
|
126
|
-
@param (object) settings
|
|
127
|
-
@return (object) the new movement */
|
|
128
|
-
Movement.create = function(element, settings)
|
|
129
|
-
{
|
|
130
|
-
return this.prototype.setupMovementType(element, settings);
|
|
131
|
-
};
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import {base} from '../../core.js';
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
Value class
|
|
5
|
-
|
|
6
|
-
this will create a movement property value that can
|
|
7
|
-
update the property value when animated.
|
|
8
|
-
|
|
9
|
-
this will automatically get the units of the value
|
|
10
|
-
and check for value combining to inherit the start
|
|
11
|
-
value and add or remove the end value from the
|
|
12
|
-
start.
|
|
13
|
-
|
|
14
|
-
@param (object) settings
|
|
15
|
-
*/
|
|
16
|
-
export class Value
|
|
17
|
-
{
|
|
18
|
-
constructor(settings)
|
|
19
|
-
{
|
|
20
|
-
this.value = null;
|
|
21
|
-
this.setup(settings);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
setup(settings)
|
|
25
|
-
{
|
|
26
|
-
let value = this.value = this.createValue(settings);
|
|
27
|
-
/* we want to check if we are increasing or
|
|
28
|
-
decreasing the target */
|
|
29
|
-
value.increasing = this.isIncreasing(settings.end);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
createValue(settings)
|
|
33
|
-
{
|
|
34
|
-
/* we need to get the end value with any extra data
|
|
35
|
-
to check for combining and to get the units */
|
|
36
|
-
let endValue = settings.end,
|
|
37
|
-
startValue = this.getValue(settings.start),
|
|
38
|
-
value = this.getValue(endValue);
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
combining: this.checkCombind(endValue),
|
|
42
|
-
start: startValue,
|
|
43
|
-
end: value,
|
|
44
|
-
units: this.getUnits(endValue),
|
|
45
|
-
difference: (Math.abs(startValue - value))
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/* this will get the units of the property being animated.
|
|
50
|
-
@param (string) text = the value being modified
|
|
51
|
-
@return (string) the type of units */
|
|
52
|
-
getUnits(text)
|
|
53
|
-
{
|
|
54
|
-
if(typeof text !== 'undefined')
|
|
55
|
-
{
|
|
56
|
-
text = this.getString(text);
|
|
57
|
-
|
|
58
|
-
/* we need to remove the numbers or plus or minus equals
|
|
59
|
-
to get the units */
|
|
60
|
-
let pattern = /([0-9.\-\+=])/g;
|
|
61
|
-
return text.replace(pattern, '');
|
|
62
|
-
}
|
|
63
|
-
return '';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
checkCombind(end)
|
|
67
|
-
{
|
|
68
|
-
if(typeof end !== 'undefined')
|
|
69
|
-
{
|
|
70
|
-
end = this.getString(end);
|
|
71
|
-
/* we want to check if we have a plus or minus equals to
|
|
72
|
-
show that we are using the current position as the start */
|
|
73
|
-
let pattern = /(\+=|-=)/g,
|
|
74
|
-
matches = end.match(pattern);
|
|
75
|
-
if(matches)
|
|
76
|
-
{
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/* this will convert any type to a string
|
|
84
|
-
@param (mixed) value = the value to convert
|
|
85
|
-
@return (string) the value string */
|
|
86
|
-
getString(value)
|
|
87
|
-
{
|
|
88
|
-
return (typeof value !== 'string')? value.toString() : value;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/* this will get the number from an value and remove
|
|
92
|
-
any other marks including chars.
|
|
93
|
-
@param (mixed) text = the text to get the value from
|
|
94
|
-
@return (number) the number value */
|
|
95
|
-
getValue(text)
|
|
96
|
-
{
|
|
97
|
-
if(typeof text !== 'undefined')
|
|
98
|
-
{
|
|
99
|
-
/* we need to remove any non numeric data from the value
|
|
100
|
-
and convert to number after */
|
|
101
|
-
let pattern = /(\+=|-=|[^0-9.-])/g;
|
|
102
|
-
text = this.getString(text);
|
|
103
|
-
return (text.replace(pattern, '') * 1);
|
|
104
|
-
}
|
|
105
|
-
return 0;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/* this will check if the element is increasing or decreasing the
|
|
109
|
-
target.
|
|
110
|
-
@return (bool) true or false */
|
|
111
|
-
isIncreasing(endValue)
|
|
112
|
-
{
|
|
113
|
-
/* we want to check if we are adding to the start or
|
|
114
|
-
just modifying the value */
|
|
115
|
-
let value = this.value,
|
|
116
|
-
endTotal = value.end,
|
|
117
|
-
startValue = value.start;
|
|
118
|
-
if(value.combining === true)
|
|
119
|
-
{
|
|
120
|
-
endTotal = (this.getString(endValue).indexOf("-") === -1)? (startValue + endTotal) : startValue - endTotal;
|
|
121
|
-
}
|
|
122
|
-
return (endTotal >= startValue);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
combindValue(delta)
|
|
126
|
-
{
|
|
127
|
-
return (this.value.end * delta);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
calcValue(delta)
|
|
131
|
-
{
|
|
132
|
-
return (this.value.difference * delta);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/* this will setup theproper method to step the
|
|
136
|
-
value by checking for combining and currying
|
|
137
|
-
theproper function to step the value.
|
|
138
|
-
@param (number) delta
|
|
139
|
-
@return (number) the value step */
|
|
140
|
-
step(delta)
|
|
141
|
-
{
|
|
142
|
-
let step,
|
|
143
|
-
value = this.value;
|
|
144
|
-
if(value.combining === true)
|
|
145
|
-
{
|
|
146
|
-
step = this.combindValue;
|
|
147
|
-
}
|
|
148
|
-
else
|
|
149
|
-
{
|
|
150
|
-
step = this.calcValue;
|
|
151
|
-
}
|
|
152
|
-
return (this.step = step).apply(this, base.listToArray(arguments));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
update(delta)
|
|
156
|
-
{
|
|
157
|
-
let step = this.step(delta),
|
|
158
|
-
value = this.value;
|
|
159
|
-
|
|
160
|
-
/* we want to check to add or subtract the step
|
|
161
|
-
by the increase prop */
|
|
162
|
-
return this.applyStep(value, step);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
increaseValue(value, step)
|
|
166
|
-
{
|
|
167
|
-
let start = value.start;
|
|
168
|
-
return (start + step) + value.units;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
decreaseValue(value, step)
|
|
172
|
-
{
|
|
173
|
-
let start = value.start;
|
|
174
|
-
return (start - step) + value.units;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/* this will setup the proper method to apply the
|
|
178
|
-
step by checking for increasing and currying
|
|
179
|
-
the proper function to applyu the step value.
|
|
180
|
-
@param (object) value
|
|
181
|
-
@return (number) the value step */
|
|
182
|
-
applyStep(value, step)
|
|
183
|
-
{
|
|
184
|
-
let applyStep = (value.increasing === true)? this.increaseValue : this.decreaseValue;
|
|
185
|
-
return (this.applyStep = applyStep).apply(this, base.listToArray(arguments));
|
|
186
|
-
}
|
|
187
|
-
}
|
package/es6/modules/atom/atom.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {Objects} from "../../shared/objects.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Atom
|
|
5
|
-
*
|
|
6
|
-
* This will create an interface for atoms to
|
|
7
|
-
* extend from a parent atom.
|
|
8
|
-
* @class
|
|
9
|
-
*/
|
|
10
|
-
export const Atom = function()
|
|
11
|
-
{
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This will extend the atom to a child atom.
|
|
17
|
-
* @static
|
|
18
|
-
* @param {(object|function)}
|
|
19
|
-
* @return {function} The child atom constructor.
|
|
20
|
-
*/
|
|
21
|
-
Atom.extend = function extend(childLayout)
|
|
22
|
-
{
|
|
23
|
-
let parent = this;
|
|
24
|
-
|
|
25
|
-
/*
|
|
26
|
-
this will setup a layout function to call to standardize
|
|
27
|
-
the interface for non function atoms.
|
|
28
|
-
*/
|
|
29
|
-
if(typeof childLayout === 'object')
|
|
30
|
-
{
|
|
31
|
-
let layoutObject = childLayout;
|
|
32
|
-
childLayout = (props) =>
|
|
33
|
-
{
|
|
34
|
-
return Objects.cloneObject(layoutObject);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const child = (props = {}) =>
|
|
39
|
-
{
|
|
40
|
-
props = props || {};
|
|
41
|
-
let layout = childLayout(props),
|
|
42
|
-
|
|
43
|
-
// we want to check to merge the layout with the parent layout
|
|
44
|
-
parentLayout = parent(props);
|
|
45
|
-
if(typeof parentLayout === 'object')
|
|
46
|
-
{
|
|
47
|
-
layout = Objects.extendObject(parentLayout, layout);
|
|
48
|
-
}
|
|
49
|
-
return layout;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
child.extend = extend;
|
|
53
|
-
return child;
|
|
54
|
-
};
|