cx 24.9.1 → 24.9.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.
Files changed (55) hide show
  1. package/dist/charts.js +22 -25
  2. package/dist/data.js +26 -29
  3. package/dist/manifest.js +775 -775
  4. package/dist/svg.js +59 -56
  5. package/dist/ui.js +51 -52
  6. package/dist/widgets.js +46 -49
  7. package/package.json +32 -32
  8. package/src/charts/Legend.js +151 -151
  9. package/src/charts/PieLabel.js +71 -71
  10. package/src/charts/axis/NumericAxis.js +347 -347
  11. package/src/charts/axis/Stack.js +55 -55
  12. package/src/charts/helpers/PointReducer.js +43 -43
  13. package/src/charts/helpers/SnapPointFinder.js +69 -69
  14. package/src/data/Binding.spec.js +69 -69
  15. package/src/data/StringTemplate.spec.js +105 -105
  16. package/src/data/getAccessor.spec.js +11 -11
  17. package/src/index.scss +6 -6
  18. package/src/svg/Text.d.ts +40 -40
  19. package/src/ui/Culture.d.ts +55 -55
  20. package/src/ui/Culture.js +139 -139
  21. package/src/ui/FocusManager.js +171 -171
  22. package/src/ui/Instance.d.ts +72 -72
  23. package/src/ui/VDOM.d.ts +12 -12
  24. package/src/ui/app/startAppLoop.js +58 -58
  25. package/src/ui/index.d.ts +42 -42
  26. package/src/ui/layout/LabelsTopLayout.js +134 -134
  27. package/src/util/Console.d.ts +4 -4
  28. package/src/util/scss/add-rules.scss +38 -38
  29. package/src/widgets/CxCredit.scss +37 -37
  30. package/src/widgets/List.scss +91 -91
  31. package/src/widgets/drag-drop/DropZone.js +214 -214
  32. package/src/widgets/form/Calendar.scss +196 -196
  33. package/src/widgets/form/ColorField.js +397 -397
  34. package/src/widgets/form/ColorPicker.scss +283 -283
  35. package/src/widgets/form/DateTimeField.js +573 -573
  36. package/src/widgets/form/MonthField.js +516 -516
  37. package/src/widgets/form/MonthPicker.scss +118 -118
  38. package/src/widgets/form/NumberField.js +459 -459
  39. package/src/widgets/form/NumberField.scss +61 -61
  40. package/src/widgets/form/Select.scss +99 -99
  41. package/src/widgets/form/Slider.scss +118 -118
  42. package/src/widgets/form/Switch.scss +140 -140
  43. package/src/widgets/form/TextArea.scss +43 -43
  44. package/src/widgets/form/TextField.js +290 -289
  45. package/src/widgets/form/TextField.scss +55 -55
  46. package/src/widgets/form/UploadButton.d.ts +34 -34
  47. package/src/widgets/grid/TreeNode.scss +88 -88
  48. package/src/widgets/grid/variables.scss +88 -88
  49. package/src/widgets/nav/Menu.scss +74 -74
  50. package/src/widgets/overlay/Dropdown.js +612 -612
  51. package/src/widgets/overlay/FlyweightTooltipTracker.js +39 -39
  52. package/src/widgets/overlay/Tooltip.js +300 -300
  53. package/src/widgets/overlay/Window.js +196 -196
  54. package/src/widgets/overlay/captureMouse.js +124 -124
  55. package/src/widgets/overlay/variables.scss +83 -83
@@ -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";
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> {}
@@ -1,55 +1,55 @@
1
- declare type DateEncoding = (date: Date) => any;
2
-
3
- export class Culture {
4
- static setCulture(cultureCode: string): void;
5
-
6
- static setDefaultCurrency(currencyCode: string): void;
7
-
8
- static setDefaultTimezone(timezone: string): void;
9
-
10
- static readonly defaultCurrency: string;
11
-
12
- static readonly culture: string;
13
-
14
- static setNumberCulture(cultureCode: string): void;
15
-
16
- static getNumberCulture(): any;
17
-
18
- static setDateTimeCulture(cultureCode: string): void;
19
-
20
- static getDateTimeCulture(): any;
21
-
22
- static getDefaultDateEncoding(): DateEncoding;
23
-
24
- static setDefaultDateEncoding(encoding: DateEncoding): void;
25
- }
26
-
27
- export interface CultureSpecs {
28
- culture?: string;
29
- numberCulture?: string;
30
- dateTimeCulture?: string;
31
- defaultCurrency?: string;
32
- dateEncoding?: DateEncoding;
33
- timezone?: string;
34
- }
35
-
36
- export interface CultureInfo {
37
- culture: string;
38
- numberCulture?: string;
39
- dateTimeCulture?: string;
40
- defaultCurrency: string;
41
- dateEncoding: DateEncoding;
42
- timezone?: string;
43
- }
44
-
45
- export function createCulture(cultureSpecs: CultureSpecs): CultureInfo;
46
-
47
- export function pushCulture(cultureSpecs: CultureInfo): void;
48
-
49
- export function popCulture(cultureSpecs?: CultureInfo): CultureInfo;
50
-
51
- export function getCurrentCultureCache(): any;
52
-
53
- export function getCurrentCulture(): CultureInfo;
54
-
55
- export function getDefaultCulture(): CultureInfo;
1
+ declare type DateEncoding = (date: Date) => any;
2
+
3
+ export class Culture {
4
+ static setCulture(cultureCode: string): void;
5
+
6
+ static setDefaultCurrency(currencyCode: string): void;
7
+
8
+ static setDefaultTimezone(timezone: string): void;
9
+
10
+ static readonly defaultCurrency: string;
11
+
12
+ static readonly culture: string;
13
+
14
+ static setNumberCulture(cultureCode: string): void;
15
+
16
+ static getNumberCulture(): any;
17
+
18
+ static setDateTimeCulture(cultureCode: string): void;
19
+
20
+ static getDateTimeCulture(): any;
21
+
22
+ static getDefaultDateEncoding(): DateEncoding;
23
+
24
+ static setDefaultDateEncoding(encoding: DateEncoding): void;
25
+ }
26
+
27
+ export interface CultureSpecs {
28
+ culture?: string;
29
+ numberCulture?: string;
30
+ dateTimeCulture?: string;
31
+ defaultCurrency?: string;
32
+ dateEncoding?: DateEncoding;
33
+ timezone?: string;
34
+ }
35
+
36
+ export interface CultureInfo {
37
+ culture: string;
38
+ numberCulture?: string;
39
+ dateTimeCulture?: string;
40
+ defaultCurrency: string;
41
+ dateEncoding: DateEncoding;
42
+ timezone?: string;
43
+ }
44
+
45
+ export function createCulture(cultureSpecs: CultureSpecs): CultureInfo;
46
+
47
+ export function pushCulture(cultureSpecs: CultureInfo): void;
48
+
49
+ export function popCulture(cultureSpecs?: CultureInfo): CultureInfo;
50
+
51
+ export function getCurrentCultureCache(): any;
52
+
53
+ export function getCurrentCulture(): CultureInfo;
54
+
55
+ export function getDefaultCulture(): CultureInfo;