cx 24.7.1 → 24.7.2
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/dist/manifest.js +799 -799
- package/dist/ui.js +3 -3
- package/package.json +1 -1
- package/src/charts/Legend.js +151 -151
- package/src/charts/Marker.d.ts +96 -96
- package/src/charts/Marker.js +299 -299
- package/src/charts/PieLabel.js +71 -71
- package/src/charts/axis/Axis.d.ts +96 -96
- package/src/charts/axis/NumericAxis.js +347 -347
- package/src/charts/axis/Stack.js +55 -55
- package/src/data/Binding.spec.js +69 -69
- package/src/data/StringTemplate.spec.js +105 -105
- package/src/data/getAccessor.spec.js +11 -11
- package/src/svg/Text.d.ts +40 -40
- package/src/ui/Controller.d.ts +182 -182
- package/src/ui/Culture.js +129 -129
- package/src/ui/Cx.js +313 -313
- package/src/ui/FocusManager.js +171 -171
- package/src/ui/Instance.d.ts +72 -72
- package/src/ui/VDOM.d.ts +12 -12
- package/src/ui/app/startAppLoop.js +58 -58
- package/src/ui/index.d.ts +42 -42
- package/src/util/Console.d.ts +4 -4
- package/src/widgets/drag-drop/DropZone.js +214 -214
- package/src/widgets/form/TextField.js +289 -289
- package/src/widgets/form/UploadButton.d.ts +34 -34
- package/src/widgets/grid/variables.scss +88 -88
- package/src/widgets/overlay/Dropdown.js +612 -612
- package/src/widgets/overlay/Window.js +196 -196
- package/src/widgets/overlay/variables.scss +83 -83
package/src/charts/axis/Stack.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
export class Stack {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.reset();
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
reset() {
|
|
7
|
-
this.stacks = {};
|
|
8
|
-
this.values = {};
|
|
9
|
-
this.normalized = false;
|
|
10
|
-
this.invalid = {};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
acknowledge(ordinal, value) {
|
|
14
|
-
if (value != null) {
|
|
15
|
-
let s = this.stacks[ordinal];
|
|
16
|
-
if (!s) this.stacks[ordinal] = s = { total: 0, min: 0, max: 0 };
|
|
17
|
-
s.total += value;
|
|
18
|
-
if (s.total < s.min) s.min = s.total;
|
|
19
|
-
if (s.total > s.max) s.max = s.total;
|
|
20
|
-
} else {
|
|
21
|
-
this.invalid[ordinal] = true;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
measure(normalized) {
|
|
26
|
-
if (normalized) {
|
|
27
|
-
this.normalized = true;
|
|
28
|
-
return [0, 1];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
let max = 0,
|
|
32
|
-
min = 0;
|
|
33
|
-
for (let key in this.stacks) {
|
|
34
|
-
if (this.stacks[key].max > max) max = this.stacks[key].max;
|
|
35
|
-
if (this.stacks[key].min < min) min = this.stacks[key].min;
|
|
36
|
-
}
|
|
37
|
-
return [min, max];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
stack(ordinal, value) {
|
|
41
|
-
if (value == null || this.invalid[ordinal]) return null;
|
|
42
|
-
|
|
43
|
-
let base = this.values[ordinal] || 0;
|
|
44
|
-
|
|
45
|
-
let result = (this.values[ordinal] = base + value);
|
|
46
|
-
|
|
47
|
-
if (!this.normalized) return result;
|
|
48
|
-
|
|
49
|
-
let total = this.stacks[ordinal].total;
|
|
50
|
-
|
|
51
|
-
if (total > 0) return result / total;
|
|
52
|
-
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
export class Stack {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.reset();
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
reset() {
|
|
7
|
+
this.stacks = {};
|
|
8
|
+
this.values = {};
|
|
9
|
+
this.normalized = false;
|
|
10
|
+
this.invalid = {};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
acknowledge(ordinal, value) {
|
|
14
|
+
if (value != null) {
|
|
15
|
+
let s = this.stacks[ordinal];
|
|
16
|
+
if (!s) this.stacks[ordinal] = s = { total: 0, min: 0, max: 0 };
|
|
17
|
+
s.total += value;
|
|
18
|
+
if (s.total < s.min) s.min = s.total;
|
|
19
|
+
if (s.total > s.max) s.max = s.total;
|
|
20
|
+
} else {
|
|
21
|
+
this.invalid[ordinal] = true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
measure(normalized) {
|
|
26
|
+
if (normalized) {
|
|
27
|
+
this.normalized = true;
|
|
28
|
+
return [0, 1];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let max = 0,
|
|
32
|
+
min = 0;
|
|
33
|
+
for (let key in this.stacks) {
|
|
34
|
+
if (this.stacks[key].max > max) max = this.stacks[key].max;
|
|
35
|
+
if (this.stacks[key].min < min) min = this.stacks[key].min;
|
|
36
|
+
}
|
|
37
|
+
return [min, max];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
stack(ordinal, value) {
|
|
41
|
+
if (value == null || this.invalid[ordinal]) return null;
|
|
42
|
+
|
|
43
|
+
let base = this.values[ordinal] || 0;
|
|
44
|
+
|
|
45
|
+
let result = (this.values[ordinal] = base + value);
|
|
46
|
+
|
|
47
|
+
if (!this.normalized) return result;
|
|
48
|
+
|
|
49
|
+
let total = this.stacks[ordinal].total;
|
|
50
|
+
|
|
51
|
+
if (total > 0) return result / total;
|
|
52
|
+
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
package/src/data/Binding.spec.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { Binding } from "./Binding";
|
|
2
|
-
import assert from "assert";
|
|
3
|
-
import { createAccessorModelProxy } from "./createAccessorModelProxy";
|
|
4
|
-
|
|
5
|
-
describe("Binding", function () {
|
|
6
|
-
describe("#get()", function () {
|
|
7
|
-
it("should get value if value is defined", function () {
|
|
8
|
-
var state = { person: { name: "Joe" } };
|
|
9
|
-
var b = Binding.get("person.name");
|
|
10
|
-
assert.equal(b.value(state), "Joe");
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("allows non-standard property identifiers", function () {
|
|
14
|
-
var state = { person: { "@schema": "Person" } };
|
|
15
|
-
var b = Binding.get("person.@schema");
|
|
16
|
-
assert.equal(b.path, "person.@schema");
|
|
17
|
-
assert.equal(b.value(state), "Person");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("properly resolves accessor models", function () {
|
|
21
|
-
var state = { person: { schema: "Person" } };
|
|
22
|
-
var b = Binding.get(createAccessorModelProxy("person.schema"));
|
|
23
|
-
assert.equal(b.value(state), "Person");
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe("#set()", function () {
|
|
28
|
-
it("produces new objects along the binding path", function () {
|
|
29
|
-
var state = { person: { name: "Joe" } };
|
|
30
|
-
var b = Binding.get("person.name");
|
|
31
|
-
var ns = b.set(state, "Jack");
|
|
32
|
-
assert.equal(ns.person.name, "Jack");
|
|
33
|
-
assert.notEqual(state, ns);
|
|
34
|
-
assert.notEqual(state.person, ns.person);
|
|
35
|
-
assert.notEqual(state.person.name, ns.person.name);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("returns same state object if value does not change", function () {
|
|
39
|
-
var state = { person: { name: "Joe" } };
|
|
40
|
-
var b = Binding.get("person.name");
|
|
41
|
-
var ns = b.set(state, "Joe");
|
|
42
|
-
assert.equal(state, ns);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("allows non-standard property identifiers", function () {
|
|
46
|
-
var state = { person: { "@schema": "Person" } };
|
|
47
|
-
var b = Binding.get("person.@schema");
|
|
48
|
-
var ns = b.set(state, "Test");
|
|
49
|
-
assert.equal(ns.person["@schema"], "Test");
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe(".delete()", function () {
|
|
54
|
-
it("correctly removes pointed properties", function () {
|
|
55
|
-
var state = { person: { name: "Joe" } };
|
|
56
|
-
var b = Binding.get("person.name");
|
|
57
|
-
var ns = b.delete(state);
|
|
58
|
-
assert("person" in ns);
|
|
59
|
-
assert(!("name" in ns.person));
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("does not change state if property is non-existent", function () {
|
|
63
|
-
var state = { person: { name: "Joe" } };
|
|
64
|
-
var b = Binding.get("person.name2");
|
|
65
|
-
var ns = b.delete(state);
|
|
66
|
-
assert(ns == state);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
});
|
|
1
|
+
import { Binding } from "./Binding";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
import { createAccessorModelProxy } from "./createAccessorModelProxy";
|
|
4
|
+
|
|
5
|
+
describe("Binding", function () {
|
|
6
|
+
describe("#get()", function () {
|
|
7
|
+
it("should get value if value is defined", function () {
|
|
8
|
+
var state = { person: { name: "Joe" } };
|
|
9
|
+
var b = Binding.get("person.name");
|
|
10
|
+
assert.equal(b.value(state), "Joe");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("allows non-standard property identifiers", function () {
|
|
14
|
+
var state = { person: { "@schema": "Person" } };
|
|
15
|
+
var b = Binding.get("person.@schema");
|
|
16
|
+
assert.equal(b.path, "person.@schema");
|
|
17
|
+
assert.equal(b.value(state), "Person");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("properly resolves accessor models", function () {
|
|
21
|
+
var state = { person: { schema: "Person" } };
|
|
22
|
+
var b = Binding.get(createAccessorModelProxy("person.schema"));
|
|
23
|
+
assert.equal(b.value(state), "Person");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("#set()", function () {
|
|
28
|
+
it("produces new objects along the binding path", function () {
|
|
29
|
+
var state = { person: { name: "Joe" } };
|
|
30
|
+
var b = Binding.get("person.name");
|
|
31
|
+
var ns = b.set(state, "Jack");
|
|
32
|
+
assert.equal(ns.person.name, "Jack");
|
|
33
|
+
assert.notEqual(state, ns);
|
|
34
|
+
assert.notEqual(state.person, ns.person);
|
|
35
|
+
assert.notEqual(state.person.name, ns.person.name);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("returns same state object if value does not change", function () {
|
|
39
|
+
var state = { person: { name: "Joe" } };
|
|
40
|
+
var b = Binding.get("person.name");
|
|
41
|
+
var ns = b.set(state, "Joe");
|
|
42
|
+
assert.equal(state, ns);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("allows non-standard property identifiers", function () {
|
|
46
|
+
var state = { person: { "@schema": "Person" } };
|
|
47
|
+
var b = Binding.get("person.@schema");
|
|
48
|
+
var ns = b.set(state, "Test");
|
|
49
|
+
assert.equal(ns.person["@schema"], "Test");
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe(".delete()", function () {
|
|
54
|
+
it("correctly removes pointed properties", function () {
|
|
55
|
+
var state = { person: { name: "Joe" } };
|
|
56
|
+
var b = Binding.get("person.name");
|
|
57
|
+
var ns = b.delete(state);
|
|
58
|
+
assert("person" in ns);
|
|
59
|
+
assert(!("name" in ns.person));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("does not change state if property is non-existent", function () {
|
|
63
|
+
var state = { person: { name: "Joe" } };
|
|
64
|
+
var b = Binding.get("person.name2");
|
|
65
|
+
var ns = b.delete(state);
|
|
66
|
+
assert(ns == state);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { StringTemplate } from "./StringTemplate";
|
|
2
|
-
import assert from "assert";
|
|
3
|
-
|
|
4
|
-
describe("StringTemplate", function () {
|
|
5
|
-
describe("#compile()", function () {
|
|
6
|
-
it("returns a selector", function () {
|
|
7
|
-
var e = StringTemplate.compile("Hello {person.name}");
|
|
8
|
-
var state = {
|
|
9
|
-
person: {
|
|
10
|
-
name: "Jim",
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
assert.equal(e(state), "Hello Jim");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("properly encodes ' and \"", function () {
|
|
17
|
-
var e = StringTemplate.compile('It\'s "working"!');
|
|
18
|
-
assert.equal(e({}), 'It\'s "working"!');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("supports multi-line strings", function () {
|
|
22
|
-
var e = StringTemplate.compile("a\nb");
|
|
23
|
-
assert.equal(e(), "a\nb");
|
|
24
|
-
|
|
25
|
-
var e = StringTemplate.compile("a\r\nb");
|
|
26
|
-
assert.equal(e(), "a\r\nb");
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
describe("double brackets are used to escape brackets", function () {
|
|
31
|
-
it("double brackets are preserved", function () {
|
|
32
|
-
var e = StringTemplate.compile("Hello {{person.name}}");
|
|
33
|
-
var state = {
|
|
34
|
-
person: {
|
|
35
|
-
name: "Jim",
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
assert.equal(e(state), "Hello {person.name}");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("triple brackets are converted to single brackets and a binding", function () {
|
|
42
|
-
var e = StringTemplate.compile("Hello {{{person.name}}}");
|
|
43
|
-
var state = {
|
|
44
|
-
person: {
|
|
45
|
-
name: "Jim",
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
assert.equal(e(state), "Hello {Jim}");
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe("supports formatting", function () {
|
|
53
|
-
it("with colon", function () {
|
|
54
|
-
var e = StringTemplate.compile("{str:suffix;kg}");
|
|
55
|
-
assert.equal(e({ str: "5" }), "5kg");
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("with multiple formats", function () {
|
|
59
|
-
var e = StringTemplate.compile("{str:suffix;kg:wrap;(;)}");
|
|
60
|
-
assert.equal(e({ str: "5" }), "(5kg)");
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it("with null values", function () {
|
|
64
|
-
var e = StringTemplate.compile("{str:suffix;kg:|N/A}");
|
|
65
|
-
assert.equal(e({ str: null }), "N/A");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("of null values", function () {
|
|
69
|
-
var e = StringTemplate.compile("{str|N/A}");
|
|
70
|
-
assert.equal(e({ str: null }), "N/A");
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe("supports expressions", function () {
|
|
75
|
-
it("using []", function () {
|
|
76
|
-
var e = StringTemplate.compile("1 + 2 = {[1+2]}");
|
|
77
|
-
assert.equal(e(), "1 + 2 = 3");
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it("using %", function () {
|
|
81
|
-
var e = StringTemplate.compile("1 + 2 = %{1+2}");
|
|
82
|
-
assert.equal(e(), "1 + 2 = 3");
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it("with subexpressions", function () {
|
|
86
|
-
var e = StringTemplate.compile("1 + 2 = {[%{1+2}]}");
|
|
87
|
-
assert.equal(e(), "1 + 2 = 3");
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("with a conditional operator", function () {
|
|
91
|
-
var e = StringTemplate.compile("1 + 2 = {[true ? 3 : 2]:s}");
|
|
92
|
-
assert.equal(e(), "1 + 2 = 3");
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("with sub-expression formatting", function () {
|
|
96
|
-
var e = StringTemplate.compile("{[!!{person.age} ? {person.age:suffix; years old} : 'Age unknown']}");
|
|
97
|
-
var state = {
|
|
98
|
-
person: {
|
|
99
|
-
age: 32,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
assert.equal(e(state), "32 years old");
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
1
|
+
import { StringTemplate } from "./StringTemplate";
|
|
2
|
+
import assert from "assert";
|
|
3
|
+
|
|
4
|
+
describe("StringTemplate", function () {
|
|
5
|
+
describe("#compile()", function () {
|
|
6
|
+
it("returns a selector", function () {
|
|
7
|
+
var e = StringTemplate.compile("Hello {person.name}");
|
|
8
|
+
var state = {
|
|
9
|
+
person: {
|
|
10
|
+
name: "Jim",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
assert.equal(e(state), "Hello Jim");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("properly encodes ' and \"", function () {
|
|
17
|
+
var e = StringTemplate.compile('It\'s "working"!');
|
|
18
|
+
assert.equal(e({}), 'It\'s "working"!');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("supports multi-line strings", function () {
|
|
22
|
+
var e = StringTemplate.compile("a\nb");
|
|
23
|
+
assert.equal(e(), "a\nb");
|
|
24
|
+
|
|
25
|
+
var e = StringTemplate.compile("a\r\nb");
|
|
26
|
+
assert.equal(e(), "a\r\nb");
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("double brackets are used to escape brackets", function () {
|
|
31
|
+
it("double brackets are preserved", function () {
|
|
32
|
+
var e = StringTemplate.compile("Hello {{person.name}}");
|
|
33
|
+
var state = {
|
|
34
|
+
person: {
|
|
35
|
+
name: "Jim",
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
assert.equal(e(state), "Hello {person.name}");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("triple brackets are converted to single brackets and a binding", function () {
|
|
42
|
+
var e = StringTemplate.compile("Hello {{{person.name}}}");
|
|
43
|
+
var state = {
|
|
44
|
+
person: {
|
|
45
|
+
name: "Jim",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
assert.equal(e(state), "Hello {Jim}");
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe("supports formatting", function () {
|
|
53
|
+
it("with colon", function () {
|
|
54
|
+
var e = StringTemplate.compile("{str:suffix;kg}");
|
|
55
|
+
assert.equal(e({ str: "5" }), "5kg");
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("with multiple formats", function () {
|
|
59
|
+
var e = StringTemplate.compile("{str:suffix;kg:wrap;(;)}");
|
|
60
|
+
assert.equal(e({ str: "5" }), "(5kg)");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("with null values", function () {
|
|
64
|
+
var e = StringTemplate.compile("{str:suffix;kg:|N/A}");
|
|
65
|
+
assert.equal(e({ str: null }), "N/A");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("of null values", function () {
|
|
69
|
+
var e = StringTemplate.compile("{str|N/A}");
|
|
70
|
+
assert.equal(e({ str: null }), "N/A");
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("supports expressions", function () {
|
|
75
|
+
it("using []", function () {
|
|
76
|
+
var e = StringTemplate.compile("1 + 2 = {[1+2]}");
|
|
77
|
+
assert.equal(e(), "1 + 2 = 3");
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("using %", function () {
|
|
81
|
+
var e = StringTemplate.compile("1 + 2 = %{1+2}");
|
|
82
|
+
assert.equal(e(), "1 + 2 = 3");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("with subexpressions", function () {
|
|
86
|
+
var e = StringTemplate.compile("1 + 2 = {[%{1+2}]}");
|
|
87
|
+
assert.equal(e(), "1 + 2 = 3");
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("with a conditional operator", function () {
|
|
91
|
+
var e = StringTemplate.compile("1 + 2 = {[true ? 3 : 2]:s}");
|
|
92
|
+
assert.equal(e(), "1 + 2 = 3");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("with sub-expression formatting", function () {
|
|
96
|
+
var e = StringTemplate.compile("{[!!{person.age} ? {person.age:suffix; years old} : 'Age unknown']}");
|
|
97
|
+
var state = {
|
|
98
|
+
person: {
|
|
99
|
+
age: 32,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
assert.equal(e(state), "32 years old");
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import assert from "assert";
|
|
2
|
-
import { createAccessorModelProxy } from "./createAccessorModelProxy";
|
|
3
|
-
import { getAccessor } from "./getAccessor";
|
|
4
|
-
|
|
5
|
-
describe("getAccessor", function () {
|
|
6
|
-
it("works with accessor chains", function () {
|
|
7
|
-
let m = createAccessorModelProxy();
|
|
8
|
-
let accessor = getAccessor(m.a.b);
|
|
9
|
-
assert(typeof accessor.set == "function");
|
|
10
|
-
});
|
|
11
|
-
});
|
|
1
|
+
import assert from "assert";
|
|
2
|
+
import { createAccessorModelProxy } from "./createAccessorModelProxy";
|
|
3
|
+
import { getAccessor } from "./getAccessor";
|
|
4
|
+
|
|
5
|
+
describe("getAccessor", function () {
|
|
6
|
+
it("works with accessor chains", function () {
|
|
7
|
+
let m = createAccessorModelProxy();
|
|
8
|
+
let accessor = getAccessor(m.a.b);
|
|
9
|
+
assert(typeof accessor.set == "function");
|
|
10
|
+
});
|
|
11
|
+
});
|
package/src/svg/Text.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import * as Cx from "../core";
|
|
2
|
-
import { BoundedObject, BoundedObjectProps } from "./BoundedObject";
|
|
3
|
-
|
|
4
|
-
interface TextProps extends BoundedObjectProps {
|
|
5
|
-
/** Text to be displayed. */
|
|
6
|
-
value?: Cx.StringProp;
|
|
7
|
-
|
|
8
|
-
bind?: string;
|
|
9
|
-
tpl?: string;
|
|
10
|
-
expr?: string;
|
|
11
|
-
|
|
12
|
-
/** Offset along the x-axis. */
|
|
13
|
-
dx?: Cx.Prop<string | number>;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Offset along the y-axis. This property is commonly used for vertical text alignment.
|
|
17
|
-
* Set dy="0.8em" to align the text with the top and dy="0.4em" to center it vertically.
|
|
18
|
-
*/
|
|
19
|
-
dy?: Cx.Prop<string | number>;
|
|
20
|
-
|
|
21
|
-
/** Used for horizontal text alignment. Accepted values are `start`, `middle` and `end`. */
|
|
22
|
-
textAnchor?: Cx.StringProp;
|
|
23
|
-
|
|
24
|
-
/** Used for horizontal text alignment. Accepted values are `start`, `middle` and `end`. */
|
|
25
|
-
ta?: Cx.StringProp;
|
|
26
|
-
|
|
27
|
-
/** Sets text-body color. */
|
|
28
|
-
fill?: Cx.StringProp;
|
|
29
|
-
|
|
30
|
-
/** Sets text-outline color. */
|
|
31
|
-
stroke?: Cx.StringProp;
|
|
32
|
-
|
|
33
|
-
/** Base CSS class to be applied to the element. Defaults to `text`. */
|
|
34
|
-
baseClass?: string;
|
|
35
|
-
|
|
36
|
-
/** Set to true for the text to set the text anchor based on the direction of the parent element. See PieLabels example. */
|
|
37
|
-
autoTextAnchor?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export class Text extends Cx.Widget<TextProps> {}
|
|
1
|
+
import * as Cx from "../core";
|
|
2
|
+
import { BoundedObject, BoundedObjectProps } from "./BoundedObject";
|
|
3
|
+
|
|
4
|
+
interface TextProps extends BoundedObjectProps {
|
|
5
|
+
/** Text to be displayed. */
|
|
6
|
+
value?: Cx.StringProp;
|
|
7
|
+
|
|
8
|
+
bind?: string;
|
|
9
|
+
tpl?: string;
|
|
10
|
+
expr?: string;
|
|
11
|
+
|
|
12
|
+
/** Offset along the x-axis. */
|
|
13
|
+
dx?: Cx.Prop<string | number>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Offset along the y-axis. This property is commonly used for vertical text alignment.
|
|
17
|
+
* Set dy="0.8em" to align the text with the top and dy="0.4em" to center it vertically.
|
|
18
|
+
*/
|
|
19
|
+
dy?: Cx.Prop<string | number>;
|
|
20
|
+
|
|
21
|
+
/** Used for horizontal text alignment. Accepted values are `start`, `middle` and `end`. */
|
|
22
|
+
textAnchor?: Cx.StringProp;
|
|
23
|
+
|
|
24
|
+
/** Used for horizontal text alignment. Accepted values are `start`, `middle` and `end`. */
|
|
25
|
+
ta?: Cx.StringProp;
|
|
26
|
+
|
|
27
|
+
/** Sets text-body color. */
|
|
28
|
+
fill?: Cx.StringProp;
|
|
29
|
+
|
|
30
|
+
/** Sets text-outline color. */
|
|
31
|
+
stroke?: Cx.StringProp;
|
|
32
|
+
|
|
33
|
+
/** Base CSS class to be applied to the element. Defaults to `text`. */
|
|
34
|
+
baseClass?: string;
|
|
35
|
+
|
|
36
|
+
/** Set to true for the text to set the text anchor based on the direction of the parent element. See PieLabels example. */
|
|
37
|
+
autoTextAnchor?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class Text extends Cx.Widget<TextProps> {}
|