cx 24.10.10 → 24.11.0

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.
Files changed (76) hide show
  1. package/dist/charts.js +12 -3
  2. package/dist/manifest.js +712 -712
  3. package/dist/util.js +1 -0
  4. package/dist/widgets.js +8 -1
  5. package/package.json +32 -32
  6. package/src/charts/PieChart.js +529 -529
  7. package/src/charts/PieLabel.js +71 -71
  8. package/src/charts/axis/Axis.js +280 -280
  9. package/src/charts/axis/CategoryAxis.d.ts +3 -0
  10. package/src/charts/axis/CategoryAxis.js +241 -235
  11. package/src/charts/axis/NumericAxis.js +351 -351
  12. package/src/charts/axis/Stack.js +55 -55
  13. package/src/charts/axis/TimeAxis.d.ts +28 -28
  14. package/src/charts/axis/TimeAxis.js +610 -610
  15. package/src/charts/helpers/PointReducer.js +47 -47
  16. package/src/charts/helpers/SnapPointFinder.js +69 -69
  17. package/src/data/Binding.spec.js +69 -69
  18. package/src/data/Expression.js +221 -221
  19. package/src/data/Expression.spec.js +184 -184
  20. package/src/data/StringTemplate.spec.js +105 -105
  21. package/src/data/getAccessor.spec.js +11 -11
  22. package/src/index.scss +6 -6
  23. package/src/svg/Text.d.ts +40 -40
  24. package/src/ui/Culture.d.ts +55 -55
  25. package/src/ui/Culture.js +139 -139
  26. package/src/ui/FocusManager.js +171 -171
  27. package/src/ui/Instance.d.ts +72 -72
  28. package/src/ui/Instance.js +614 -614
  29. package/src/ui/VDOM.d.ts +12 -12
  30. package/src/ui/app/startAppLoop.js +58 -58
  31. package/src/ui/index.d.ts +42 -42
  32. package/src/ui/layout/ContentPlaceholder.d.ts +19 -19
  33. package/src/ui/layout/ContentPlaceholder.js +105 -105
  34. package/src/ui/layout/ContentPlaceholder.spec.js +579 -579
  35. package/src/ui/layout/LabelsTopLayout.js +134 -134
  36. package/src/util/Console.d.ts +4 -4
  37. package/src/util/getSearchQueryPredicate.js +59 -58
  38. package/src/util/index.d.ts +51 -51
  39. package/src/util/index.js +54 -54
  40. package/src/util/isValidIdentifierName.d.ts +1 -1
  41. package/src/util/isValidIdentifierName.js +5 -5
  42. package/src/util/isValidIdentifierName.spec.js +33 -33
  43. package/src/util/scss/add-rules.scss +38 -38
  44. package/src/widgets/CxCredit.scss +37 -37
  45. package/src/widgets/HighlightedSearchText.js +36 -36
  46. package/src/widgets/HighlightedSearchText.scss +18 -18
  47. package/src/widgets/List.scss +91 -91
  48. package/src/widgets/drag-drop/DropZone.js +214 -214
  49. package/src/widgets/form/Calendar.scss +196 -196
  50. package/src/widgets/form/ColorField.js +397 -397
  51. package/src/widgets/form/ColorPicker.scss +283 -283
  52. package/src/widgets/form/DateTimeField.js +573 -573
  53. package/src/widgets/form/LookupField.d.ts +179 -179
  54. package/src/widgets/form/MonthField.js +516 -516
  55. package/src/widgets/form/MonthPicker.scss +118 -118
  56. package/src/widgets/form/NumberField.js +459 -459
  57. package/src/widgets/form/NumberField.scss +61 -61
  58. package/src/widgets/form/Select.scss +99 -99
  59. package/src/widgets/form/Slider.scss +118 -118
  60. package/src/widgets/form/Switch.scss +140 -140
  61. package/src/widgets/form/TextArea.scss +43 -43
  62. package/src/widgets/form/TextField.js +290 -290
  63. package/src/widgets/form/TextField.scss +55 -55
  64. package/src/widgets/form/UploadButton.d.ts +34 -34
  65. package/src/widgets/form/variables.scss +353 -353
  66. package/src/widgets/grid/Grid.d.ts +442 -442
  67. package/src/widgets/grid/TreeNode.d.ts +23 -23
  68. package/src/widgets/grid/TreeNode.scss +88 -88
  69. package/src/widgets/nav/Menu.scss +74 -74
  70. package/src/widgets/overlay/Dropdown.js +612 -612
  71. package/src/widgets/overlay/FlyweightTooltipTracker.js +39 -39
  72. package/src/widgets/overlay/Tooltip.js +307 -300
  73. package/src/widgets/overlay/Window.js +196 -196
  74. package/src/widgets/overlay/captureMouse.js +124 -124
  75. package/src/widgets/overlay/variables.scss +83 -83
  76. package/src/widgets/variables.scss +144 -144
