dothtml 4.8.5 → 5.0.1
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/{jest.config.js → jest.config.ts} +19 -16
- package/lib/arg-callback-obj.d.ts +29 -0
- package/lib/built-in-components/nav-link.d.ts +8 -0
- package/lib/built-in-components/router.d.ts +57 -0
- package/lib/component.d.ts +73 -0
- package/lib/dot-component-legacy.d.ts +0 -0
- package/lib/dot-document.d.ts +0 -0
- package/lib/dot-util.d.ts +13 -0
- package/lib/dot.d.ts +5 -0
- package/lib/dothtml.d.ts +21 -0
- package/lib/dothtml.js +2 -0
- package/lib/dothtml.js.LICENSE.txt +1 -0
- package/lib/err.d.ts +2 -0
- package/lib/event-bus.d.ts +10 -0
- package/lib/i-dot.d.ts +674 -0
- package/lib/i-dotcss.d.ts +827 -0
- package/lib/node-polyfill.d.ts +2 -0
- package/lib/observable-array.d.ts +49 -0
- package/lib/style-builder.d.ts +3 -0
- package/package.json +11 -5
- package/readme.md +3 -2
- package/src/{arg-callback-obj.js → arg-callback-obj.ts} +18 -6
- package/src/built-in-components/nav-link.ts +21 -0
- package/src/built-in-components/router.ts +315 -0
- package/src/component.ts +369 -0
- package/src/dot-component-legacy.ts +79 -0
- package/src/dot-document.ts +0 -0
- package/src/dot-util.ts +33 -0
- package/src/dot.ts +1147 -0
- package/src/dothtml.ts +33 -0
- package/src/err.ts +22 -0
- package/src/event-bus.ts +39 -0
- package/src/i-dot.ts +787 -0
- package/src/i-dotcss.ts +918 -0
- package/src/node-polyfill.ts +11 -0
- package/src/{observable-array.js → observable-array.ts} +10 -5
- package/src/{style-builder.js → style-builder.ts} +219 -183
- package/tsconfig.json +99 -0
- package/unittests/advanced-bindings.test.ts +421 -0
- package/unittests/{array-evaluation.test.js → array-evaluation.test.ts} +1 -1
- package/unittests/{basic-functionality.test.js → basic-functionality.test.ts} +14 -10
- package/unittests/class-binding.test.ts +227 -0
- package/unittests/component-decorator.-.ts +14 -0
- package/unittests/components-data.test.ts +153 -0
- package/unittests/components.test.ts +257 -0
- package/unittests/computed.test.ts +35 -0
- package/unittests/{core.js → core.ts} +5 -2
- package/unittests/element-and-attribute-coverage.test.ts +472 -0
- package/unittests/hooks.test.ts +67 -0
- package/unittests/immutable-if.test.ts +19 -0
- package/unittests/input-bindings.test.ts +166 -0
- package/unittests/integration.test.ts +5 -0
- package/unittests/{iterations.test.js → iterations.test.ts} +5 -5
- package/unittests/logic.test.ts +18 -0
- package/unittests/refs.test.ts +36 -0
- package/unittests/routing.-.ts +56 -0
- package/unittests/{scopes.test.js → scopes.test.ts} +5 -5
- package/unittests/special-tags.test.ts +39 -0
- package/unittests/styles.test.ts +9 -0
- package/unittests/{testpage.js → testpage.ts} +2 -0
- package/unittests/{wait.test.js → wait.test.ts} +8 -5
- package/webpack.config.js +13 -1
- package/lib/dothtml.min.js +0 -1
- package/src/component.js +0 -305
- package/src/err.js +0 -20
- package/src/event-bus.js +0 -40
- package/src/index.js +0 -1453
- package/src/util.js +0 -13
- package/unittests/advanced-bindings.test.js +0 -386
- package/unittests/class-binding.test.js +0 -53
- package/unittests/components-data.test.js +0 -97
- package/unittests/components.test.js +0 -151
- package/unittests/computed.test.js +0 -36
- package/unittests/hooks.test.js +0 -57
- package/unittests/immutable-if.test.js +0 -15
- package/unittests/input-bindings.test.js +0 -155
- package/unittests/integration.test.js +0 -6
- package/unittests/logic.test.js +0 -18
- package/unittests/routing.-.js +0 -56
- package/unittests/special-tags.test.js +0 -32
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import IDotCss, { HideParams, LengthProp, ShowParams } from "./i-dotcss";
|
|
4
|
+
|
|
3
5
|
//Latest Update.
|
|
4
6
|
/*
|
|
5
7
|
* - Wrapped code in anonymous function.
|
|
@@ -8,13 +10,15 @@
|
|
|
8
10
|
* - Allowed 0-length animations.
|
|
9
11
|
*/
|
|
10
12
|
|
|
13
|
+
const STATIC_SYLES_ATTR = "data-dot-static-styles";
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
const dotcss: IDotCss = function(query){
|
|
13
16
|
//this.currentCss = "";
|
|
14
17
|
var target = null;
|
|
15
18
|
if(query){
|
|
16
19
|
// console.log(query, "?");
|
|
17
|
-
if(typeof query == "string" ) {
|
|
20
|
+
if( typeof query == "string" ) {
|
|
21
|
+
// Creating a style tag. Might not be supported forever.
|
|
18
22
|
if(query.length > 2 && query.indexOf("{}") == query.length - 2){
|
|
19
23
|
query = query.substring(0, query.length - 2);
|
|
20
24
|
target = [document.createElement("style")];
|
|
@@ -30,53 +34,60 @@ var dotcss = function(query){
|
|
|
30
34
|
// iff it is in the list of elements queried from its parent.
|
|
31
35
|
// In addition to all of that, we don't want scoped styles to be applied to child components.
|
|
32
36
|
var s0 = scopeStack[0];
|
|
33
|
-
|
|
37
|
+
// if(s0 instanceof Component){
|
|
38
|
+
// s0 = s0.$el;
|
|
39
|
+
// }
|
|
34
40
|
// If we're doing scoped, and it's an element.
|
|
35
41
|
if(s0 && s0.parentNode && s0.querySelectorAll){
|
|
36
|
-
|
|
42
|
+
// console.log(s0);
|
|
37
43
|
target = getScopedNodeList(query, s0);
|
|
38
44
|
}
|
|
39
45
|
else{
|
|
40
|
-
target = document.querySelectorAll(query);
|
|
46
|
+
target = document.querySelectorAll(query as string);
|
|
41
47
|
}
|
|
42
48
|
// target = referencePt.querySelectorAll(query);
|
|
43
49
|
}
|
|
44
50
|
}
|
|
51
|
+
|
|
45
52
|
if((query instanceof NodeList) || (query instanceof Array)) target = query;
|
|
46
53
|
if(query instanceof Node) target = [query]; //Doesn't need to be a NodeList. Just iterable.
|
|
47
54
|
}
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
};
|
|
55
|
+
dotcss2._lastBuilder = new _Builder(target);
|
|
56
|
+
return dotcss2._lastBuilder;
|
|
57
|
+
} as IDotCss;
|
|
58
|
+
|
|
59
|
+
// Easier way to extend dotcss with private methods without type concerns.
|
|
60
|
+
const dotcss2 = dotcss as any;
|
|
51
61
|
|
|
52
|
-
dotcss.version = "0.
|
|
62
|
+
dotcss.version = "0.16.0";
|
|
53
63
|
|
|
54
64
|
//Inverse of framerate in ms/frame.
|
|
55
|
-
|
|
65
|
+
dotcss2._fxInterval = 1000 / 60;
|
|
56
66
|
|
|
57
|
-
|
|
67
|
+
dotcss2._lastBuilder = null;
|
|
58
68
|
|
|
59
|
-
|
|
69
|
+
dotcss2._floatRegex = new RegExp("[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?", "g");
|
|
60
70
|
|
|
61
71
|
var scopeStack = [];
|
|
62
72
|
|
|
63
|
-
function getScopedNodeList(query, s0){
|
|
73
|
+
function getScopedNodeList(query: String, s0: Element): Array<HTMLElement>{
|
|
64
74
|
// Get all of the matching child elements of the component. This will not include s0 itself, but it does include nested components.
|
|
65
75
|
// So we will need to manipulate this collection.
|
|
66
76
|
// querySelectorAll returns a NodeList, which we need to convert into an Array.
|
|
67
|
-
var target = Array.from(s0.querySelectorAll(query));
|
|
77
|
+
var target = Array.from(s0.querySelectorAll(query as any));
|
|
78
|
+
// console.log(query, s0.className);
|
|
68
79
|
|
|
69
80
|
// Exclude nested components.
|
|
70
81
|
for(var t = 0; t < target.length; t++){
|
|
71
82
|
var T = target[t];
|
|
72
83
|
|
|
73
84
|
// Is it a nested component??
|
|
74
|
-
if(T
|
|
85
|
+
if(T["__dothtml_component"]){
|
|
75
86
|
// It's a component. Remove it, and all of it's descendants.
|
|
76
87
|
target.splice(t, 1);
|
|
77
88
|
t--;
|
|
78
89
|
|
|
79
|
-
var subTargets = T.querySelectorAll(query);
|
|
90
|
+
var subTargets = T.querySelectorAll(query as any);
|
|
80
91
|
for(var s = 0; s < subTargets.length; s++){
|
|
81
92
|
let S = subTargets[s];
|
|
82
93
|
target.splice(target.indexOf(S, t + 1), 1);
|
|
@@ -85,7 +96,7 @@ function getScopedNodeList(query, s0){
|
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
// Loop through all the sibling nodes until we find s0.
|
|
88
|
-
var parentTargets = Array.from(s0.parentNode.querySelectorAll(query));
|
|
99
|
+
var parentTargets = Array.from(s0.parentNode.querySelectorAll(query as any));
|
|
89
100
|
|
|
90
101
|
var p = parentTargets.indexOf(s0);
|
|
91
102
|
if(p != -1){
|
|
@@ -95,17 +106,17 @@ function getScopedNodeList(query, s0){
|
|
|
95
106
|
return target;
|
|
96
107
|
}
|
|
97
108
|
|
|
98
|
-
function _Builder(target){
|
|
109
|
+
function _Builder(target?: string|Element){
|
|
99
110
|
this.currentCss = "";
|
|
100
111
|
this.target = target;
|
|
101
112
|
}
|
|
102
113
|
|
|
103
|
-
|
|
114
|
+
dotcss2._Builder = _Builder;
|
|
104
115
|
|
|
105
116
|
var _b = _Builder.prototype;
|
|
106
117
|
|
|
107
118
|
_b.toString = dotcss.prototype.toString = function(){
|
|
108
|
-
// console.log("CALLED TOSTRING!");
|
|
119
|
+
// console.log("CALLED TOSTRING!", this.currentCss);
|
|
109
120
|
return this.currentCss;
|
|
110
121
|
};
|
|
111
122
|
|
|
@@ -121,16 +132,18 @@ _b.toString = dotcss.prototype.toString = function(){
|
|
|
121
132
|
// animationStyle: linear or exponential
|
|
122
133
|
_b.hide = function(){
|
|
123
134
|
if(this.target){
|
|
124
|
-
var arg0 = arguments[0] || {};
|
|
125
|
-
var
|
|
126
|
-
|
|
135
|
+
var arg0: HideParams|number = arguments[0] || {};
|
|
136
|
+
var arg0N = arg0 as number;
|
|
137
|
+
var arg0O = arg0 as HideParams;
|
|
138
|
+
var ops: HideParams = {};
|
|
139
|
+
ops.duration = arg0O.duration || (isNaN(arg0N) ? 0 : arg0N) || 0;
|
|
127
140
|
//ops.display = arg0.display || "none";
|
|
128
141
|
//ops.opacity = arg0.opacity || null;
|
|
129
142
|
//ops.width = arg0.width || null;
|
|
130
143
|
//ops.height = arg0.height || null;
|
|
131
|
-
ops.complete =
|
|
132
|
-
ops.hideStyle =
|
|
133
|
-
ops.animationStyle =
|
|
144
|
+
ops.complete = arg0O.complete || (typeof arguments[1] == "function" ? arguments[1] : (typeof arguments[2] == "function" ? arguments[2] : function(){}));
|
|
145
|
+
ops.hideStyle = arg0O.hideStyle || "normal";
|
|
146
|
+
ops.animationStyle = arg0O.animationStyle || (typeof arguments[1] == "string" ? arguments[1] as any : "ease");
|
|
134
147
|
|
|
135
148
|
if(ops.duration > 0){
|
|
136
149
|
var doneCnt = 0;
|
|
@@ -191,15 +204,17 @@ _b.hide = function(){
|
|
|
191
204
|
_b.show = function(){
|
|
192
205
|
if(this.target){
|
|
193
206
|
var arg0 = arguments[0] || {};
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
ops
|
|
197
|
-
ops.
|
|
198
|
-
ops.
|
|
199
|
-
ops.
|
|
200
|
-
ops.
|
|
201
|
-
ops.
|
|
202
|
-
ops.
|
|
207
|
+
var arg0N = arg0 as number;
|
|
208
|
+
var arg0O = arg0 as ShowParams;
|
|
209
|
+
var ops: ShowParams = {};
|
|
210
|
+
ops.duration = arg0O.duration || (isNaN(arg0N) ? 0 : arg0N) || 0;
|
|
211
|
+
ops.display = arg0O.display || "block";
|
|
212
|
+
ops.opacity = arg0O.opacity;
|
|
213
|
+
ops.width = arg0O.width || null;
|
|
214
|
+
ops.height = arg0O.height || null;
|
|
215
|
+
ops.complete = arg0O.complete || (typeof arguments[1] == "function" ? arguments[1] : (typeof arguments[2] == "function" ? arguments[2] : function(){}));
|
|
216
|
+
ops.showStyle = arg0O.showStyle || "normal";
|
|
217
|
+
ops.animationStyle = arg0O.animationStyle || (typeof arguments[1] == "string" ? arguments[1] as any : "ease");
|
|
203
218
|
|
|
204
219
|
if(ops.duration > 0){
|
|
205
220
|
var doneCnt = 0;
|
|
@@ -256,7 +271,7 @@ _b.fadeIn = function(duration, complete){
|
|
|
256
271
|
};
|
|
257
272
|
|
|
258
273
|
//TYPES:
|
|
259
|
-
|
|
274
|
+
dotcss2._Url = function(value){
|
|
260
275
|
this.type = "url";
|
|
261
276
|
this.url = null;
|
|
262
277
|
if(!value || value.length == 0 || (value.length == 1 && value[0] == "" || value[0] == "none" || value[0] == "initial" || value[0] == "inherit")){
|
|
@@ -267,10 +282,10 @@ dotcss._Url = function(value){
|
|
|
267
282
|
for(var i = 0; i < value.length; i++){
|
|
268
283
|
var currentURL = "";
|
|
269
284
|
if(value[i].toLowerCase().indexOf("url") === 0){
|
|
270
|
-
var url = value[i].substring(indexOf("("), lastIndexOf(")")).trim();
|
|
285
|
+
var url = value[i].substring(value[i].indexOf("("), value[i].lastIndexOf(")")).trim();
|
|
271
286
|
if((url.indexOf("\"") && url.lastIndexOf("\"") == url.length - 1) ||
|
|
272
287
|
(url.indexOf("'") && url.lastIndexOf("'") == url.length - 1)){
|
|
273
|
-
url = url.substring(1,
|
|
288
|
+
url = url.substring(1, url.length - 1);
|
|
274
289
|
}
|
|
275
290
|
this.url.push(url);
|
|
276
291
|
}
|
|
@@ -281,7 +296,7 @@ dotcss._Url = function(value){
|
|
|
281
296
|
}
|
|
282
297
|
}
|
|
283
298
|
|
|
284
|
-
|
|
299
|
+
dotcss2._Url.prototype.toString = function(){
|
|
285
300
|
if(!this.url) return "none";
|
|
286
301
|
else
|
|
287
302
|
{
|
|
@@ -293,7 +308,7 @@ dotcss._Url.prototype.toString = function(){
|
|
|
293
308
|
}
|
|
294
309
|
}
|
|
295
310
|
|
|
296
|
-
|
|
311
|
+
dotcss2._Color = function(value){
|
|
297
312
|
this.type = "color";
|
|
298
313
|
this.r = 0;
|
|
299
314
|
this.g = 0;
|
|
@@ -506,7 +521,7 @@ dotcss._Color = function(value){
|
|
|
506
521
|
|
|
507
522
|
}
|
|
508
523
|
|
|
509
|
-
|
|
524
|
+
dotcss2._Color.prototype.toString = function(){
|
|
510
525
|
var R = Math.round;
|
|
511
526
|
var X = Math.max;
|
|
512
527
|
var N = Math.min;
|
|
@@ -517,31 +532,31 @@ dotcss._Color.prototype.toString = function(){
|
|
|
517
532
|
}
|
|
518
533
|
|
|
519
534
|
//TODO: this should support multiple lengths.
|
|
520
|
-
|
|
535
|
+
dotcss2._Length = function(value){
|
|
521
536
|
value = value || "0px";
|
|
522
537
|
if(!isNaN(value)) value = Math.round(value) + "px";
|
|
523
538
|
this.type = "length";
|
|
524
|
-
this.length = Number(value.match(
|
|
525
|
-
this.units = value.split(
|
|
539
|
+
this.length = Number(value.match(dotcss2._floatRegex)[0]);
|
|
540
|
+
this.units = value.split(dotcss2._floatRegex)[1] || "px";
|
|
526
541
|
}
|
|
527
542
|
|
|
528
|
-
|
|
543
|
+
dotcss2._Length.prototype.toString = function(){
|
|
529
544
|
return this.length + this.units;
|
|
530
545
|
}
|
|
531
546
|
|
|
532
|
-
|
|
547
|
+
dotcss2._Angle = function(value){
|
|
533
548
|
value = value || "0deg";
|
|
534
549
|
if(!isNaN(value)) value = Math.round(value) + "px";
|
|
535
550
|
this.type = "angle";
|
|
536
|
-
this.angle = Number(value.match(
|
|
537
|
-
this.units = value.split(
|
|
551
|
+
this.angle = Number(value.match(dotcss2._floatRegex)[0]);
|
|
552
|
+
this.units = value.split(dotcss2._floatRegex)[1] || "deg";
|
|
538
553
|
}
|
|
539
554
|
|
|
540
|
-
|
|
555
|
+
dotcss2._Angle.prototype.toString = function(){
|
|
541
556
|
return this.angle + this.units;
|
|
542
557
|
}
|
|
543
558
|
|
|
544
|
-
|
|
559
|
+
dotcss2._Transform = function(value){
|
|
545
560
|
this.type = "transformation";
|
|
546
561
|
this.transformations = [];
|
|
547
562
|
//this.finalMatrix = [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];
|
|
@@ -564,7 +579,7 @@ dotcss._Transform = function(value){
|
|
|
564
579
|
}
|
|
565
580
|
}
|
|
566
581
|
|
|
567
|
-
|
|
582
|
+
dotcss2._Transform.prototype.toString = function(){
|
|
568
583
|
var ret = "";
|
|
569
584
|
for(var i = 0; i < this.transformations.length; i++){
|
|
570
585
|
var t = this.transformations[i];
|
|
@@ -578,7 +593,7 @@ dotcss._Transform.prototype.toString = function(){
|
|
|
578
593
|
return ret.trim();
|
|
579
594
|
}
|
|
580
595
|
|
|
581
|
-
|
|
596
|
+
dotcss2._Transform.prototype._updateValue = function(transformation, args){
|
|
582
597
|
//this.finalMatrix = dotcss.matrixMultiply3D(m, this.finalMatrix);
|
|
583
598
|
this.transformations.push({transformation: transformation, args: args});
|
|
584
599
|
/*if(this.value.length > 0) this.value += " ";
|
|
@@ -588,18 +603,18 @@ dotcss._Transform.prototype._updateValue = function(transformation, args){
|
|
|
588
603
|
}*/
|
|
589
604
|
}
|
|
590
605
|
|
|
591
|
-
|
|
592
|
-
var p =
|
|
606
|
+
dotcss2._Transform.prototype.matrix3d = function(...value: Array<number>){
|
|
607
|
+
var p = value;
|
|
593
608
|
if(p.length == 16){
|
|
594
609
|
this.finalMatrix = dotcss.matrixMultiply3D(p, this.finalMatrix);
|
|
595
|
-
this._updateValue("matrix3d",
|
|
610
|
+
this._updateValue("matrix3d", p);
|
|
596
611
|
}
|
|
597
612
|
else throw "matrix3d requires 16 parameters.";
|
|
598
613
|
return this;
|
|
599
614
|
}
|
|
600
615
|
|
|
601
|
-
|
|
602
|
-
var p =
|
|
616
|
+
dotcss2._Transform.prototype.matrix = function(...value: Array<number>){
|
|
617
|
+
var p = value;
|
|
603
618
|
if(p.length == 6){
|
|
604
619
|
this._updateValue("matrix", p/*, [p[0], p[1], 0, 0, p[2], p[3], 0, 0, 0, 0, 1, 0, p[4], p[5], 0, 1]*/);
|
|
605
620
|
}
|
|
@@ -610,68 +625,68 @@ dotcss._Transform.prototype.matrix = function(){
|
|
|
610
625
|
return this;
|
|
611
626
|
}
|
|
612
627
|
|
|
613
|
-
|
|
628
|
+
dotcss2._Transform.prototype.translate = function(){
|
|
614
629
|
var p = arguments;
|
|
615
630
|
if(p.length == 1){
|
|
616
631
|
var x = dotcss.lengthToPx(p[0]);
|
|
617
|
-
this._updateValue("translate", [new
|
|
632
|
+
this._updateValue("translate", [new dotcss2._Length(x + "px")]/*, [1,0,0,0,0,1,0,0,0,0,1,0,x,0,0,1]*/);
|
|
618
633
|
}
|
|
619
634
|
else if(p.length == 2){
|
|
620
635
|
var x = dotcss.lengthToPx(p[0]);
|
|
621
636
|
var y = dotcss.lengthToPx(p[1]);
|
|
622
|
-
this._updateValue("translate", [new
|
|
637
|
+
this._updateValue("translate", [new dotcss2._Length(x + "px"), new dotcss2._Length(y + "px")]/*, [1,0,0,0,0,1,0,0,0,0,1,0,x,y,0,1]*/);
|
|
623
638
|
}
|
|
624
639
|
else if(p.length == 3) this.translate3d.apply(this, p);
|
|
625
640
|
else throw "translate requires 1 or 2 parameters.";
|
|
626
641
|
return this;
|
|
627
642
|
}
|
|
628
643
|
|
|
629
|
-
|
|
644
|
+
dotcss2._Transform.prototype.translate3d = function(){
|
|
630
645
|
var p = arguments;
|
|
631
646
|
if(p.length == 3){
|
|
632
647
|
var x = dotcss.lengthToPx(p[0]);
|
|
633
648
|
var y = dotcss.lengthToPx(p[1]);
|
|
634
649
|
var z = dotcss.lengthToPx(p[2]);
|
|
635
|
-
this._updateValue("translate3d", [new
|
|
650
|
+
this._updateValue("translate3d", [new dotcss2._Length(x + "px"), new dotcss2._Length(y + "px"), new dotcss2._Length(z + "px")]/*, [1,0,0,0,0,1,0,0,0,0,1,0,x,y,z,1]*/);
|
|
636
651
|
}
|
|
637
652
|
else throw "translate3d requires 3 parameters.";
|
|
638
653
|
return this;
|
|
639
654
|
}
|
|
640
655
|
|
|
641
|
-
|
|
656
|
+
dotcss2._Transform.prototype.translateX = function(){
|
|
642
657
|
var p = arguments;
|
|
643
658
|
if(p.length == 1){
|
|
644
659
|
//var x = dotcss.lengthToPx(p[0]);
|
|
645
|
-
//this._updateValue("translateX", [new
|
|
660
|
+
//this._updateValue("translateX", [new dotcss2._Length(x + "px")]/*, [1,0,0,0,0,1,0,0,0,0,1,0,x,0,0,1]*/);
|
|
646
661
|
this.translate(p[0], 0);
|
|
647
662
|
}
|
|
648
663
|
else throw "translateX requires 1 parameter.";
|
|
649
664
|
return this;
|
|
650
665
|
}
|
|
651
666
|
|
|
652
|
-
|
|
667
|
+
dotcss2._Transform.prototype.translateY = function(){
|
|
653
668
|
var p = arguments;
|
|
654
669
|
if(p.length == 1){
|
|
655
670
|
//var y = dotcss.lengthToPx(p[0]);
|
|
656
|
-
//this._updateValue("translateY", [new
|
|
671
|
+
//this._updateValue("translateY", [new dotcss2._Length(y + "px")]/*, [1,0,0,0,0,1,0,0,0,0,1,0,0,y,0,1]*/);
|
|
657
672
|
this.translate(0, p[0]);
|
|
658
673
|
}
|
|
659
674
|
else throw "translateY requires 1 parameter.";
|
|
660
675
|
return this;
|
|
661
676
|
}
|
|
662
677
|
|
|
663
|
-
|
|
678
|
+
dotcss2._Transform.prototype.translateZ = function(){
|
|
664
679
|
var p = arguments;
|
|
665
680
|
if(p.length == 1){
|
|
666
681
|
//var z = dotcss.lengthToPx(p[0]);
|
|
667
|
-
//this._updateValue("translateZ", [new
|
|
682
|
+
//this._updateValue("translateZ", [new dotcss2._Length(z + "px")]/*, [1,0,0,0,0,1,0,0,0,0,1,0,0,0,z,1]*/);
|
|
668
683
|
this.translate3d(0, 0, p[0]);
|
|
669
684
|
}
|
|
670
685
|
else throw "translateZ requires 1 parameter.";
|
|
671
686
|
return this;
|
|
672
687
|
}
|
|
673
688
|
|
|
674
|
-
|
|
689
|
+
dotcss2._Transform.prototype.scale = function(){
|
|
675
690
|
var p = arguments;
|
|
676
691
|
if(p.length == 2){
|
|
677
692
|
this._updateValue("scale", p/*, [p[0],0,0,0,0,p[1],0,0,0,0,1,0,0,0,0,1]*/);
|
|
@@ -681,7 +696,7 @@ dotcss._Transform.prototype.scale = function(){
|
|
|
681
696
|
return this;
|
|
682
697
|
}
|
|
683
698
|
|
|
684
|
-
|
|
699
|
+
dotcss2._Transform.prototype.scale3d = function(){
|
|
685
700
|
var p = arguments;
|
|
686
701
|
if(p.length == 3){
|
|
687
702
|
this._updateValue("scale3d", p/*, [p[0],0,0,0,0,p[1],0,0,0,0,p[2],0,0,0,0,1]*/);
|
|
@@ -690,7 +705,7 @@ dotcss._Transform.prototype.scale3d = function(){
|
|
|
690
705
|
return this;
|
|
691
706
|
}
|
|
692
707
|
|
|
693
|
-
|
|
708
|
+
dotcss2._Transform.prototype.scaleX = function(){
|
|
694
709
|
var p = arguments;
|
|
695
710
|
if(p.length == 1){
|
|
696
711
|
//this._updateValue("scaleX", p/*, [p[0],0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]*/);
|
|
@@ -700,7 +715,7 @@ dotcss._Transform.prototype.scaleX = function(){
|
|
|
700
715
|
return this;
|
|
701
716
|
}
|
|
702
717
|
|
|
703
|
-
|
|
718
|
+
dotcss2._Transform.prototype.scaleY = function(){
|
|
704
719
|
var p = arguments;
|
|
705
720
|
if(p.length == 1){
|
|
706
721
|
//this._updateValue("scaleY", p/*, [1,0,0,0,0,p[0],0,0,0,0,1,0,0,0,0,1]*/);
|
|
@@ -710,7 +725,7 @@ dotcss._Transform.prototype.scaleY = function(){
|
|
|
710
725
|
return this;
|
|
711
726
|
}
|
|
712
727
|
|
|
713
|
-
|
|
728
|
+
dotcss2._Transform.prototype.scaleZ = function(){
|
|
714
729
|
var p = arguments;
|
|
715
730
|
if(p.length == 1){
|
|
716
731
|
//this._updateValue("scaleZ", p/*, [1,0,0,0,0,1,0,0,0,0,p[0],0,0,0,0,1]*/);
|
|
@@ -720,17 +735,17 @@ dotcss._Transform.prototype.scaleZ = function(){
|
|
|
720
735
|
return this;
|
|
721
736
|
}
|
|
722
737
|
|
|
723
|
-
|
|
738
|
+
dotcss2._Transform.prototype.rotate = function(){
|
|
724
739
|
var p = arguments;
|
|
725
740
|
if(p.length == 1){
|
|
726
741
|
var a = dotcss.angleToDeg(p[0]);
|
|
727
|
-
this._updateValue("rotate", [new
|
|
742
|
+
this._updateValue("rotate", [new dotcss2._Angle(a + "deg")]/*, [Math.cos(a),Math.sin(a),0,0,-Math.sin(axxx),Math.cos(axxx),0,0,0,0,1,0,0,0,0,1]*/);
|
|
728
743
|
}
|
|
729
744
|
else throw "scaleZ requires 1 parameter.";
|
|
730
745
|
return this;
|
|
731
746
|
}
|
|
732
747
|
|
|
733
|
-
|
|
748
|
+
dotcss2._Transform.prototype.rotate3d = function(){
|
|
734
749
|
var p = arguments;
|
|
735
750
|
if(p.length == 4){
|
|
736
751
|
var x = p[0];
|
|
@@ -739,7 +754,7 @@ dotcss._Transform.prototype.rotate3d = function(){
|
|
|
739
754
|
var a = dotcss.angleToDeg(p[3]);
|
|
740
755
|
/*var C = 1 - cos(axx);
|
|
741
756
|
var S = sin(axx);*/
|
|
742
|
-
this._updateValue("rotate3d", [x, y, z, new
|
|
757
|
+
this._updateValue("rotate3d", [x, y, z, new dotcss2._Angle(a + "deg")]/*,
|
|
743
758
|
[1+C*(x*x-1), z*S+x*y*C, -y*S+x*z*C, 0,
|
|
744
759
|
-z*S+x*y*C, 1+C*(y*y-1), x*S+y*z*C, 0,
|
|
745
760
|
y*S+x*z*C, -x*S+y*z*C, 1+C*(z*z-1), 0,
|
|
@@ -750,80 +765,80 @@ dotcss._Transform.prototype.rotate3d = function(){
|
|
|
750
765
|
return this;
|
|
751
766
|
}
|
|
752
767
|
|
|
753
|
-
|
|
768
|
+
dotcss2._Transform.prototype.rotateX = function(){
|
|
754
769
|
var p = arguments;
|
|
755
770
|
if(p.length == 1){
|
|
756
771
|
var a = dotcss.angleToDeg(p[0]);
|
|
757
|
-
this._updateValue("rotateX", [new
|
|
772
|
+
this._updateValue("rotateX", [new dotcss2._Angle(a + "deg")]/*, [1,0,0,0,0,Math.cos(axx),Math.sin(axx),0,0,-Math.sin(axx),Math.cos(axx),0,0,0,0,1]*/);
|
|
758
773
|
//this.rotate3d(1, 0, 0, p[0]);
|
|
759
774
|
}
|
|
760
775
|
else throw "rotateX requires 1 parameter.";
|
|
761
776
|
return this;
|
|
762
777
|
}
|
|
763
778
|
|
|
764
|
-
|
|
779
|
+
dotcss2._Transform.prototype.rotateY = function(){
|
|
765
780
|
var p = arguments;
|
|
766
781
|
if(p.length == 1){
|
|
767
782
|
//this might be faster:
|
|
768
783
|
var a = dotcss.angleToDeg(p[0]);
|
|
769
|
-
this._updateValue("rotateY", [new
|
|
784
|
+
this._updateValue("rotateY", [new dotcss2._Angle(a + "deg")]/*, [Math.cos(xxa),0,-Math.sin(axxx),0,0,1,0,0,Math.sin(xxx),0,Math.cos(xxx),0,0,0,0,1]*/);
|
|
770
785
|
//this.rotate3d(0, 1, 0, p[0]);
|
|
771
786
|
}
|
|
772
787
|
else throw "rotateY requires 1 parameter.";
|
|
773
788
|
return this;
|
|
774
789
|
}
|
|
775
790
|
|
|
776
|
-
|
|
791
|
+
dotcss2._Transform.prototype.rotateZ = function(){
|
|
777
792
|
this.rotate.apply(this, arguments);
|
|
778
793
|
return this;
|
|
779
794
|
}
|
|
780
795
|
|
|
781
|
-
|
|
796
|
+
dotcss2._Transform.prototype.skew = function(){
|
|
782
797
|
var p = arguments;
|
|
783
798
|
if(p.length == 1){
|
|
784
799
|
var ax = dotcss.angleToDeg(p[0]);
|
|
785
|
-
this._updateValue("skew", [new
|
|
800
|
+
this._updateValue("skew", [new dotcss2._Angle(ax + "deg")]/*, [1,0,0,0,Math.tan(axxxxx),1,0,0,0,0,1,0,0,0,0,1]*/);
|
|
786
801
|
}
|
|
787
802
|
else if(p.length == 2){
|
|
788
803
|
var ax = dotcss.angleToDeg(p[0]);
|
|
789
804
|
var ay = dotcss.angleToDeg(p[1]);
|
|
790
|
-
this._updateValue("skew", [new
|
|
805
|
+
this._updateValue("skew", [new dotcss2._Angle(ax + "deg"), new dotcss2._Angle(ay + "deg")]/*, [1,Math.tan(axxxy),0,0,Math.tan(axxxx),1,0,0,0,0,1,0,0,0,0,1]*/);
|
|
791
806
|
}
|
|
792
807
|
else throw "skew requires 1 or 2 parameters.";
|
|
793
808
|
return this;
|
|
794
809
|
}
|
|
795
810
|
|
|
796
|
-
|
|
811
|
+
dotcss2._Transform.prototype.skewX = function(){
|
|
797
812
|
var p = arguments;
|
|
798
813
|
if(p.length == 1) this.skew.apply(this, p) //Makes things easier.
|
|
799
814
|
else throw "skewX requires 1 parameter.";
|
|
800
815
|
return this;
|
|
801
816
|
}
|
|
802
817
|
|
|
803
|
-
|
|
818
|
+
dotcss2._Transform.prototype.skewY = function(){
|
|
804
819
|
var p = arguments;
|
|
805
820
|
if(p.length == 1) this.skew.apply(this, [0, p[0]]) //Makes things easier.
|
|
806
821
|
else throw "skewY requires 1 parameter.";
|
|
807
822
|
return this;
|
|
808
823
|
}
|
|
809
824
|
|
|
810
|
-
|
|
825
|
+
dotcss2._Transform.prototype.perspective = function(){
|
|
811
826
|
var p = arguments;
|
|
812
827
|
if(p.length == 1){
|
|
813
828
|
var d = dotcss.lengthToPx(p[0]);
|
|
814
|
-
this._updateValue("perspective", [new
|
|
829
|
+
this._updateValue("perspective", [new dotcss2._Length(d + "px")]/*, [1,0,0,0,0,1,0,0,0,0,1,0,0,0,dotcss.formatNumberValue(-1 / d),1]*/);
|
|
815
830
|
}
|
|
816
831
|
else throw "perspective requires 1 parameter.";
|
|
817
832
|
return this;
|
|
818
833
|
}
|
|
819
834
|
|
|
820
|
-
|
|
835
|
+
dotcss2._Complex = function(value){
|
|
821
836
|
this.type = "complex";
|
|
822
|
-
this.parts = (" " + value + " ").split(
|
|
823
|
-
this.numbers = value.match(
|
|
837
|
+
this.parts = (" " + value + " ").split(dotcss2._floatRegex);
|
|
838
|
+
this.numbers = value.match(dotcss2._floatRegex);
|
|
824
839
|
}
|
|
825
840
|
|
|
826
|
-
|
|
841
|
+
dotcss2._Complex.prototype.toString = function(){
|
|
827
842
|
var ret = this.parts[0];
|
|
828
843
|
for(var i = 0; i < this.numbers.length; i++){
|
|
829
844
|
ret += this.numbers[i] + this.parts[i+1];
|
|
@@ -831,21 +846,21 @@ dotcss._Complex.prototype.toString = function(){
|
|
|
831
846
|
return ret;
|
|
832
847
|
}
|
|
833
848
|
|
|
834
|
-
|
|
849
|
+
dotcss2._Number = function(value){
|
|
835
850
|
this.type = "number";
|
|
836
851
|
this.value = Number(value);
|
|
837
852
|
}
|
|
838
853
|
|
|
839
|
-
|
|
854
|
+
dotcss2._Number.prototype.toString = function(){
|
|
840
855
|
return this.value;
|
|
841
856
|
}
|
|
842
857
|
|
|
843
|
-
|
|
858
|
+
dotcss2._Unknown = function(value){
|
|
844
859
|
this.type = "unknown";
|
|
845
860
|
this.value = value;
|
|
846
861
|
}
|
|
847
862
|
|
|
848
|
-
|
|
863
|
+
dotcss2._Unknown.prototype.toString = function(){
|
|
849
864
|
return this.value;
|
|
850
865
|
}
|
|
851
866
|
|
|
@@ -856,15 +871,15 @@ function _StyleProperty(){
|
|
|
856
871
|
|
|
857
872
|
//toString override gets the value.
|
|
858
873
|
_StyleProperty.prototype.toString = function(){
|
|
859
|
-
if(
|
|
874
|
+
if(dotcss2._lastBuilder.target){
|
|
860
875
|
var ret = null;
|
|
861
|
-
if(
|
|
876
|
+
if(dotcss2._lastBuilder.target.length > 1){
|
|
862
877
|
ret = [];
|
|
863
|
-
for(var i = 0; i <
|
|
864
|
-
ret.push(
|
|
878
|
+
for(var i = 0; i < dotcss2._lastBuilder.target.length; i++){
|
|
879
|
+
ret.push(dotcss2._lastBuilder.target[i].style[this.jsFriendlyProp]);
|
|
865
880
|
}
|
|
866
881
|
}
|
|
867
|
-
else ret =
|
|
882
|
+
else ret = dotcss2._lastBuilder.target[0].style[this.jsFriendlyProp];
|
|
868
883
|
return ret;
|
|
869
884
|
}
|
|
870
885
|
else return null;
|
|
@@ -872,20 +887,20 @@ _StyleProperty.prototype.toString = function(){
|
|
|
872
887
|
|
|
873
888
|
//val is another special function that breaks the value into a special object.
|
|
874
889
|
_StyleProperty.prototype.val = function(){
|
|
875
|
-
if(
|
|
890
|
+
if(dotcss2._lastBuilder.target){
|
|
876
891
|
var ret = null;
|
|
877
|
-
if(
|
|
892
|
+
if(dotcss2._lastBuilder.target.length > 1){
|
|
878
893
|
ret = null;
|
|
879
|
-
for(var i = 0; i <
|
|
880
|
-
if(
|
|
881
|
-
ret.push(
|
|
894
|
+
for(var i = 0; i < dotcss2._lastBuilder.target.length; i++){
|
|
895
|
+
if(dotcss2._lastBuilder.target[0].style[this.jsFriendlyProp]){
|
|
896
|
+
ret.push(dotcss2._convertStyleIntoDotCssObject(dotcss2._lastBuilder.target[i].style[this.jsFriendlyProp], this.type));
|
|
882
897
|
}
|
|
883
898
|
else ret.push(null);
|
|
884
899
|
}
|
|
885
900
|
}
|
|
886
901
|
else{
|
|
887
|
-
if(
|
|
888
|
-
ret =
|
|
902
|
+
if(dotcss2._lastBuilder.target[0].style[this.jsFriendlyProp]){
|
|
903
|
+
ret = dotcss2._convertStyleIntoDotCssObject(dotcss2._lastBuilder.target[0].style[this.jsFriendlyProp], this.type)
|
|
889
904
|
}
|
|
890
905
|
else ret = null;
|
|
891
906
|
}
|
|
@@ -898,19 +913,19 @@ _StyleProperty.prototype.val = function(){
|
|
|
898
913
|
//complete does not get called if the animation was cancelled.
|
|
899
914
|
_StyleProperty.prototype.animate = function(value, duration, style, complete){
|
|
900
915
|
duration = isNaN(duration) ? 400 : (duration || 0);
|
|
901
|
-
if(
|
|
916
|
+
if(dotcss2._lastBuilder && dotcss2._lastBuilder.target){
|
|
902
917
|
if(!complete && style && style.call && style.apply){ //Fix params.
|
|
903
918
|
complete = style;
|
|
904
919
|
style = undefined;
|
|
905
920
|
}
|
|
906
|
-
for(var i = 0; i <
|
|
907
|
-
var target =
|
|
921
|
+
for(var i = 0; i < dotcss2._lastBuilder.target.length; i++){
|
|
922
|
+
var target = dotcss2._lastBuilder.target[i];
|
|
908
923
|
var oldValue = null;
|
|
909
924
|
var newValue = null;
|
|
910
925
|
var finalValue = null; //newValue might be in different units from the final value...
|
|
911
926
|
|
|
912
927
|
//Get the old and new values.
|
|
913
|
-
newValue =
|
|
928
|
+
newValue = dotcss2._convertStyleIntoDotCssObject(value, this.type);
|
|
914
929
|
|
|
915
930
|
//If it's a transformation, a little extra work is required.
|
|
916
931
|
//Need to frame all the rotations properly, and combine both the new and the old transformations.
|
|
@@ -918,10 +933,10 @@ _StyleProperty.prototype.animate = function(value, duration, style, complete){
|
|
|
918
933
|
//Special handling. We'd like to consider the transformation as a complex data type first, then if that's not possible, convert it into a matrix data type.
|
|
919
934
|
//Reason being: linear transformations on matrices are inaccurate. Rotations end up scaling the target.
|
|
920
935
|
//Don't want to get the computed value for transformations.
|
|
921
|
-
oldValue =
|
|
936
|
+
oldValue = dotcss2._convertStyleIntoDotCssObject(target.style[this.jsFriendlyProp], this.type);
|
|
922
937
|
}
|
|
923
938
|
if(!oldValue){ //Standard. Happens when the type is not a transformation.
|
|
924
|
-
oldValue =
|
|
939
|
+
oldValue = dotcss2._convertStyleIntoDotCssObject(dotcss2._computedStyleOrActualStyle(target, this.jsFriendlyProp), this.type);
|
|
925
940
|
}
|
|
926
941
|
|
|
927
942
|
finalValue = newValue.toString();
|
|
@@ -951,7 +966,7 @@ _StyleProperty.prototype.animate = function(value, duration, style, complete){
|
|
|
951
966
|
|
|
952
967
|
//Won't need this anymore.
|
|
953
968
|
//console.warn("Couldn't animate " + this.jsFriendlyProp + ". Inconsistent units.");
|
|
954
|
-
//return
|
|
969
|
+
//return dotcss2._lastBuilder;
|
|
955
970
|
}
|
|
956
971
|
}
|
|
957
972
|
}
|
|
@@ -994,8 +1009,8 @@ _StyleProperty.prototype.animate = function(value, duration, style, complete){
|
|
|
994
1009
|
var filler = (transformToAdd.indexOf("scale") == -1) ? 0 : 1;
|
|
995
1010
|
newTransformValues = [];
|
|
996
1011
|
for(var j = 0; j < oldTransformValues.length; j++) newTransformValues.push(!isNaN(oldTransformValues[j]) ? filler : (
|
|
997
|
-
!isNaN(oldTransformValues[j].angle) ? new
|
|
998
|
-
!isNaN(oldTransformValues[j].length) ? new
|
|
1012
|
+
!isNaN(oldTransformValues[j].angle) ? new dotcss2._Angle(0) : (
|
|
1013
|
+
!isNaN(oldTransformValues[j].length) ? new dotcss2._Length(0) : (0)
|
|
999
1014
|
)));
|
|
1000
1015
|
}
|
|
1001
1016
|
oldIndex--;
|
|
@@ -1014,8 +1029,8 @@ _StyleProperty.prototype.animate = function(value, duration, style, complete){
|
|
|
1014
1029
|
var filler = (transformToAdd.indexOf("scale") == -1) ? 0 : 1;
|
|
1015
1030
|
oldTransformValues = [];
|
|
1016
1031
|
for(var j = 0; j < newTransformValues.length; j++) oldTransformValues.push(!isNaN(newTransformValues[j]) ? filler : (
|
|
1017
|
-
!isNaN(newTransformValues[j].angle) ? new
|
|
1018
|
-
!isNaN(newTransformValues[j].length) ? new
|
|
1032
|
+
!isNaN(newTransformValues[j].angle) ? new dotcss2._Angle(0) : (
|
|
1033
|
+
!isNaN(newTransformValues[j].length) ? new dotcss2._Length(0) : (0)
|
|
1019
1034
|
)));
|
|
1020
1035
|
}
|
|
1021
1036
|
newIndex--;
|
|
@@ -1037,13 +1052,13 @@ _StyleProperty.prototype.animate = function(value, duration, style, complete){
|
|
|
1037
1052
|
startTransform = transformToAdd + "(" + startTransform.substring(1);
|
|
1038
1053
|
desiredTransform = transformToAdd + "(" + desiredTransform.substring(1);
|
|
1039
1054
|
}
|
|
1040
|
-
oldValue =
|
|
1041
|
-
newValue =
|
|
1055
|
+
oldValue = dotcss2._convertStyleIntoDotCssObject(startTransform, "transformation");
|
|
1056
|
+
newValue = dotcss2._convertStyleIntoDotCssObject(desiredTransform, "transformation");
|
|
1042
1057
|
|
|
1043
1058
|
}
|
|
1044
1059
|
else if(oldValue.type == "number" && newValue.type == "number"){} //OK
|
|
1045
1060
|
else if(oldValue.type == "complex" && newValue.type == "complex"){
|
|
1046
|
-
if(!
|
|
1061
|
+
if(!dotcss2._compareComplexDataTypes(oldValue, newValue)){
|
|
1047
1062
|
console.warn("Couldn't animate " + this.jsFriendlyProp + ". Value mismatch.");
|
|
1048
1063
|
continue;
|
|
1049
1064
|
}
|
|
@@ -1052,30 +1067,30 @@ _StyleProperty.prototype.animate = function(value, duration, style, complete){
|
|
|
1052
1067
|
console.warn("Couldn't animate " + this.jsFriendlyProp + ". Not a recognizable length, color, or number.");
|
|
1053
1068
|
continue;
|
|
1054
1069
|
}
|
|
1055
|
-
|
|
1070
|
+
dotcss2._animate(target, this.jsFriendlyProp, oldValue.type || this.type, oldValue, newValue, finalValue, dotcss2._fxInterval, duration, style || "ease", complete);
|
|
1056
1071
|
}
|
|
1057
1072
|
}
|
|
1058
|
-
return
|
|
1073
|
+
return dotcss2._lastBuilder;
|
|
1059
1074
|
};
|
|
1060
1075
|
|
|
1061
1076
|
//Have to add these back since we're going to replace the __proto__ of a function with this new prototype.
|
|
1062
1077
|
_StyleProperty.prototype.apply = Function.apply;
|
|
1063
1078
|
_StyleProperty.prototype.call = Function.call;
|
|
1064
1079
|
|
|
1065
|
-
|
|
1080
|
+
dotcss2._animate = function(element, jsFriendlyProp, propType, startValue, targetValue, finalValue, currentTime, totalDuration, animationStyle, callback, lastValue){
|
|
1066
1081
|
if(lastValue && element.style[jsFriendlyProp] != lastValue) return; //Animation can be cancelled any time by setting the value directly.
|
|
1067
1082
|
|
|
1068
1083
|
if(totalDuration - currentTime > 0){
|
|
1069
1084
|
switch(propType){
|
|
1070
1085
|
case "color":
|
|
1071
|
-
var r = Math.round(
|
|
1072
|
-
var g = Math.round(
|
|
1073
|
-
var b = Math.round(
|
|
1074
|
-
var a = dotcss.formatNumberValue(
|
|
1086
|
+
var r = Math.round(dotcss2._numberStep(startValue.r, targetValue.r, currentTime, totalDuration, animationStyle));
|
|
1087
|
+
var g = Math.round(dotcss2._numberStep(startValue.g, targetValue.g, currentTime, totalDuration, animationStyle ));
|
|
1088
|
+
var b = Math.round(dotcss2._numberStep(startValue.b, targetValue.b, currentTime, totalDuration, animationStyle ));
|
|
1089
|
+
var a = dotcss.formatNumberValue(dotcss2._numberStep(startValue.a, targetValue.a, currentTime, totalDuration, animationStyle )); //TODO: make sure this doesn't need to be rounded or something.
|
|
1075
1090
|
dotcss(element)[jsFriendlyProp](r, g, b, a);
|
|
1076
1091
|
break;
|
|
1077
1092
|
case "length":
|
|
1078
|
-
dotcss(element)[jsFriendlyProp](dotcss.formatNumberValue(
|
|
1093
|
+
dotcss(element)[jsFriendlyProp](dotcss.formatNumberValue(dotcss2._numberStep(startValue.length, targetValue.length, currentTime, totalDuration, animationStyle), startValue.units) + startValue.units);
|
|
1079
1094
|
break;
|
|
1080
1095
|
case "transformation":
|
|
1081
1096
|
var newTransform = "";
|
|
@@ -1090,7 +1105,7 @@ dotcss._animate = function(element, jsFriendlyProp, propType, startValue, target
|
|
|
1090
1105
|
var actualV1 = isNaN(v1) ? v1.length || v1.angle || v1.value || 0 : v1;
|
|
1091
1106
|
var actualV2 = isNaN(v2) ? v2.length || v2.angle || v2.value || 0 : v2;
|
|
1092
1107
|
var units = isNaN(v1) ? v1.units : "";
|
|
1093
|
-
newTransform += dotcss.formatNumberValue(
|
|
1108
|
+
newTransform += dotcss.formatNumberValue(dotcss2._numberStep(actualV1, actualV2, currentTime, totalDuration, animationStyle), units) + units + ",";
|
|
1094
1109
|
}
|
|
1095
1110
|
newTransform = newTransform.substring(0, newTransform.length - 1);
|
|
1096
1111
|
newTransform += ") ";
|
|
@@ -1100,13 +1115,13 @@ dotcss._animate = function(element, jsFriendlyProp, propType, startValue, target
|
|
|
1100
1115
|
default:
|
|
1101
1116
|
switch(startValue.type){
|
|
1102
1117
|
case "number":
|
|
1103
|
-
dotcss(element)[jsFriendlyProp](dotcss.formatNumberValue(
|
|
1118
|
+
dotcss(element)[jsFriendlyProp](dotcss.formatNumberValue(dotcss2._numberStep(startValue.value, targetValue.value, currentTime, totalDuration, animationStyle)));
|
|
1104
1119
|
break;
|
|
1105
1120
|
case "complex":
|
|
1106
1121
|
var newVal = "";
|
|
1107
1122
|
for(var i = 0; i < startValue.numbers.length; i++){
|
|
1108
1123
|
newVal += startValue.parts[i];
|
|
1109
|
-
newVal += dotcss.formatNumberValue(
|
|
1124
|
+
newVal += dotcss.formatNumberValue(dotcss2._numberStep(startValue.numbers[i], targetValue.numbers[i], currentTime, totalDuration, animationStyle))
|
|
1110
1125
|
}
|
|
1111
1126
|
newVal += startValue.parts[startValue.parts.length - 1];
|
|
1112
1127
|
|
|
@@ -1123,14 +1138,14 @@ dotcss._animate = function(element, jsFriendlyProp, propType, startValue, target
|
|
|
1123
1138
|
//Because we're creating a lot of new functions. Are they being released?
|
|
1124
1139
|
var last = element.style[jsFriendlyProp];
|
|
1125
1140
|
var nextStep = function(timestamp){
|
|
1126
|
-
var change = (now ? (window.performance.now() - now) :
|
|
1127
|
-
|
|
1141
|
+
var change = (now ? (window.performance.now() - now) : dotcss2._fxInterval);
|
|
1142
|
+
dotcss2._animate(element, jsFriendlyProp, propType, startValue, targetValue, finalValue, currentTime + change, totalDuration, animationStyle, callback, last);
|
|
1128
1143
|
}
|
|
1129
1144
|
if(window.requestAnimationFrame) {
|
|
1130
1145
|
window.requestAnimationFrame(nextStep);
|
|
1131
1146
|
//setTimeout(function(){if(!reachedAnimFrame) console.log("ERROR");}, 100);
|
|
1132
1147
|
}
|
|
1133
|
-
else window.setTimeout(nextStep,
|
|
1148
|
+
else window.setTimeout(nextStep, dotcss2._fxInterval);
|
|
1134
1149
|
}
|
|
1135
1150
|
else{
|
|
1136
1151
|
//TODO: verify that decimal values are properly handled here.
|
|
@@ -1147,7 +1162,7 @@ dotcss._animate = function(element, jsFriendlyProp, propType, startValue, target
|
|
|
1147
1162
|
//totalDuration is the duration of the entire animation from start to finish (not just this step).
|
|
1148
1163
|
//style is the type of transition (geometric=exponential, ease, linear).
|
|
1149
1164
|
//Returns the result.
|
|
1150
|
-
|
|
1165
|
+
dotcss2._numberStep = function(startValue, targetValue, currentTime, totalDuration, style){
|
|
1151
1166
|
|
|
1152
1167
|
startValue = Number(startValue);
|
|
1153
1168
|
targetValue = Number(targetValue);
|
|
@@ -1176,11 +1191,11 @@ dotcss.formatNumberValue = function(value, unit){
|
|
|
1176
1191
|
};
|
|
1177
1192
|
|
|
1178
1193
|
var _allProps = {
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1194
|
+
color: "color|background-Color|border-Bottom-Color|border-Color|border-Left-Color|border-Right-Color|border-Top-Color|text-Decoration-Color|outline-Color|column-Rule-Color",
|
|
1195
|
+
length: "background-Size|border-Bottom-Left-Radius|border-Bottom-Right-Radius|border-Bottom-Width|border-Image-Width|border-Left-Width|border-Radius|border-Right-Width|border-Top-Left-Radius|border-Top-Right-Radius|border-Top-Width|border-Width|bottom|height|left|margin|margin-Bottom|margin-Left|margin-Right|margin-Top|max-Height|max-Width|min-Height|min-Width|padding|padding-Bottom|padding-Left|padding-Right|padding-Top|right|top|width|line-Height|font-Size",
|
|
1196
|
+
url: "background-Image|border-Image|list-Style-Image|content|image-Orientation",
|
|
1197
|
+
transformation: "transformation",
|
|
1198
|
+
misc: "opacity|background|background-Attachment|background-Blend-Mode|background-Position|background-Repeat|background-Clip|background-Origin|border|border-Bottom|border-Bottom-Style|border-Image-Outset|border-Image-Repeat|border-Image-Slice|border-Image-Source|border-Left|border-Left-Style|border-Right|border-Right-Style|border-Style|border-Top|border-Top-Style|box-Decoration-Break|box-Shadow|clear|clip|display|float|overflow|box|overflow-X|overflow-Y|position|visibility|vertical-Align|z-Index|align-Content|align-Items|align-Self|flex|flex-Basis|flex-Direction|flex-Flow|flex-Grow|flex-Shrink|flex-Wrap|grid|grid-Area|grid-Auto-Columns|grid-auto-Rows|grid-Column|grid-Column-End|grid-Column-Gap|grid-Column-Start|grid-Gap|grid-Row|grid-Row-End|grid-Row-Gap|grid-Row-Start|grid-Template|grid-Template-Areas|grid-Template-Columns|grid-Template-Rows|justify-Content|order|hanging-Punctuation|hyphens|letter-Spacing|line-Break|overflow-Wrap|tab-Size|text-Align|text-Align-Last|text-Combine-Upright|text-Indent|text-Justify|text-Transform|white-Space|word-Break|word-Spacing|word-Wrap|text-Decoration|text-Decoration-Line|text-Decoration-Style|text-Shadow|text-Underline-Position|font|font-Family|font-Feature-Settings|font-Kerning|font-Language-Override|font-Size-Adjust|font-Stretch|font-Style|font-Synthesis|font-Variant|font-Variant-Alternates|font-Variant-Caps|font-Variant-East-Asian|font-Variant-Ligatures|font-Variant-Numeric|font-Variant-Position|font-Weight|direction|text-Orientation|text-Combine-Upright|unicode-Bidi|user-Select|writing-Mode|border-Collapse|border-Spacing|caption-Side|empty-Cells|table-Layout|counter-Increment|counter-Reset|list-Style|list-Style-Position|list-Style-Type|animation|animation-Delay|animation-Direction|animation-Duration|animation-Fill-Mode|animation-Iteration-Count|animation-Name|animation-Play-State|animation-Timing-Function|backface-Visibility|perspective2d|perspective-Origin|transform-Origin|transform-Style|transition|transition-Property|transition-Duration|transition-Timing-Function|transition-Delay|box-Sizing|cursor|ime-Mode|nav-Down|nav-Index|nav-Left|nav-Right|nav-Up|outline|outline-Offset|outline-Style|outline-Width|resize|text-Overflow|break-After|break-Before|break-Inside|column-Count|column-Fill|column-Gap|column-Rule|column-Rule-Style|column-Rule-Width|column-Span|column-Width|columns|widows|orphans|page-Break-After|page-Break-Before|page-Break-Inside|marks|quotes|filter|image-Rendering|image-Resolution|object-Fit|object-Position|mask|mask-Type|mark|mark-After|mark-Before|phonemes|rest|rest-After|rest-Before|voice-Balance|voice-Duration|voice-Pitch|voice-Pitch-Range|voice-Rate|voice-Stress|voice-Volume|marquee-Direction|marquee-Play-Count|marquee-Speed|marquee-Style|pointer-Events"
|
|
1184
1199
|
}
|
|
1185
1200
|
|
|
1186
1201
|
var _allLengthUnits = [
|
|
@@ -1225,7 +1240,7 @@ var _allTransforms = [
|
|
|
1225
1240
|
"perspective"
|
|
1226
1241
|
]
|
|
1227
1242
|
|
|
1228
|
-
dotcss.matrixMultiply3D = function(A
|
|
1243
|
+
dotcss.matrixMultiply3D = function(A: Array<number>, B: Array<number>){
|
|
1229
1244
|
if(A.length != 16 || B.length != 16) throw "3D matrices must be arrays of 16 length.";
|
|
1230
1245
|
var ret = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
|
|
1231
1246
|
for(var y = 0; y < 4; y++)
|
|
@@ -1234,20 +1249,20 @@ dotcss.matrixMultiply3D = function(A, B){
|
|
|
1234
1249
|
ret[y + x * 4] += Number(A[y + i * 4]) * Number(B[i + x * 4]);
|
|
1235
1250
|
return ret;
|
|
1236
1251
|
};
|
|
1237
|
-
dotcss.angleToDeg = function(a){
|
|
1238
|
-
if(!isNaN(a)) return Number(a); //If there are no units, assume deg.
|
|
1239
|
-
a = a.trim();
|
|
1252
|
+
dotcss.angleToDeg = function(a: number|string){
|
|
1253
|
+
if(!isNaN(a as number)) return Number(a); //If there are no units, assume deg.
|
|
1254
|
+
a = (a as string).trim();
|
|
1240
1255
|
if(a.indexOf("deg") != -1) return dotcss.formatNumberValue(Number(a.split("deg")[0]));
|
|
1241
1256
|
else if(a.indexOf("grad") != -1) return dotcss.formatNumberValue(Number(a.split("grad")[0]) * 0.9);
|
|
1242
1257
|
else if(a.indexOf("rad") != -1) return dotcss.formatNumberValue(Number(a.split("rad")[0]) * 180 / Math.PI);
|
|
1243
1258
|
else if(a.indexOf("turn") != -1) return dotcss.formatNumberValue(Number(a.split("turn")[0]) * 360);
|
|
1244
1259
|
else throw a + " does not have valid units for an angle."
|
|
1245
1260
|
};
|
|
1246
|
-
dotcss.lengthToPx = function(l, prop, element){
|
|
1261
|
+
dotcss.lengthToPx = function(l: string|number, prop: LengthProp, element: Element){
|
|
1247
1262
|
var R = Math.round;
|
|
1248
1263
|
var N = Number;
|
|
1249
|
-
if(!isNaN(l)) return R(N(l)); //If there are no units, assume px.
|
|
1250
|
-
l = l.trim();
|
|
1264
|
+
if(!isNaN(l as number)) return R(N(l)); //If there are no units, assume px.
|
|
1265
|
+
l = (l as string).trim();
|
|
1251
1266
|
var S = l.split;
|
|
1252
1267
|
//Absolute:
|
|
1253
1268
|
if(l.indexOf("px") != -1) return R(N(l.split("px")[0]));
|
|
@@ -1260,15 +1275,15 @@ dotcss.lengthToPx = function(l, prop, element){
|
|
|
1260
1275
|
//Technically relative:
|
|
1261
1276
|
else if(l.indexOf("vw") != -1) return R(N(l.split("vw")[0]) * 0.01 * Math.max(document.documentElement.clientWidth, window.innerWidth || 0));
|
|
1262
1277
|
else if(l.indexOf("vh") != -1) return R(N(l.split("vh")[0]) * 0.01 * Math.max(document.documentElement.clientHeight, window.innerHeight || 0));
|
|
1263
|
-
else if(l.indexOf("vmin") != -1) return Math.min(dotcss.lengthToPx(R(N(l.split("vmin")[0]
|
|
1264
|
-
else if(l.indexOf("vmax") != -1) return Math.max(dotcss.lengthToPx(R(N(l.split("vmin")[0]
|
|
1265
|
-
else if(l.indexOf("rem") != -1) return R(N(l.split("rem")[0]) * dotcss.lengthToPx(
|
|
1278
|
+
else if(l.indexOf("vmin") != -1) return Math.min(dotcss.lengthToPx(R(N(l.split("vmin")[0]+ "vw"))), R(N(l.split("vmin")[0]+ "vx"))); //I know this is slow, but it's compact, and it's not like this is a common unit.
|
|
1279
|
+
else if(l.indexOf("vmax") != -1) return Math.max(dotcss.lengthToPx(R(N(l.split("vmin")[0]+ "vw"))), R(N(l.split("vmin")[0]+ "vx")));
|
|
1280
|
+
else if(l.indexOf("rem") != -1) return R(N(l.split("rem")[0]) * dotcss.lengthToPx(dotcss2._computedStyleOrActualStyle(document.body, "fontSize"))); //Couldn't get a stack overflow if it's a computed value. Always in px.
|
|
1266
1281
|
|
|
1267
1282
|
//Absolutely relative:
|
|
1268
1283
|
else if (prop && element) {
|
|
1269
1284
|
//If we're setting things relative to font sizes, that's easy.
|
|
1270
1285
|
//Can't animate ex or ch. Sorry.
|
|
1271
|
-
if(l.indexOf("em") != -1) return R(N(l.split("em")[0]) * dotcss.lengthToPx(
|
|
1286
|
+
if(l.indexOf("em") != -1) return R(N(l.split("em")[0]) * dotcss.lengthToPx(dotcss2._computedStyleOrActualStyle(element, "fontSize")));
|
|
1272
1287
|
|
|
1273
1288
|
var ref = null;
|
|
1274
1289
|
switch(prop){
|
|
@@ -1278,7 +1293,7 @@ dotcss.lengthToPx = function(l, prop, element){
|
|
|
1278
1293
|
case "bottom":
|
|
1279
1294
|
case "height":
|
|
1280
1295
|
if(!element.parentNode) throw "Cannot convert " + l + " " + prop + " to px for an element that has no parent."
|
|
1281
|
-
ref = dotcss.lengthToPx(
|
|
1296
|
+
ref = dotcss.lengthToPx(dotcss2._computedStyleOrActualStyle(element.parentNode, "height"));
|
|
1282
1297
|
break;
|
|
1283
1298
|
case "maxHidth":
|
|
1284
1299
|
case "minWidth":
|
|
@@ -1295,14 +1310,14 @@ dotcss.lengthToPx = function(l, prop, element){
|
|
|
1295
1310
|
case "paddingBottom":
|
|
1296
1311
|
case "paddingLeft":
|
|
1297
1312
|
case "paddingRight":
|
|
1298
|
-
ref = dotcss.lengthToPx(
|
|
1313
|
+
ref = dotcss.lengthToPx(dotcss2._computedStyleOrActualStyle(element.parentNode, "width"));
|
|
1299
1314
|
if(!element.parentNode) throw "Cannot convert " + l + " " + prop + " to px for an element that has no parent."
|
|
1300
1315
|
break;
|
|
1301
1316
|
case "lineHeight": //Always relative to font. Would actually be nice to be able to set this relative to container though
|
|
1302
|
-
ref = dotcss.lengthToPx(
|
|
1317
|
+
ref = dotcss.lengthToPx(dotcss2._computedStyleOrActualStyle(element, "fontSize"));
|
|
1303
1318
|
break;
|
|
1304
1319
|
case "fontSize": //Thought this is not strictly allowed in css, we'll assume it means relative to current element's height.
|
|
1305
|
-
ref = dotcss.lengthToPx(
|
|
1320
|
+
ref = dotcss.lengthToPx(dotcss2._computedStyleOrActualStyle(element, "height"));
|
|
1306
1321
|
break;
|
|
1307
1322
|
default:
|
|
1308
1323
|
throw "Unable to convert the value " + l + " to px for " + prop + ".";
|
|
@@ -1317,27 +1332,27 @@ dotcss.lengthToPx = function(l, prop, element){
|
|
|
1317
1332
|
};
|
|
1318
1333
|
|
|
1319
1334
|
//Returns a JSON object representation of value specific to the cssDataType passed in.
|
|
1320
|
-
|
|
1335
|
+
dotcss2._convertStyleIntoDotCssObject = function(value, cssDataType){
|
|
1321
1336
|
//if(!value) return null;
|
|
1322
1337
|
if(!(value instanceof Array)) value = [value];
|
|
1323
|
-
if(cssDataType == "color") return new
|
|
1324
|
-
else if (cssDataType == "url") return new
|
|
1325
|
-
else if (cssDataType == "length" && (!isNaN(value[0]) || (value[0].indexOf(" ") == -1 && value[0].replace(
|
|
1326
|
-
else if (cssDataType == "transformation") return new
|
|
1338
|
+
if(cssDataType == "color") return new dotcss2._Color(value);
|
|
1339
|
+
else if (cssDataType == "url") return new dotcss2._Url(value);
|
|
1340
|
+
else if (cssDataType == "length" && (!isNaN(value[0]) || (value[0].indexOf(" ") == -1 && value[0].replace(dotcss2._floatRegex, "") != value[0]))) return new dotcss2._Length(value[0]);
|
|
1341
|
+
else if (cssDataType == "transformation") return new dotcss2._Transform(value[0].toString())
|
|
1327
1342
|
else{
|
|
1328
1343
|
if(value[0] === ""
|
|
1329
1344
|
|| (
|
|
1330
1345
|
(isNaN(value[0]))
|
|
1331
|
-
&& ("" + value[0]).replace(
|
|
1332
|
-
) return new
|
|
1333
|
-
if(isNaN(value[0])) return new
|
|
1334
|
-
else return new
|
|
1346
|
+
&& ("" + value[0]).replace(dotcss2._floatRegex, "") == value[0])
|
|
1347
|
+
) return new dotcss2._Unknown(value[0]); //No numbers.
|
|
1348
|
+
if(isNaN(value[0])) return new dotcss2._Complex(value[0]); //Numbers
|
|
1349
|
+
else return new dotcss2._Number(value[0]); //Just a number.
|
|
1335
1350
|
}
|
|
1336
1351
|
|
|
1337
1352
|
};
|
|
1338
1353
|
|
|
1339
1354
|
//Ensures that two complex values match.
|
|
1340
|
-
|
|
1355
|
+
dotcss2._compareComplexDataTypes = function(value1, value2){
|
|
1341
1356
|
if(value1.type != "complex" || value2.type != "complex") return false;
|
|
1342
1357
|
if(value1.numbers.length != value2.numbers.length) return false;
|
|
1343
1358
|
if(value1.parts.length != value2.parts.length) return false;
|
|
@@ -1349,7 +1364,7 @@ dotcss._compareComplexDataTypes = function(value1, value2){
|
|
|
1349
1364
|
|
|
1350
1365
|
//Adds a builder function directly to the dotcss object so that dotcss doesn't
|
|
1351
1366
|
//have to be used as a function when a target doesn't need to be specified.
|
|
1352
|
-
|
|
1367
|
+
dotcss2._addPropFunctionToDotCssObject = function(funcName){
|
|
1353
1368
|
dotcss[funcName] = function(){
|
|
1354
1369
|
var n = new _Builder();
|
|
1355
1370
|
return n[funcName].apply(n, arguments);
|
|
@@ -1357,19 +1372,21 @@ dotcss._addPropFunctionToDotCssObject = function(funcName){
|
|
|
1357
1372
|
};
|
|
1358
1373
|
|
|
1359
1374
|
//Takes the property and generates all the dotcss and builder functions.
|
|
1360
|
-
|
|
1375
|
+
dotcss2._makeFunction = function(prop, jsFriendlyProp, type){
|
|
1361
1376
|
//Create the new function.
|
|
1362
1377
|
_b[jsFriendlyProp] = function(){
|
|
1363
|
-
|
|
1364
1378
|
|
|
1365
1379
|
if(arguments.length == 0) return this;
|
|
1366
1380
|
var args = [];
|
|
1367
1381
|
for(var i = 0; i < arguments.length; i++) args.push(arguments[i]);
|
|
1368
|
-
var value =
|
|
1382
|
+
var value = dotcss2._convertStyleIntoDotCssObject(args, type).toString();
|
|
1383
|
+
|
|
1369
1384
|
|
|
1370
1385
|
var newCss = prop + ":" + value + ";";
|
|
1371
1386
|
this.currentCss += newCss;
|
|
1372
|
-
|
|
1387
|
+
// console.log(`SETTING ${jsFriendlyProp}:`, this.toString());
|
|
1388
|
+
// this.toString()
|
|
1389
|
+
|
|
1373
1390
|
if(this.target){
|
|
1374
1391
|
for(var q = 0; q < this.target.length; q++){
|
|
1375
1392
|
//this.target[q].style += newCss;
|
|
@@ -1382,7 +1399,7 @@ dotcss._makeFunction = function(prop, jsFriendlyProp, type){
|
|
|
1382
1399
|
return this;
|
|
1383
1400
|
}
|
|
1384
1401
|
//Add the new function to the dotcss object so that it can be accessed without doing dotcss().
|
|
1385
|
-
|
|
1402
|
+
dotcss2._addPropFunctionToDotCssObject(jsFriendlyProp);
|
|
1386
1403
|
|
|
1387
1404
|
//Each unit of length will also have its own version of this function (assuming this is a length property).
|
|
1388
1405
|
if(type == "length"){
|
|
@@ -1394,7 +1411,7 @@ dotcss._makeFunction = function(prop, jsFriendlyProp, type){
|
|
|
1394
1411
|
return _b[jsFriendlyProp].apply(this, arguments);
|
|
1395
1412
|
}
|
|
1396
1413
|
})(uu);
|
|
1397
|
-
|
|
1414
|
+
dotcss2._addPropFunctionToDotCssObject(jsFriendlyProp + (uu.jsName || uu.unit));
|
|
1398
1415
|
}
|
|
1399
1416
|
}
|
|
1400
1417
|
|
|
@@ -1407,18 +1424,18 @@ dotcss._makeFunction = function(prop, jsFriendlyProp, type){
|
|
|
1407
1424
|
}
|
|
1408
1425
|
};
|
|
1409
1426
|
|
|
1410
|
-
|
|
1427
|
+
dotcss2._makeTransformFunction = function(fn){
|
|
1411
1428
|
dotcss[fn] = function(){
|
|
1412
|
-
var n = new
|
|
1429
|
+
var n = new dotcss2._Transform();
|
|
1413
1430
|
return n[fn].apply(n, arguments);
|
|
1414
1431
|
};
|
|
1415
1432
|
}
|
|
1416
1433
|
|
|
1417
|
-
|
|
1434
|
+
dotcss2._computedStyleOrActualStyle = function(element, property){
|
|
1418
1435
|
return window.getComputedStyle(element)[property] || element.style[property];
|
|
1419
1436
|
};
|
|
1420
1437
|
|
|
1421
|
-
|
|
1438
|
+
dotcss2._modDeg = function(a){
|
|
1422
1439
|
if(a < 0) a = 360 - ((-a) % 360);
|
|
1423
1440
|
return a % 360;
|
|
1424
1441
|
};
|
|
@@ -1450,10 +1467,29 @@ dotcss.rgba = function(r, g, b, a){
|
|
|
1450
1467
|
};
|
|
1451
1468
|
|
|
1452
1469
|
dotcss.buildTransform = function(){
|
|
1453
|
-
return new
|
|
1470
|
+
return new dotcss2._Transform();
|
|
1454
1471
|
};
|
|
1455
1472
|
|
|
1456
|
-
dotcss
|
|
1473
|
+
dotcss["cacheScopedStaticStyles"] = function(el: HTMLElement){
|
|
1474
|
+
let elements = getScopedNodeList("*", el);
|
|
1475
|
+
for(let element of elements){
|
|
1476
|
+
if(element.hasAttribute("style")){
|
|
1477
|
+
element.setAttribute(STATIC_SYLES_ATTR, element.getAttribute("style"));
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
dotcss["clearDynamicStyles"] = function(el: HTMLElement){
|
|
1483
|
+
let elements = getScopedNodeList("*", el);
|
|
1484
|
+
for(let element of elements){
|
|
1485
|
+
element.removeAttribute("style");
|
|
1486
|
+
if(element.hasAttribute(STATIC_SYLES_ATTR)){
|
|
1487
|
+
element.setAttribute("style", element.getAttribute(STATIC_SYLES_ATTR));
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
dotcss.scopeToEl = function(el: HTMLElement){
|
|
1457
1493
|
scopeStack.unshift(el);
|
|
1458
1494
|
return this;
|
|
1459
1495
|
};
|
|
@@ -1466,10 +1502,10 @@ dotcss.unscope = function(){
|
|
|
1466
1502
|
for(var k in _allProps) {
|
|
1467
1503
|
let P = _allProps[k].split("|");
|
|
1468
1504
|
for(var i in P){
|
|
1469
|
-
|
|
1505
|
+
dotcss2._makeFunction(P[i].toLowerCase(), P[i].replace(new RegExp("-", "g"), ""), k);
|
|
1470
1506
|
}
|
|
1471
1507
|
}
|
|
1472
|
-
for(
|
|
1508
|
+
for(let i: number = 0; i < _allLengthUnits.length; i++) dotcss2._makeTransformFunction(_allLengthUnits[i]);
|
|
1473
1509
|
//dotcss = new dotcss();
|
|
1474
1510
|
|
|
1475
1511
|
// for (var k in _b) {
|