dbm 1.4.9 → 1.4.12
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/core/BaseObject.js +1 -1
- package/flow/FlowProperty.js +14 -1
- package/flow/index.js +28 -0
- package/flow/updatefunctions/dom/WindowSize.js +33 -0
- package/flow/updatefunctions/dom/index.js +2 -1
- package/node/communication/index.js +3 -1
- package/package.json +1 -1
- package/react/BaseObject.js +1 -1
- package/updater/PropertyUpdater.js +4 -0
- package/updater/index.js +10 -6
- package/utils/MathFunctions.js +15 -0
- package/utils/index.js +1 -0
package/core/BaseObject.js
CHANGED
|
@@ -44,7 +44,7 @@ export default class BaseObject extends Dbm.core.LifeCycleObject {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
addUpdateCallWhenMatched(aPropertyOrName, aMatchValue, aFunction, aArguments = []) {
|
|
47
|
-
console.log(this._propertyOrName(aPropertyOrName), aPropertyOrName, this);
|
|
47
|
+
//console.log(this._propertyOrName(aPropertyOrName), aPropertyOrName, this);
|
|
48
48
|
this._propertyOrName(aPropertyOrName).addUpdateWhenMatched(aMatchValue, this._getScopedCallFunctionCommand(aFunction, aArguments));
|
|
49
49
|
}
|
|
50
50
|
|
package/flow/FlowProperty.js
CHANGED
|
@@ -48,18 +48,31 @@ export default class FlowProperty extends Dbm.flow.FlowBaseObject {
|
|
|
48
48
|
return this;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
addAdditionalAnimation(aFromValue, aToValue, aTime = 0.5, aDelay = 0, aEasing = null) {
|
|
52
52
|
Dbm.getInstance().repository.getItem("propertyUpdater").controller.addPropertyAnimation(this, aFromValue, aToValue, aTime, aDelay, aEasing);
|
|
53
53
|
|
|
54
54
|
return this;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
addAddionalAnimation(aFromValue, aToValue, aTime = 0.5, aDelay = 0, aEasing = null) {
|
|
58
|
+
//METODO: warning message
|
|
59
|
+
this.addAdditionalAnimation(aFromValue, aToValue, aTime, aDelay, aEasing);
|
|
60
|
+
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
|
|
57
64
|
delayValue(aToValue, aDelay = 0) {
|
|
58
65
|
Dbm.getInstance().repository.getItem("propertyUpdater").controller.delayUpdateProperty(this, aToValue, aDelay);
|
|
59
66
|
|
|
60
67
|
return this;
|
|
61
68
|
}
|
|
62
69
|
|
|
70
|
+
addDelayValue(aToValue, aDelay = 0) {
|
|
71
|
+
Dbm.getInstance().repository.getItem("propertyUpdater").controller.addDelayUpdateProperty(this, aToValue, aDelay);
|
|
72
|
+
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
|
|
63
76
|
getMostUpstreamProperty() {
|
|
64
77
|
|
|
65
78
|
let debugCounter = 0;
|
package/flow/index.js
CHANGED
|
@@ -92,4 +92,32 @@ export const externalObject = function(aObject) {
|
|
|
92
92
|
returnObject.item.properties.object.setOrConnect(aObject);
|
|
93
93
|
|
|
94
94
|
return returnObject;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const dynamicUpdateFunction = function(aFunction, aInputs = {}, aOutputs = {}) {
|
|
98
|
+
|
|
99
|
+
let inputs = {...aInputs};
|
|
100
|
+
let outputs = {...aOutputs};
|
|
101
|
+
|
|
102
|
+
let TheClass = class DynamicUpdateFunction extends Dbm.flow.FlowUpdateFunction {
|
|
103
|
+
_construct() {
|
|
104
|
+
super._construct();
|
|
105
|
+
|
|
106
|
+
for(let objectName in inputs) {
|
|
107
|
+
this.input.register(objectName, inputs[objectName]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
for(let objectName in outputs) {
|
|
111
|
+
this.output.register(objectName, outputs[objectName]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
_update() {
|
|
116
|
+
//MENOTE: dynamically replaced
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
TheClass.prototype._update = aFunction;
|
|
121
|
+
|
|
122
|
+
return new TheClass();
|
|
95
123
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Dbm from "../../../index.js";
|
|
2
|
+
|
|
3
|
+
export default class WindowSize extends Dbm.flow.FlowUpdateFunction {
|
|
4
|
+
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.output.register("width", window.innerWidth);
|
|
9
|
+
this.output.register("height", window.innerHeight);
|
|
10
|
+
|
|
11
|
+
this._callback_sizeChangedBound = this._callback_sizeChanged.bind(this);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
start() {
|
|
15
|
+
window.addEventListener("resize", this._callback_sizeChangedBound, false);
|
|
16
|
+
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_update() {
|
|
21
|
+
//console.log("_update");
|
|
22
|
+
|
|
23
|
+
this.output.width = window.innerWidth;
|
|
24
|
+
this.output.height = window.innerHeight;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
_callback_sizeChanged(aEvent) {
|
|
28
|
+
//console.log("_callback_sizeChanged");
|
|
29
|
+
|
|
30
|
+
this.output.properties.width._internal_setValueInFlowOutsideOfUpdate(window.innerWidth);
|
|
31
|
+
this.output.properties.height._internal_setValueInFlowOutsideOfUpdate(window.innerHeight);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -2,4 +2,5 @@ export {default as ElementSize} from "./ElementSize.js";
|
|
|
2
2
|
export {default as StyleObject} from "./StyleObject.js";
|
|
3
3
|
export {default as HorizontalFlip} from "./HorizontalFlip.js";
|
|
4
4
|
export {default as ElementPosition} from "./ElementPosition.js";
|
|
5
|
-
export {default as TransformStyle} from "./TransformStyle.js";
|
|
5
|
+
export {default as TransformStyle} from "./TransformStyle.js";
|
|
6
|
+
export {default as WindowSize} from "./WindowSize.js";
|
|
@@ -70,11 +70,13 @@ export const sendEmailTemplate = async function(aTemplateIdentifer, aTo, aKeywor
|
|
|
70
70
|
content = designKeywordReplace.replaceKeywords(mailContent);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
await sendEmail(aTo, subject, content, aFrom, aAdditionalData);
|
|
73
|
+
return await sendEmail(aTo, subject, content, aFrom, aAdditionalData);
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
76
|
console.warn("No email template " + aTemplateIdentifer);
|
|
77
77
|
}
|
|
78
|
+
|
|
79
|
+
return null;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
export const createPostmarkClient = function(aToken, aDefaultFromEmail = null) {
|
package/package.json
CHANGED
package/react/BaseObject.js
CHANGED
|
@@ -251,7 +251,7 @@ export default class BaseObject extends Component {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
addUpdateCallWhenMatched(aPropertyOrName, aMatchValue, aFunction, aArguments = []) {
|
|
254
|
-
console.log(this._propertyOrName(aPropertyOrName), aPropertyOrName);
|
|
254
|
+
//console.log(this._propertyOrName(aPropertyOrName), aPropertyOrName);
|
|
255
255
|
this._propertyOrName(aPropertyOrName).addUpdateWhenMatched(aMatchValue, this._getScopedCallFunctionCommand(aFunction, aArguments));
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -147,6 +147,10 @@ export default class PropertyUpdater extends Dbm.core.BaseObject {
|
|
|
147
147
|
this._currentTweens.get(aProperty).stop();
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
return this.addDelayUpdateProperty(aProperty, aToValue, aDelay);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
addDelayUpdateProperty(aProperty, aToValue, aDelay = 0) {
|
|
150
154
|
let tweenObject = {"envelope": aProperty.value};
|
|
151
155
|
|
|
152
156
|
let tween = new Tween(tweenObject).to({"envelope": aToValue}, 0).delay(1000*aDelay).onUpdate(function(aData) {
|
package/updater/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Easing } from "@tweenjs/tween.js";
|
|
1
2
|
import Dbm from "../index.js";
|
|
2
3
|
|
|
3
4
|
export {default as PropertyUpdater} from "./PropertyUpdater.js";
|
|
4
5
|
export {default as RequestAnimationFrameTimer} from "./RequestAnimationFrameTimer.js";
|
|
5
6
|
export {default as IntervalTimer} from "./IntervalTimer.js";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
export const webSetup = function() {
|
|
8
9
|
let updater = new Dbm.updater.PropertyUpdater();
|
|
9
10
|
updater.item.register("propertyUpdater");
|
|
10
11
|
|
|
@@ -14,9 +15,14 @@ let webSetup = function() {
|
|
|
14
15
|
updater.start();
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export {
|
|
18
|
+
export const setupEasingFunctions = function() {
|
|
19
|
+
let item = Dbm.getRepositoryItem("easingFunctions");
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
item.setValue("easeOut", Easing.Quadratic.Out);
|
|
22
|
+
item.setValue("easeIn", Easing.Quadratic.In);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const nodeSetup = function() {
|
|
20
26
|
let updater = new Dbm.updater.PropertyUpdater();
|
|
21
27
|
updater.item.register("propertyUpdater");
|
|
22
28
|
|
|
@@ -24,6 +30,4 @@ let nodeSetup = function() {
|
|
|
24
30
|
updater.setTimer(timer.item);
|
|
25
31
|
|
|
26
32
|
updater.start();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export {nodeSetup};
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const clamp = function(aValue, aMinValue = 0, aMaxValue = 1) {
|
|
2
|
+
return Math.max(Math.min(aValue, aMaxValue), aMinValue);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export const parametricValue = function(aValue, aStartValue, aEndValue) {
|
|
6
|
+
return (aValue-aStartValue)/(aEndValue-aStartValue);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const clampedParametricValue = function(aValue, aStartValue, aEndValue) {
|
|
10
|
+
return clamp(parametricValue(aValue, aStartValue, aEndValue), 0, 1);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const linearInerpolation = function(aParameter, aStartValue, aEndValue) {
|
|
14
|
+
return (1-aParameter)*aStartValue+aParameter*aEndValue;
|
|
15
|
+
}
|
package/utils/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * as TranslationFunctions from "./TranslationFunctions.js";
|
|
|
7
7
|
export * as LevenshteinDistance from "./LevenshteinDistance.js";
|
|
8
8
|
export * as ObjectFunctions from "./ObjectFunctions.js";
|
|
9
9
|
export * as LocalCache from "./LocalCache.js";
|
|
10
|
+
export * as MathFunctions from "./MathFunctions.js";
|
|
10
11
|
|
|
11
12
|
export {default as MultidimensionalArrayHolder} from "./MultidimensionalArrayHolder.js";
|
|
12
13
|
export {default as ArrayOperationResult} from "./ArrayOperationResult.js";
|