@@ -1,184 +1,184 @@
1
- import { Expression } from "./Expression";
2
- import assert from "assert";
3
-
4
- describe("Expression", function () {
5
- describe("#compile()", function () {
6
- it("returns a selector", function () {
7
- var e = Expression.compile("{person.name}");
8
- var state = {
9
- person: {
10
- name: "Jim",
11
- },
12
- };
13
- assert.equal(e(state), "Jim");
14
- });
15
-
16
- it("ignores bindings in strings", function () {
17
- var e = Expression.compile('"{person.name}"');
18
- var state = {
19
- person: {
20
- name: "Jim",
21
- },
22
- };
23
- assert.equal(e(state), "{person.name}");
24
- });
25
-
26
- it("properly encodes quotes #1", function () {
27
- var e = Expression.compile('"\'"');
28
- var state = {};
29
- assert.equal(e(state), "'");
30
- });
31
-
32
- it("properly encodes quotes #2", function () {
33
- var e = Expression.compile('"\\""');
34
- var state = {};
35
- assert.equal(e(state), '"');
36
- });
37
- });
38
-
39
- describe("allow subexpressions", function () {
40
- it("in square brackets", function () {
41
- var e = Expression.compile("{[{person.name}]}");
42
- var state = {
43
- person: {
44
- name: "Jim",
45
- },
46
- };
47
- assert.equal(e(state), "Jim");
48
- });
49
-
50
- it("in square brackets", function () {
51
- var e = Expression.compile("{[{person.alias} || {person.name}]}");
52
- var state = {
53
- person: {
54
- name: "Jim",
55
- alias: "J",
56
- },
57
- };
58
- assert.equal(e(state), "J");
59
- });
60
-
61
- it("prefixed with % sign", function () {
62
- var e = Expression.compile("%{1+1}");
63
- assert.equal(e(), "2");
64
- });
65
-
66
- it("can be formatted", function () {
67
- var e = Expression.compile("{[1+1]:f;2}");
68
- assert.equal(e(), "2.00");
69
- });
70
-
71
- it("n level deep", function () {
72
- var e = Expression.compile("{[{[{[1+1]}]}]:f;2}");
73
- assert.equal(e(), "2.00");
74
- });
75
-
76
- it("with complex math inside", function () {
77
- var e = Expression.compile("%{{data}.reduce((a,b)=>a+b, 0):f;2}");
78
- var state = {
79
- data: [1, 2, 3],
80
- };
81
- assert.equal(e(state), "6.00");
82
- });
83
-
84
- it("with a conditional operator inside", function () {
85
- var e = Expression.compile('{[true ? "T" : "F"]}');
86
- assert.equal(e(), "T");
87
- });
88
-
89
- it("with string interpolation inside", function () {
90
- var e = Expression.compile("{[`${{test}}`]}");
91
- assert.equal(e({ test: "T" }), "T");
92
- });
93
- });
94
-
95
- describe("are working", function () {
96
- it("function expressions with get", function () {
97
- var e = Expression.get((get) => get("a") + get("b"));
98
- assert.equal(e({ a: 1, b: 2 }), 3);
99
- });
100
-
101
- it("are properly memoized", function () {
102
- let inv = 0;
103
- var e = Expression.get((get) => {
104
- inv++;
105
- return get("a") + get("b");
106
- }).memoize();
107
-
108
- assert.equal(e({ a: 1, b: 1 }), 2);
109
- assert.equal(inv, 1);
110
-
111
- assert.equal(e({ a: 1, b: 1 }), 2);
112
- assert.equal(inv, 1);
113
-
114
- assert.equal(e({ a: 1, b: 2 }), 3);
115
- assert.equal(inv, 2);
116
-
117
- assert.equal(e({ a: 1, b: 2 }), 3);
118
- assert.equal(inv, 2);
119
-
120
- assert.equal(e({ a: 2, b: 2 }), 4);
121
- assert.equal(inv, 3);
122
- });
123
-
124
- it("formatting can be used inside bindings", function () {
125
- var e = Expression.get((get) => get("name:prefix;Hello "));
126
- assert(e({ name: "CxJS" }), "Hello CxJS");
127
- });
128
-
129
- it("allows using the fmt function inside", function () {
130
- var e = Expression.compile('{[fmt({text}, "prefix;Hello ")]}');
131
- assert.equal(e({ text: "CxJS" }), "Hello CxJS");
132
- });
133
-
134
- it("allows using dashes inside names", function () {
135
- var e = Expression.compile("{framework-name}");
136
- assert.equal(e({ "framework-name": "CxJS" }), "CxJS");
137
- });
138
-
139
- it("allows using spaces and other characters inside names", function () {
140
- var e = Expression.compile("{1nv@lid js ident1fier}");
141
- assert.equal(e({ "1nv@lid js ident1fier": "CxJS" }), "CxJS");
142
- });
143
-
144
- // it('are properly memoized with proxies', function () {
145
- // let inv = 0;
146
- // var e = Expression.get(d => { inv++; return d.a + d.b}).memoize();
147
- //
148
- // assert.equal(e({ a: 1, b: 1 }), 2);
149
- // assert.equal(inv, 1);
150
- //
151
- // assert.equal(e({ a: 1, b: 1 }), 2);
152
- // assert.equal(inv, 1);
153
- //
154
- // assert.equal(e({ a: 1, b: 2 }), 3);
155
- // assert.equal(inv, 2);
156
- //
157
- // assert.equal(e({ a: 1, b: 2 }), 3);
158
- // assert.equal(inv, 2);
159
- //
160
- // assert.equal(e({ a: 2, b: 2 }), 4);
161
- // assert.equal(inv, 3);
162
- // });
163
- //
164
- // it('are properly memoized with proxies and deep data', function () {
165
- // let inv = 0;
166
- // var e = Expression.get(d => { inv++; return d.v.a + d.v.b}).memoize();
167
- //
168
- // assert.equal(e({ v: { a: 1, b: 1 }}), 2);
169
- // assert.equal(inv, 1);
170
- //
171
- // assert.equal(e({ v: { a: 1, b: 1 }}), 2);
172
- // assert.equal(inv, 1);
173
- //
174
- // assert.equal(e({ v: { a: 1, b: 2 }}), 3);
175
- // assert.equal(inv, 2);
176
- //
177
- // assert.equal(e({ v: { a: 1, b: 2 }}), 3);
178
- // assert.equal(inv, 2);
179
- //
180
- // assert.equal(e({ v: { a: 2, b: 2 }}), 4);
181
- // assert.equal(inv, 3);
182
- // });
183
- });
184
- });
1
+ import { Expression } from "./Expression";
2
+ import assert from "assert";
3
+
4
+ describe("Expression", function () {
5
+ describe("#compile()", function () {
6
+ it("returns a selector", function () {
7
+ var e = Expression.compile("{person.name}");
8
+ var state = {
9
+ person: {
10
+ name: "Jim",
11
+ },
12
+ };
13
+ assert.equal(e(state), "Jim");
14
+ });
15
+
16
+ it("ignores bindings in strings", function () {
17
+ var e = Expression.compile('"{person.name}"');
18
+ var state = {
19
+ person: {
20
+ name: "Jim",
21
+ },
22
+ };
23
+ assert.equal(e(state), "{person.name}");
24
+ });
25
+
26
+ it("properly encodes quotes #1", function () {
27
+ var e = Expression.compile('"\'"');
28
+ var state = {};
29
+ assert.equal(e(state), "'");
30
+ });
31
+
32
+ it("properly encodes quotes #2", function () {
33
+ var e = Expression.compile('"\\""');
34
+ var state = {};
35
+ assert.equal(e(state), '"');
36
+ });
37
+ });
38
+
39
+ describe("allow subexpressions", function () {
40
+ it("in square brackets", function () {
41
+ var e = Expression.compile("{[{person.name}]}");
42
+ var state = {
43
+ person: {
44
+ name: "Jim",
45
+ },
46
+ };
47
+ assert.equal(e(state), "Jim");
48
+ });
49
+
50
+ it("in square brackets", function () {
51
+ var e = Expression.compile("{[{person.alias} || {person.name}]}");
52
+ var state = {
53
+ person: {
54
+ name: "Jim",
55
+ alias: "J",
56
+ },
57
+ };
58
+ assert.equal(e(state), "J");
59
+ });
60
+
61
+ it("prefixed with % sign", function () {
62
+ var e = Expression.compile("%{1+1}");
63
+ assert.equal(e(), "2");
64
+ });
65
+
66
+ it("can be formatted", function () {
67
+ var e = Expression.compile("{[1+1]:f;2}");
68
+ assert.equal(e(), "2.00");
69
+ });
70
+
71
+ it("n level deep", function () {
72
+ var e = Expression.compile("{[{[{[1+1]}]}]:f;2}");
73
+ assert.equal(e(), "2.00");
74
+ });
75
+
76
+ it("with complex math inside", function () {
77
+ var e = Expression.compile("%{{data}.reduce((a,b)=>a+b, 0):f;2}");
78
+ var state = {
79
+ data: [1, 2, 3],
80
+ };
81
+ assert.equal(e(state), "6.00");
82
+ });
83
+
84
+ it("with a conditional operator inside", function () {
85
+ var e = Expression.compile('{[true ? "T" : "F"]}');
86
+ assert.equal(e(), "T");
87
+ });
88
+
89
+ it("with string interpolation inside", function () {
90
+ var e = Expression.compile("{[`${{test}}`]}");
91
+ assert.equal(e({ test: "T" }), "T");
92
+ });
93
+ });
94
+
95
+ describe("are working", function () {
96
+ it("function expressions with get", function () {
97
+ var e = Expression.get((get) => get("a") + get("b"));
98
+ assert.equal(e({ a: 1, b: 2 }), 3);
99
+ });
100
+
101
+ it("are properly memoized", function () {
102
+ let inv = 0;
103
+ var e = Expression.get((get) => {
104
+ inv++;
105
+ return get("a") + get("b");
106
+ }).memoize();
107
+
108
+ assert.equal(e({ a: 1, b: 1 }), 2);
109
+ assert.equal(inv, 1);
110
+
111
+ assert.equal(e({ a: 1, b: 1 }), 2);
112
+ assert.equal(inv, 1);
113
+
114
+ assert.equal(e({ a: 1, b: 2 }), 3);
115
+ assert.equal(inv, 2);
116
+
117
+ assert.equal(e({ a: 1, b: 2 }), 3);
118
+ assert.equal(inv, 2);
119
+
120
+ assert.equal(e({ a: 2, b: 2 }), 4);
121
+ assert.equal(inv, 3);
122
+ });
123
+
124
+ it("formatting can be used inside bindings", function () {
125
+ var e = Expression.get((get) => get("name:prefix;Hello "));
126
+ assert(e({ name: "CxJS" }), "Hello CxJS");
127
+ });
128
+
129
+ it("allows using the fmt function inside", function () {
130
+ var e = Expression.compile('{[fmt({text}, "prefix;Hello ")]}');
131
+ assert.equal(e({ text: "CxJS" }), "Hello CxJS");
132
+ });
133
+
134
+ it("allows using dashes inside names", function () {
135
+ var e = Expression.compile("{framework-name}");
136
+ assert.equal(e({ "framework-name": "CxJS" }), "CxJS");
137
+ });
138
+
139
+ it("allows using spaces and other characters inside names", function () {
140
+ var e = Expression.compile("{1nv@lid js ident1fier}");
141
+ assert.equal(e({ "1nv@lid js ident1fier": "CxJS" }), "CxJS");
142
+ });
143
+
144
+ // it('are properly memoized with proxies', function () {
145
+ // let inv = 0;
146
+ // var e = Expression.get(d => { inv++; return d.a + d.b}).memoize();
147
+ //
148
+ // assert.equal(e({ a: 1, b: 1 }), 2);
149
+ // assert.equal(inv, 1);
150
+ //
151
+ // assert.equal(e({ a: 1, b: 1 }), 2);
152
+ // assert.equal(inv, 1);
153
+ //
154
+ // assert.equal(e({ a: 1, b: 2 }), 3);
155
+ // assert.equal(inv, 2);
156
+ //
157
+ // assert.equal(e({ a: 1, b: 2 }), 3);
158
+ // assert.equal(inv, 2);
159
+ //
160
+ // assert.equal(e({ a: 2, b: 2 }), 4);
161
+ // assert.equal(inv, 3);
162
+ // });
163
+ //
164
+ // it('are properly memoized with proxies and deep data', function () {
165
+ // let inv = 0;
166
+ // var e = Expression.get(d => { inv++; return d.v.a + d.v.b}).memoize();
167
+ //
168
+ // assert.equal(e({ v: { a: 1, b: 1 }}), 2);
169
+ // assert.equal(inv, 1);
170
+ //
171
+ // assert.equal(e({ v: { a: 1, b: 1 }}), 2);
172
+ // assert.equal(inv, 1);
173
+ //
174
+ // assert.equal(e({ v: { a: 1, b: 2 }}), 3);
175
+ // assert.equal(inv, 2);
176
+ //
177
+ // assert.equal(e({ v: { a: 1, b: 2 }}), 3);
178
+ // assert.equal(inv, 2);
179
+ //
180
+ // assert.equal(e({ v: { a: 2, b: 2 }}), 4);
181
+ // assert.equal(inv, 3);
182
+ // });
183
+ });
184
+ });
@@ -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/index.scss CHANGED
@@ -1,6 +1,6 @@
1
- @import "global";
2
- @import "util/index";
3
- @import "ui/index";
4
- @import "widgets/index";
5
- @import "svg/index";
6
- @import "charts/index";
1
+ @import "global";
2
+ @import "util/index";
3
+ @import "ui/index";
4
+ @import "widgets/index";
5
+ @import "svg/index";
6
+ @import "charts/index";