dothtml 5.0.4 → 5.1.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/.vscode/launch.json +34 -0
- package/.vscode/settings.json +2 -1
- package/lib/component.d.ts +12 -3
- package/lib/dot-util.d.ts +13 -0
- package/lib/dothtml.d.ts +1 -1
- package/lib/dothtml.js +1 -1
- package/lib/i-dot.d.ts +4 -4
- package/lib/styling/css-types.ts/css-angle.d.ts +7 -0
- package/lib/styling/css-types.ts/css-color.d.ts +9 -0
- package/lib/styling/css-types.ts/css-complex.d.ts +7 -0
- package/lib/styling/css-types.ts/css-data-type.d.ts +5 -0
- package/lib/styling/css-types.ts/css-length.d.ts +7 -0
- package/lib/styling/css-types.ts/css-number.d.ts +6 -0
- package/lib/styling/css-types.ts/css-transform.d.ts +38 -0
- package/lib/styling/css-types.ts/css-unknown.d.ts +6 -0
- package/lib/styling/css-types.ts/css-url.d.ts +6 -0
- package/lib/{i-dotcss.d.ts → styling/i-dotcss.d.ts} +192 -42
- package/lib/styling/style-builder.d.ts +24 -0
- package/lib/styling/unit-function-tables.d.ts +10 -0
- package/package.json +2 -2
- package/src/component.ts +77 -31
- package/src/dot-util.ts +37 -1
- package/src/dot.ts +2 -2
- package/src/dothtml.ts +1 -1
- package/src/i-dot.ts +1 -1
- package/src/styling/css-types.ts/css-angle.ts +18 -0
- package/src/styling/css-types.ts/css-color.ts +229 -0
- package/src/styling/css-types.ts/css-complex.ts +20 -0
- package/src/styling/css-types.ts/css-data-type.ts +9 -0
- package/src/styling/css-types.ts/css-length.ts +20 -0
- package/src/styling/css-types.ts/css-number.ts +12 -0
- package/src/styling/css-types.ts/css-transform.ts +220 -0
- package/src/styling/css-types.ts/css-unknown.ts +13 -0
- package/src/styling/css-types.ts/css-url.ts +41 -0
- package/src/{i-dotcss.ts → styling/i-dotcss.ts} +206 -49
- package/src/styling/style-builder.ts +963 -0
- package/src/styling/unit-function-tables.ts +24 -0
- package/unittests/basic-functionality.test.ts +1 -1
- package/unittests/calc.test.ts +2 -0
- package/unittests/{component-decorator.-.ts → components/component-decorator.-.ts} +0 -0
- package/unittests/{components-data.test.ts → components/components-data.test.ts} +3 -3
- package/unittests/{components.test.ts → components/components.test.ts} +5 -4
- package/unittests/input-bindings.test.ts +6 -6
- package/unittests/non-function-props-rerender.test.ts +85 -0
- package/unittests/styling/animations.test.ts +14 -0
- package/unittests/styling/inline-styling.test.ts +18 -0
- package/unittests/styling/pseudo-selectors.test.ts +29 -0
- package/unittests/styling/transformations.test.ts +234 -0
- package/{lib/dot-component-legacy.d.ts → unittests/styling/value-interpretation.test.ts} +0 -0
- package/lib/dot-document.d.ts +0 -0
- package/lib/style-builder.d.ts +0 -3
- package/src/dot-component-legacy.ts +0 -79
- package/src/dot-document.ts +0 -0
- package/src/style-builder.ts +0 -1516
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const AllLengthUnits = [
|
|
2
|
+
{unit:"Em"},
|
|
3
|
+
{unit:"Ex"},
|
|
4
|
+
{unit:"Ch"},
|
|
5
|
+
{unit:"Rem"},
|
|
6
|
+
{unit:"Vw"},
|
|
7
|
+
{unit:"Vh"},
|
|
8
|
+
{unit:"Vmin"},
|
|
9
|
+
{unit:"Vmax"},
|
|
10
|
+
{unit:"%", jsName:"P"},
|
|
11
|
+
{unit:"Cm"},
|
|
12
|
+
{unit:"Mm"},
|
|
13
|
+
{unit:"In"},
|
|
14
|
+
{unit:"Px"},
|
|
15
|
+
{unit:"Pt"},
|
|
16
|
+
{unit:"Pc"}
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export const AllAngleUnits = [
|
|
20
|
+
{unit:"Deg"},
|
|
21
|
+
{unit:"Grad"},
|
|
22
|
+
{unit:"Rad"},
|
|
23
|
+
{unit:"Turn"}
|
|
24
|
+
];
|
|
@@ -85,4 +85,4 @@ addTest("Script, return dot.", function(){ return dot.script(function(){return 2
|
|
|
85
85
|
addTest("Script, return function.", function(){ return dot.script(function(){return function(){return 2};}).div(1); }, "<div>1</div>");
|
|
86
86
|
|
|
87
87
|
// CSS
|
|
88
|
-
addTest("CSS module included.", function(){ return dot.h(dot
|
|
88
|
+
addTest("CSS module included.", function(){ return dot.h(dot["css"] ? "yes" : "no"); }, "yes");
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import addTest from "
|
|
2
|
-
import dot from "
|
|
3
|
-
import Component from "
|
|
1
|
+
import addTest from "../core";
|
|
2
|
+
import dot from "../../src/dothtml";
|
|
3
|
+
import Component from "../../src/component";
|
|
4
4
|
|
|
5
5
|
// For testing the passing of data into and out of components via properties and events, respectively.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import addTest from "
|
|
2
|
-
import dot from "
|
|
3
|
-
import Component from "
|
|
1
|
+
import addTest from "../core";
|
|
2
|
+
import dot, { DotComponent } from "../../src/dothtml";
|
|
3
|
+
import Component from "../../src/component";
|
|
4
4
|
|
|
5
5
|
class comp_legacy extends dot.Component{
|
|
6
6
|
|
|
@@ -211,11 +211,12 @@ addTest("Styles should not apply to nested elements.", function(){
|
|
|
211
211
|
return dot.div(this.params[0]);
|
|
212
212
|
}
|
|
213
213
|
style(css){
|
|
214
|
+
// console.log("CSS???", !!css);
|
|
214
215
|
css("div").backgroundColor("#FF0000");
|
|
215
216
|
}
|
|
216
217
|
};
|
|
217
218
|
|
|
218
|
-
class CompInner extends
|
|
219
|
+
class CompInner extends DotComponent{
|
|
219
220
|
builder(){
|
|
220
221
|
return dot.div("FOOBAR");
|
|
221
222
|
}
|
|
@@ -17,7 +17,7 @@ class CompBindingInputChangeOption extends Component{
|
|
|
17
17
|
//this.myValue.setFrom(this.$el.childNodes[1]);
|
|
18
18
|
var v = dot(this.$el).as(dot.select).getVal();
|
|
19
19
|
this.$el.children[1].dispatchEvent(new Event("change"));
|
|
20
|
-
dot(this.$el.parentNode).empty()
|
|
20
|
+
dot(this.$el.parentNode as ParentNode).empty()
|
|
21
21
|
.div("Var: " + this.props.myValue)
|
|
22
22
|
.div("Input: " + v);
|
|
23
23
|
}
|
|
@@ -58,7 +58,7 @@ class CompBindingWrite extends Component{
|
|
|
58
58
|
}
|
|
59
59
|
ready(){
|
|
60
60
|
var v = dot(this.$el).as(dot.input).getVal();
|
|
61
|
-
dot(this.$el.parentNode).empty()
|
|
61
|
+
dot(this.$el.parentNode as ParentNode).empty()
|
|
62
62
|
.div("Var: " + this.props.v2)
|
|
63
63
|
.div("Input: " + v);
|
|
64
64
|
}
|
|
@@ -73,7 +73,7 @@ class CompBindingVarChange extends Component{
|
|
|
73
73
|
ready(){
|
|
74
74
|
this.props.v1 = this.props.v2;
|
|
75
75
|
var v = dot(this.$el).as(dot.input).getVal();
|
|
76
|
-
dot(this.$el.parentNode).empty()
|
|
76
|
+
dot(this.$el.parentNode as ParentNode).empty()
|
|
77
77
|
.div("Var: " + this.props.v1)
|
|
78
78
|
.div("Input: " + v);
|
|
79
79
|
}
|
|
@@ -92,7 +92,7 @@ class CompBindingInputChange extends Component{
|
|
|
92
92
|
var v = dot(this.$el).as(dot.input).getVal();
|
|
93
93
|
this.$el.dispatchEvent(new Event("change"));
|
|
94
94
|
//this.v1 = v;
|
|
95
|
-
dot(this.$el.parentNode).empty()
|
|
95
|
+
dot(this.$el.parentNode as ParentNode).empty()
|
|
96
96
|
.div("Var: " + this.props.v1)
|
|
97
97
|
.div("Input: " + v);
|
|
98
98
|
}
|
|
@@ -113,7 +113,7 @@ class CompBindingWriteOption extends Component{
|
|
|
113
113
|
}
|
|
114
114
|
ready(){
|
|
115
115
|
var v = dot(this.$el).as(dot.select).getVal();
|
|
116
|
-
dot(this.$el.parentNode).empty()
|
|
116
|
+
dot(this.$el.parentNode as ParentNode).empty()
|
|
117
117
|
.div("Var: " + this.props.myValue).div("Input: " + v)
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -129,7 +129,7 @@ class CompBindingVarChangeOption extends Component{
|
|
|
129
129
|
ready(){
|
|
130
130
|
this.props.myValue = true;
|
|
131
131
|
var v = dot(this.$el).as(dot.select).getVal();
|
|
132
|
-
dot(this.$el.parentNode).empty()
|
|
132
|
+
dot(this.$el.parentNode as ParentNode).empty()
|
|
133
133
|
.div("Var: " + this.props.myValue)
|
|
134
134
|
.div("Input: " + v)
|
|
135
135
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* 2022-07-28
|
|
4
|
+
* The goal of these tests is to verify that the builder and style functions are called once when properties are updated.
|
|
5
|
+
* The previous behavior was that specific elements within components would only be re-rendered if a property was used inside of a function.
|
|
6
|
+
* This resulted in some annoying syntax, such as `dot.div(()=>{return this.props.x})`. And then restyling wouldn't happen at all unless expliticly executed.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import dot, { DotComponent, IDotCss, IDotElement } from "../src/dothtml";
|
|
10
|
+
import addTest from "./core";
|
|
11
|
+
|
|
12
|
+
class TestComponentA extends DotComponent{
|
|
13
|
+
props={
|
|
14
|
+
myValue: "not-set",
|
|
15
|
+
rebuild: "no",
|
|
16
|
+
restyle: "no",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
builds: number = 0;
|
|
20
|
+
styled: number = 0;
|
|
21
|
+
|
|
22
|
+
builder(): IDotElement {
|
|
23
|
+
this.builds++;
|
|
24
|
+
|
|
25
|
+
this.props.rebuild;
|
|
26
|
+
|
|
27
|
+
return dot.div(
|
|
28
|
+
dot.div(this.props.myValue).div(this.props.myValue).div(()=>{ return this.props.myValue })
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
style(css: IDotCss){
|
|
33
|
+
this.styled++;
|
|
34
|
+
|
|
35
|
+
this.props.restyle;
|
|
36
|
+
this.props.myValue;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// addTest("Basic build and style.", function(){
|
|
41
|
+
// let component = new TestComponentA();
|
|
42
|
+
// dot(document.body).h(component);
|
|
43
|
+
|
|
44
|
+
// return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
|
|
45
|
+
// }, "<div><div>not-set</div><div>not-set</div><div>not-set</div></div> 1 1");
|
|
46
|
+
|
|
47
|
+
// addTest("Update rebuild prop.", function(){
|
|
48
|
+
// let component = new TestComponentA();
|
|
49
|
+
// dot(document.body).h(component);
|
|
50
|
+
|
|
51
|
+
// component.props.rebuild = "yes 1";
|
|
52
|
+
// component.props.rebuild = "yes 2";
|
|
53
|
+
|
|
54
|
+
// return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
|
|
55
|
+
// }, "<div><div>not-set</div><div>not-set</div><div>not-set</div></div> 3 1");
|
|
56
|
+
|
|
57
|
+
// addTest("Update restyle prop.", function(){
|
|
58
|
+
// let component = new TestComponentA();
|
|
59
|
+
// dot(document.body).h(component);
|
|
60
|
+
|
|
61
|
+
// component.props.restyle = "yes 1";
|
|
62
|
+
// component.props.restyle = "yes 2";
|
|
63
|
+
|
|
64
|
+
// return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
|
|
65
|
+
// }, "<div><div>not-set</div><div>not-set</div><div>not-set</div></div> 1 3");
|
|
66
|
+
|
|
67
|
+
addTest("Update value.", function(){
|
|
68
|
+
let component = new TestComponentA();
|
|
69
|
+
dot(document.body).h(component);
|
|
70
|
+
|
|
71
|
+
component.props.myValue = "set";
|
|
72
|
+
|
|
73
|
+
return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
|
|
74
|
+
}, "<div><div>set</div><div>set</div><div>set</div></div> 2 2");
|
|
75
|
+
|
|
76
|
+
// addTest("Update value and other props.", function(){
|
|
77
|
+
// let component = new TestComponentA();
|
|
78
|
+
// dot(document.body).h(component);
|
|
79
|
+
|
|
80
|
+
// component.props.rebuild = "yes";
|
|
81
|
+
// component.props.restyle = "yes";
|
|
82
|
+
// component.props.myValue = "set";
|
|
83
|
+
|
|
84
|
+
// return dot.h(`${component.$el.outerHTML} ${component.builds} ${component.styled}`);
|
|
85
|
+
// }, "<div><div>set</div><div>set</div><div>set</div></div> 3 3");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import addTest from "../core";
|
|
3
|
+
import dot from "../../src/dothtml";
|
|
4
|
+
|
|
5
|
+
// For testing the passing of data into and out of components via properties and events, respectively.
|
|
6
|
+
|
|
7
|
+
addTest("Dotcss returns stringable value.", function(){
|
|
8
|
+
return dot.div(dot.css.color(0x102030).border("1px solid black").toString());
|
|
9
|
+
}, "<div>color:\"rgb(16, 32, 48);\"border:\" 1px solid black \";</div>");
|
|
10
|
+
|
|
11
|
+
addTest("Styling an element.", function(){
|
|
12
|
+
return dot.div().style(dot.css.color(0x102030).border("1px solid black").toString());
|
|
13
|
+
}, "<div style=\"color:'rgb(16, 32, 48);'border:' 1px solid black ';\"></div>");
|
|
14
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import addTest from "../core";
|
|
2
|
+
import dot from "../../src/dothtml";
|
|
3
|
+
|
|
4
|
+
addTest("Dotcss returns stringable value.", function(){
|
|
5
|
+
return dot.div(dot.css.color(0x102030).border("1px solid black").toString());
|
|
6
|
+
}, `<div>color:"rgb(16, 32, 48);"border:" 1px solid black ";</div>`);
|
|
7
|
+
|
|
8
|
+
addTest("Styling an element.", function(){
|
|
9
|
+
return dot.div().style(dot.css.color(0x102030).border("1px solid black"));
|
|
10
|
+
}, `<div style="color:'rgb(16, 32, 48);'border:' 1px solid black ';"></div>`);
|
|
11
|
+
|
|
12
|
+
addTest("Restyling an element.", function(){
|
|
13
|
+
let div = dot.div().style(dot.css.position("absolute").position("fixed"));
|
|
14
|
+
// dot.css(div.getLast()).position("absolute");
|
|
15
|
+
// dot.css(div.getLast()).position("fixed");
|
|
16
|
+
return div;
|
|
17
|
+
}, `<div style="position: 'fixed';"></div>`);
|
|
18
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import addTest from "../core";
|
|
3
|
+
import dot from "../../src/dothtml";
|
|
4
|
+
|
|
5
|
+
// Possible syntaxes:
|
|
6
|
+
// 1. Multiple style functions.
|
|
7
|
+
// - dot(target).style(dot.css...)
|
|
8
|
+
// - dot(target).styleHover(dot.css...)
|
|
9
|
+
// P: Simple syntax.
|
|
10
|
+
// C: How would this work in a component's style builder? Multiple style builders seems messed up.
|
|
11
|
+
// 2. Pseudo functions.
|
|
12
|
+
// - dot(target).style(dot.css...pseudoHover(css=>css...).pseudoVisited(css=>css...)...)
|
|
13
|
+
// P: Works for component style functions.
|
|
14
|
+
// C: Builder syntax is somewhat heavy.
|
|
15
|
+
// 3. DOThtml style.
|
|
16
|
+
// - dot(target).style(dot.css...pseudoHover...pseudoVisted...pseudoNone...)
|
|
17
|
+
// P: No weird function syntax.
|
|
18
|
+
// P: Consistent with dothtml.
|
|
19
|
+
// C: Inconsistent with dotcss.
|
|
20
|
+
// C: Just weird.
|
|
21
|
+
// 4. Pseudo functions v2.
|
|
22
|
+
// - dot(target).style(dot.css...pseudo("hover", css=>css...).pseudo("visited", css=>css...)...)
|
|
23
|
+
// P/C: same as 2.
|
|
24
|
+
|
|
25
|
+
// I think 2 is the winner.
|
|
26
|
+
|
|
27
|
+
// addTest("Dotcss returns stringable value.", function(){
|
|
28
|
+
// return dot.a("Hover over me!").style(dot.css.pseudoHover(c=>c.color("green")));
|
|
29
|
+
// }, `<a style="color:"rgb(0, 255, 0);">Hover over me!</a>`); // TODO: need a way to inject the hover event.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
|
|
2
|
+
import addTest from "../core";
|
|
3
|
+
import dot from "../../src/dothtml";
|
|
4
|
+
|
|
5
|
+
// Test coverage should include:
|
|
6
|
+
// perspective: (v: LengthOrDefault)=>ITransformationContext;
|
|
7
|
+
|
|
8
|
+
addTest("Matrix.", function(){
|
|
9
|
+
return dot.div().style(
|
|
10
|
+
dot.css.transform(t=>t.matrix(1,2,3,4,5,6))
|
|
11
|
+
);
|
|
12
|
+
}, `<div style="transform:'matrix(1,2,3,4,5,6)';"></div>`);
|
|
13
|
+
addTest("Matrix 3d.", function(){
|
|
14
|
+
return dot.div().style(
|
|
15
|
+
dot.css.transform(t=>t.matrix3d(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16))
|
|
16
|
+
);
|
|
17
|
+
}, `<div style="transform:'matrix3d(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)';"></div>`);
|
|
18
|
+
|
|
19
|
+
addTest("Translate (x only).", function(){
|
|
20
|
+
return dot.div().style(
|
|
21
|
+
dot.css.transform(t=>t.translate(10))
|
|
22
|
+
);
|
|
23
|
+
}, `<div style="transform:'translate(10px)';"></div>`);
|
|
24
|
+
addTest("Translate.", function(){
|
|
25
|
+
return dot.div().style(
|
|
26
|
+
dot.css.transform(t=>t.translate(10, 20))
|
|
27
|
+
);
|
|
28
|
+
}, `<div style="transform:'translate(10px,20px)';"></div>`);
|
|
29
|
+
addTest("Translate (custom units).", function(){
|
|
30
|
+
return dot.div().style(
|
|
31
|
+
dot.css.transform(t=>t.translate("10cm", "20cm"))
|
|
32
|
+
);
|
|
33
|
+
}, `<div style="transform:'translate(10cm,20cm)';"></div>`);
|
|
34
|
+
addTest("Translate (unit function).", function(){
|
|
35
|
+
return dot.div().style(
|
|
36
|
+
dot.css.transform(t=>t.translateCm(10, 20))
|
|
37
|
+
);
|
|
38
|
+
}, `<div style="transform:'translate(10cm,20cm)';"></div>`);
|
|
39
|
+
addTest("Translate X.", function(){
|
|
40
|
+
return dot.div().style(
|
|
41
|
+
dot.css.transform(t=>t.translateX("10cm"))
|
|
42
|
+
);
|
|
43
|
+
}, `<div style="transform:'translateX(10cm)';"></div>`);
|
|
44
|
+
addTest("Translate X (unit function).", function(){
|
|
45
|
+
return dot.div().style(
|
|
46
|
+
dot.css.transform(t=>t.translateXCm(10))
|
|
47
|
+
);
|
|
48
|
+
}, `<div style="transform:'translateX(10cm)';"></div>`);
|
|
49
|
+
addTest("Translate Y.", function(){
|
|
50
|
+
return dot.div().style(
|
|
51
|
+
dot.css.transform(t=>t.translateY("10cm"))
|
|
52
|
+
);
|
|
53
|
+
}, `<div style="transform:'translateY(10cm)';"></div>`);
|
|
54
|
+
addTest("Translate Y (unit function).", function(){
|
|
55
|
+
return dot.div().style(
|
|
56
|
+
dot.css.transform(t=>t.translateYCm(10))
|
|
57
|
+
);
|
|
58
|
+
}, `<div style="transform:'translateY(10cm)';"></div>`);
|
|
59
|
+
addTest("Translate Z.", function(){
|
|
60
|
+
return dot.div().style(
|
|
61
|
+
dot.css.transform(t=>t.translateZ("10cm"))
|
|
62
|
+
);
|
|
63
|
+
}, `<div style="transform:'translateZ(10cm)';"></div>`);
|
|
64
|
+
addTest("Translate Z (unit function).", function(){
|
|
65
|
+
return dot.div().style(
|
|
66
|
+
dot.css.transform(t=>t.translateZCm(10))
|
|
67
|
+
);
|
|
68
|
+
}, `<div style="transform:'translateZ(10cm)';"></div>`);
|
|
69
|
+
addTest("Translate 3D.", function(){
|
|
70
|
+
return dot.div().style(
|
|
71
|
+
dot.css.transform(t=>t.translate3d(10, 20, 30))
|
|
72
|
+
);
|
|
73
|
+
}, `<div style="transform:'translate3d(10px,20px,30px)';"></div>`);
|
|
74
|
+
addTest("Translate 3D (unit function).", function(){
|
|
75
|
+
return dot.div().style(
|
|
76
|
+
dot.css.transform(t=>t.translate3dCm(10, 20, 30))
|
|
77
|
+
);
|
|
78
|
+
}, `<div style="transform:'translate3d(10cm,20cm,30cm)';"></div>`);
|
|
79
|
+
|
|
80
|
+
addTest("Scale (x only).", function(){
|
|
81
|
+
return dot.div().style(
|
|
82
|
+
dot.css.transform(t=>t.scale(10))
|
|
83
|
+
);
|
|
84
|
+
}, `<div style="transform:'scale(10,1)';"></div>`);
|
|
85
|
+
addTest("Scale.", function(){
|
|
86
|
+
return dot.div().style(
|
|
87
|
+
dot.css.transform(t=>t.scale(10, 20))
|
|
88
|
+
);
|
|
89
|
+
}, `<div style="transform:'scale(10,20)';"></div>`);
|
|
90
|
+
addTest("Scale custom units.", function(){
|
|
91
|
+
return dot.div().style(
|
|
92
|
+
dot.css.transform(t=>t.scale(10, 20))
|
|
93
|
+
);
|
|
94
|
+
}, `<div style="transform:'scale(10,20)';"></div>`);
|
|
95
|
+
addTest("Scale X.", function(){
|
|
96
|
+
return dot.div().style(
|
|
97
|
+
dot.css.transform(t=>t.scaleX(10))
|
|
98
|
+
);
|
|
99
|
+
}, `<div style="transform:'scaleX(10)';"></div>`);
|
|
100
|
+
addTest("Scale Y.", function(){
|
|
101
|
+
return dot.div().style(
|
|
102
|
+
dot.css.transform(t=>t.scaleY(10))
|
|
103
|
+
);
|
|
104
|
+
}, `<div style="transform:'scaleY(10)';"></div>`);
|
|
105
|
+
addTest("Scale Z.", function(){
|
|
106
|
+
return dot.div().style(
|
|
107
|
+
dot.css.transform(t=>t.scaleZ(10))
|
|
108
|
+
);
|
|
109
|
+
}, `<div style="transform:'scaleZ(10)';"></div>`);
|
|
110
|
+
addTest("Scale 3D.", function(){
|
|
111
|
+
return dot.div().style(
|
|
112
|
+
dot.css.transform(t=>t.scale3d(10, 20, 30))
|
|
113
|
+
);
|
|
114
|
+
}, `<div style="transform:'scale3d(10,20,30)';"></div>`);
|
|
115
|
+
|
|
116
|
+
addTest("Rotate.", function(){
|
|
117
|
+
return dot.div().style(
|
|
118
|
+
dot.css.transform(t=>t.rotate(10))
|
|
119
|
+
);
|
|
120
|
+
}, `<div style="transform:'rotate(10deg)';"></div>`);
|
|
121
|
+
addTest("Rotate custom units.", function(){
|
|
122
|
+
return dot.div().style(
|
|
123
|
+
dot.css.transform(t=>t.rotate("10rad"))
|
|
124
|
+
);
|
|
125
|
+
}, `<div style="transform:'rotate(10rad)';"></div>`);
|
|
126
|
+
addTest("Rotate (unit function).", function(){
|
|
127
|
+
return dot.div().style(
|
|
128
|
+
dot.css.transform(t=>t.rotateGrad(10))
|
|
129
|
+
);
|
|
130
|
+
}, `<div style="transform:'rotate(10grad)';"></div>`);
|
|
131
|
+
addTest("Rotate X.", function(){
|
|
132
|
+
return dot.div().style(
|
|
133
|
+
dot.css.transform(t=>t.rotateX(10))
|
|
134
|
+
);
|
|
135
|
+
}, `<div style="transform:'rotateX(10deg)';"></div>`);
|
|
136
|
+
addTest("Rotate X (unit function).", function(){
|
|
137
|
+
return dot.div().style(
|
|
138
|
+
dot.css.transform(t=>t.rotateXTurn(10))
|
|
139
|
+
);
|
|
140
|
+
}, `<div style="transform:'rotateX(10turn)';"></div>`);
|
|
141
|
+
addTest("Rotate Y.", function(){
|
|
142
|
+
return dot.div().style(
|
|
143
|
+
dot.css.transform(t=>t.rotateY(10))
|
|
144
|
+
);
|
|
145
|
+
}, `<div style="transform:'rotateY(10deg)';"></div>`);
|
|
146
|
+
addTest("Rotate Y (unit function).", function(){
|
|
147
|
+
return dot.div().style(
|
|
148
|
+
dot.css.transform(t=>t.rotateYRad(10))
|
|
149
|
+
);
|
|
150
|
+
}, `<div style="transform:'rotateY(10rad)';"></div>`);
|
|
151
|
+
addTest("Rotate Z.", function(){
|
|
152
|
+
return dot.div().style(
|
|
153
|
+
dot.css.transform(t=>t.rotateZ(10))
|
|
154
|
+
);
|
|
155
|
+
}, `<div style="transform:'rotateZ(10deg)';"></div>`);
|
|
156
|
+
addTest("Rotate Z (unit function).", function(){
|
|
157
|
+
return dot.div().style(
|
|
158
|
+
dot.css.transform(t=>t.rotateZGrad(10))
|
|
159
|
+
);
|
|
160
|
+
}, `<div style="transform:'rotateZ(10grad)';"></div>`);
|
|
161
|
+
addTest("Rotate 3D.", function(){
|
|
162
|
+
return dot.div().style(
|
|
163
|
+
dot.css.transform(t=>t.rotate3d(10, 20, 30, 40))
|
|
164
|
+
);
|
|
165
|
+
}, `<div style="transform:'rotate3d(10,20,30,40deg)';"></div>`);
|
|
166
|
+
addTest("Rotate 3D (unit function).", function(){
|
|
167
|
+
return dot.div().style(
|
|
168
|
+
dot.css.transform(t=>t.rotate3dRad(10, 20, 30, 40))
|
|
169
|
+
);
|
|
170
|
+
}, `<div style="transform:'rotate3d(10,20,30,40rad)';"></div>`);
|
|
171
|
+
|
|
172
|
+
addTest("Skew (x only).", function(){
|
|
173
|
+
return dot.div().style(
|
|
174
|
+
dot.css.transform(t=>t.skew(1))
|
|
175
|
+
);
|
|
176
|
+
}, `<div style="transform:'skew(1deg)';"></div>`);
|
|
177
|
+
addTest("Skew.", function(){
|
|
178
|
+
return dot.div().style(
|
|
179
|
+
dot.css.transform(t=>t.skew(1, 2))
|
|
180
|
+
);
|
|
181
|
+
}, `<div style="transform:'skew(1deg,2deg)';"></div>`);
|
|
182
|
+
addTest("Skew (custom units).", function(){
|
|
183
|
+
return dot.div().style(
|
|
184
|
+
dot.css.transform(t=>t.skew("1grad", "2deg"))
|
|
185
|
+
);
|
|
186
|
+
}, `<div style="transform:'skew(1grad,2deg)';"></div>`);
|
|
187
|
+
addTest("Skew (unit function).", function(){
|
|
188
|
+
return dot.div().style(
|
|
189
|
+
dot.css.transform(t=>t.skewGrad(1, 2))
|
|
190
|
+
);
|
|
191
|
+
}, `<div style="transform:'skew(1grad,2grad)';"></div>`);
|
|
192
|
+
addTest("Skew X.", function(){
|
|
193
|
+
return dot.div().style(
|
|
194
|
+
dot.css.transform(t=>t.skewX(5))
|
|
195
|
+
);
|
|
196
|
+
}, `<div style="transform:'skewX(5deg)';"></div>`);
|
|
197
|
+
addTest("Skew X (unit function).", function(){
|
|
198
|
+
return dot.div().style(
|
|
199
|
+
dot.css.transform(t=>t.skewXRad(5))
|
|
200
|
+
);
|
|
201
|
+
}, `<div style="transform:'skewX(5rad)';"></div>`);
|
|
202
|
+
addTest("Skew Y.", function(){
|
|
203
|
+
return dot.div().style(
|
|
204
|
+
dot.css.transform(t=>t.skewY(5))
|
|
205
|
+
);
|
|
206
|
+
}, `<div style="transform:'skewY(5deg)';"></div>`);
|
|
207
|
+
addTest("Skew Y (unit function).", function(){
|
|
208
|
+
return dot.div().style(
|
|
209
|
+
dot.css.transform(t=>t.skewYTurn(0.5))
|
|
210
|
+
);
|
|
211
|
+
}, `<div style="transform:'skewY(0.5turn)';"></div>`);
|
|
212
|
+
|
|
213
|
+
addTest("Perspective.", function(){
|
|
214
|
+
return dot.div().style(
|
|
215
|
+
dot.css.transform(t=>t.perspective(100))
|
|
216
|
+
);
|
|
217
|
+
}, `<div style="transform:'perspective(100px)';"></div>`);
|
|
218
|
+
addTest("Perspective (units).", function(){
|
|
219
|
+
return dot.div().style(
|
|
220
|
+
dot.css.transform(t=>t.perspective("100cm"))
|
|
221
|
+
);
|
|
222
|
+
}, `<div style="transform:'perspective(100cm)';"></div>`);
|
|
223
|
+
addTest("Perspective (unit function).", function(){
|
|
224
|
+
return dot.div().style(
|
|
225
|
+
dot.css.transform(t=>t.perspectiveCm(100))
|
|
226
|
+
);
|
|
227
|
+
}, `<div style="transform:'perspective(100cm)';"></div>`);
|
|
228
|
+
|
|
229
|
+
addTest("Combined transformation.", function(){
|
|
230
|
+
return dot.div().style(
|
|
231
|
+
dot.css.transform(t=>t.translate("10cm", "20cm").scale(2,4).rotate("0.5turn"))
|
|
232
|
+
);
|
|
233
|
+
}, `<div style="transform:'translate(10cm,20cm) scale(2,4) rotate(0.5turn)';"></div>`);
|
|
234
|
+
|
|
File without changes
|
package/lib/dot-document.d.ts
DELETED
|
File without changes
|
package/lib/style-builder.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// import { ClassPrefix, eachK, isF, str } from "./dot-util";
|
|
2
|
-
// import ERR from "./err";
|
|
3
|
-
// import ObservableArray from "./observable-array";
|
|
4
|
-
// import { AttrArgCallback } from "./arg-callback-obj";
|
|
5
|
-
|
|
6
|
-
// /** How it works:
|
|
7
|
-
// *
|
|
8
|
-
// * DotComponent represents the prototype for all components.
|
|
9
|
-
// * You create a component with dot.component().
|
|
10
|
-
// * This creates a new class (CC), which acts as the prototype to that component.
|
|
11
|
-
// * The prototype of CC is set to a new DotComponent.
|
|
12
|
-
// * Instantiating the component creates a new CC.
|
|
13
|
-
// * This CC is the `this` for each method of the component.
|
|
14
|
-
// *
|
|
15
|
-
// *
|
|
16
|
-
// * */
|
|
17
|
-
|
|
18
|
-
// /** How computed props work.
|
|
19
|
-
// *
|
|
20
|
-
// * If a computed property has a dependency on a regular property,
|
|
21
|
-
// * assigning the computed property to an element will cause the regular property's getter to trigger, establishing the dependency.
|
|
22
|
-
// * */
|
|
23
|
-
|
|
24
|
-
// function DotComponent(){
|
|
25
|
-
// this.$el = null;
|
|
26
|
-
// this.$refs = {};
|
|
27
|
-
// this.__handlers = {};
|
|
28
|
-
// }
|
|
29
|
-
|
|
30
|
-
// DotComponent.prototype.__addHandler = function(eventName, event){
|
|
31
|
-
// var h = this.__handlers[eventName];
|
|
32
|
-
// if(!h) h = this.__handlers[eventName] = [];
|
|
33
|
-
// h.push(event);
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
// var dot, _p, _D;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// /**
|
|
45
|
-
|
|
46
|
-
// */
|
|
47
|
-
// export function addComponent(prms: ComponentParams){
|
|
48
|
-
|
|
49
|
-
// // Setting this potentially allows automatic code completion to get the method signature from builder.
|
|
50
|
-
// // var comp = prms.builder;
|
|
51
|
-
|
|
52
|
-
// let n = prms.name;
|
|
53
|
-
|
|
54
|
-
// n && (componentNames[n] = 1);
|
|
55
|
-
// var CC = function(){
|
|
56
|
-
// DotComponent.call(this);
|
|
57
|
-
// this.rawProps = {};
|
|
58
|
-
// this.__propDependencies = {};
|
|
59
|
-
// this.__prms = prms;
|
|
60
|
-
// }
|
|
61
|
-
// CC.prototype = Object.create(DotComponent.prototype);
|
|
62
|
-
// CC.prototype.constructor = CC;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// prms.registered && prms.registered.apply(CC.prototype);
|
|
69
|
-
|
|
70
|
-
// return comp;
|
|
71
|
-
// };
|
|
72
|
-
|
|
73
|
-
// // export function removeComponent(name){
|
|
74
|
-
// // if(componentNames[name]){
|
|
75
|
-
// // delete componentNames[name];
|
|
76
|
-
// // delete dot[name];
|
|
77
|
-
// // delete _p[name];
|
|
78
|
-
// // }
|
|
79
|
-
// // }
|
package/src/dot-document.ts
DELETED
|
File without changes
|