cx 25.9.0 → 25.10.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.
Files changed (139) hide show
  1. package/LICENSE-THIRD-PARTY.md +91 -91
  2. package/LICENSE.md +7 -7
  3. package/README.md +46 -46
  4. package/dist/charts.js +25 -11
  5. package/dist/manifest.js +493 -493
  6. package/dist/ui.js +1 -3
  7. package/package.json +1 -1
  8. package/src/charts/Bar.d.ts +27 -27
  9. package/src/charts/BarGraph.d.ts +15 -15
  10. package/src/charts/Chart.d.ts +12 -12
  11. package/src/charts/ColorMap.d.ts +21 -21
  12. package/src/charts/Column.d.ts +29 -29
  13. package/src/charts/ColumnBarBase.d.ts +64 -64
  14. package/src/charts/ColumnBarGraphBase.d.ts +73 -73
  15. package/src/charts/ColumnGraph.d.ts +18 -18
  16. package/src/charts/Gridlines.d.ts +24 -24
  17. package/src/charts/Legend.d.ts +45 -45
  18. package/src/charts/LegendEntry.d.ts +54 -54
  19. package/src/charts/LineGraph.d.ts +101 -101
  20. package/src/charts/Marker.d.ts +110 -110
  21. package/src/charts/MarkerLine.d.ts +56 -56
  22. package/src/charts/MouseTracker.d.ts +16 -16
  23. package/src/charts/PieChart.d.ts +92 -92
  24. package/src/charts/PieLabel.d.ts +26 -26
  25. package/src/charts/PieLabelsContainer.d.ts +6 -6
  26. package/src/charts/Range.d.ts +74 -74
  27. package/src/charts/RangeMarker.d.ts +35 -35
  28. package/src/charts/ScatterGraph.d.ts +64 -64
  29. package/src/charts/Swimlane.d.ts +24 -24
  30. package/src/charts/Swimlanes.d.ts +41 -41
  31. package/src/charts/axis/Axis.d.ts +113 -113
  32. package/src/charts/axis/Axis.js +8 -0
  33. package/src/charts/axis/Axis.scss +22 -22
  34. package/src/charts/axis/CategoryAxis.d.ts +30 -30
  35. package/src/charts/axis/NumericAxis.d.ts +46 -46
  36. package/src/charts/axis/Stack.d.ts +10 -10
  37. package/src/charts/axis/TimeAxis.d.ts +31 -31
  38. package/src/charts/axis/index.d.ts +3 -3
  39. package/src/charts/axis/index.scss +5 -5
  40. package/src/charts/axis/variables.scss +2 -2
  41. package/src/charts/helpers/MinMaxFinder.d.ts +22 -22
  42. package/src/charts/helpers/PointReducer.d.ts +24 -24
  43. package/src/charts/helpers/SnapPointFinder.d.ts +30 -30
  44. package/src/charts/helpers/ValueAtFinder.d.ts +16 -16
  45. package/src/charts/helpers/index.d.ts +4 -4
  46. package/src/charts/index.d.ts +27 -27
  47. package/src/charts/index.scss +22 -22
  48. package/src/charts/shapes.d.ts +22 -22
  49. package/src/global.scss +13 -13
  50. package/src/index.scss +6 -6
  51. package/src/svg/index.scss +8 -8
  52. package/src/ui/Instance.js +1 -4
  53. package/src/ui/index.scss +2 -2
  54. package/src/ui/layout/index.scss +3 -3
  55. package/src/ui/layout/variables.scss +2 -2
  56. package/src/ui/variables.scss +1 -1
  57. package/src/util/call-once.scss +6 -6
  58. package/src/util/index.scss +10 -10
  59. package/src/util/scss/divide.scss +3 -3
  60. package/src/util/scss/index.scss +9 -9
  61. package/src/variables.scss +217 -217
  62. package/src/widgets/AccessorBindings.spec.tsx +66 -66
  63. package/src/widgets/Button.d.ts +58 -58
  64. package/src/widgets/CxCredit.d.ts +12 -12
  65. package/src/widgets/DocumentTitle.d.ts +11 -11
  66. package/src/widgets/FlexBox.d.ts +69 -69
  67. package/src/widgets/Heading.d.ts +16 -16
  68. package/src/widgets/HighlightedSearchText.d.ts +9 -9
  69. package/src/widgets/HtmlElement.d.ts +30 -30
  70. package/src/widgets/Icon.d.ts +34 -34
  71. package/src/widgets/ProgressBar.d.ts +17 -17
  72. package/src/widgets/Resizer.d.ts +27 -27
  73. package/src/widgets/Sandbox.d.ts +18 -18
  74. package/src/widgets/Section.d.ts +52 -52
  75. package/src/widgets/animations.scss +10 -10
  76. package/src/widgets/autoFocus.d.ts +1 -1
  77. package/src/widgets/cx.d.ts +1 -1
  78. package/src/widgets/drag-drop/DragSource.d.ts +45 -45
  79. package/src/widgets/drag-drop/DropZone.d.ts +98 -98
  80. package/src/widgets/drag-drop/index.d.ts +4 -4
  81. package/src/widgets/drag-drop/index.scss +3 -3
  82. package/src/widgets/drag-drop/ops.d.ts +56 -56
  83. package/src/widgets/enableAllInternalDependencies.d.ts +1 -1
  84. package/src/widgets/form/Calendar.variables.scss +63 -63
  85. package/src/widgets/form/Checkbox.variables.scss +39 -39
  86. package/src/widgets/form/ColorPicker.variables.scss +22 -22
  87. package/src/widgets/form/Radio.variables.scss +45 -45
  88. package/src/widgets/form/index.scss +24 -24
  89. package/src/widgets/grid/Grid.d.ts +442 -442
  90. package/src/widgets/grid/GridCell.d.ts +38 -38
  91. package/src/widgets/grid/Pagination.d.ts +14 -14
  92. package/src/widgets/grid/TreeNode.d.ts +23 -23
  93. package/src/widgets/grid/index.d.ts +3 -3
  94. package/src/widgets/grid/index.scss +3 -3
  95. package/src/widgets/icons/arrow-down.svg +3 -3
  96. package/src/widgets/icons/arrow-right.svg +2 -2
  97. package/src/widgets/icons/base.svg +104 -104
  98. package/src/widgets/icons/calendar-old.svg +169 -169
  99. package/src/widgets/icons/calendar.svg +187 -187
  100. package/src/widgets/icons/clear.svg +74 -74
  101. package/src/widgets/icons/close.svg +74 -74
  102. package/src/widgets/icons/dropdown-arrow.svg +61 -61
  103. package/src/widgets/icons/file.svg +4 -4
  104. package/src/widgets/icons/folder-open.svg +5 -5
  105. package/src/widgets/icons/folder.svg +58 -58
  106. package/src/widgets/icons/forward.svg +67 -67
  107. package/src/widgets/icons/loading.svg +4 -4
  108. package/src/widgets/icons/search.svg +107 -107
  109. package/src/widgets/icons/sort-asc.svg +3 -3
  110. package/src/widgets/index.d.ts +55 -55
  111. package/src/widgets/index.scss +16 -16
  112. package/src/widgets/nav/Link.d.ts +26 -26
  113. package/src/widgets/nav/LinkButton.d.ts +34 -34
  114. package/src/widgets/nav/Menu.d.ts +27 -27
  115. package/src/widgets/nav/MenuItem.d.ts +31 -31
  116. package/src/widgets/nav/MenuSpacer.d.ts +5 -5
  117. package/src/widgets/nav/RedirectRoute.d.ts +9 -9
  118. package/src/widgets/nav/Route.d.ts +21 -21
  119. package/src/widgets/nav/Scroller.d.ts +17 -17
  120. package/src/widgets/nav/Submenu.d.ts +6 -6
  121. package/src/widgets/nav/Tab.d.ts +33 -33
  122. package/src/widgets/nav/Tab.variables.scss +84 -84
  123. package/src/widgets/nav/index.d.ts +10 -10
  124. package/src/widgets/nav/index.scss +5 -5
  125. package/src/widgets/overlay/ContextMenu.d.ts +10 -10
  126. package/src/widgets/overlay/Dropdown.d.ts +32 -32
  127. package/src/widgets/overlay/FlyweightTooltipTracker.d.ts +8 -8
  128. package/src/widgets/overlay/MsgBox.d.ts +16 -16
  129. package/src/widgets/overlay/Overlay.d.ts +73 -73
  130. package/src/widgets/overlay/Toast.d.ts +30 -30
  131. package/src/widgets/overlay/Tooltip.d.ts +50 -50
  132. package/src/widgets/overlay/Window.d.ts +42 -42
  133. package/src/widgets/overlay/Window.variables.scss +62 -62
  134. package/src/widgets/overlay/alerts.d.ts +7 -7
  135. package/src/widgets/overlay/captureMouse.d.ts +53 -53
  136. package/src/widgets/overlay/captureMouse.scss +13 -13
  137. package/src/widgets/overlay/createHotPromiseWindowFactory.d.ts +18 -18
  138. package/src/widgets/overlay/index.d.ts +11 -11
  139. package/src/widgets/overlay/index.scss +15 -15
@@ -1,2 +1,2 @@
1
-
1
+
2
2
  @import "layout/variables";
@@ -1,7 +1,7 @@
1
- $cx-call-once-data: () !default;
2
-
3
- @function cx-call-once($name) {
4
- $result: map_get($cx-call-once-data, $name);
5
- $cx-call-once-data: map_merge($cx-call-once-data, ($name: true)) !global;
6
- @return $result != true;
1
+ $cx-call-once-data: () !default;
2
+
3
+ @function cx-call-once($name) {
4
+ $result: map_get($cx-call-once-data, $name);
5
+ $cx-call-once-data: map_merge($cx-call-once-data, ($name: true)) !global;
6
+ @return $result != true;
7
7
  }
@@ -1,11 +1,11 @@
1
- .cx-text-left.cx-text-left {
2
- text-align: left;
3
- }
4
-
5
- .cx-text-right.cx-text-right {
6
- text-align: right;
7
- }
8
-
9
- .cx-text-center.cx-text-center {
10
- text-align: center;
1
+ .cx-text-left.cx-text-left {
2
+ text-align: left;
3
+ }
4
+
5
+ .cx-text-right.cx-text-right {
6
+ text-align: right;
7
+ }
8
+
9
+ .cx-text-center.cx-text-center {
10
+ text-align: center;
11
11
  }
@@ -1,3 +1,3 @@
1
- @function cx-divide($a, $b) {
2
- @return $a / $b;
3
- }
1
+ @function cx-divide($a, $b) {
2
+ @return $a / $b;
3
+ }
@@ -1,9 +1,9 @@
1
- @import "add-rules";
2
- @import "calc";
3
- @import "call-once";
4
- @import "clockwise";
5
- @import "colors";
6
- @import "deep-merge";
7
- @import "deep-get";
8
- @import "include";
9
- @import "divide";
1
+ @import "add-rules";
2
+ @import "calc";
3
+ @import "call-once";
4
+ @import "clockwise";
5
+ @import "colors";
6
+ @import "deep-merge";
7
+ @import "deep-get";
8
+ @import "include";
9
+ @import "divide";
@@ -1,217 +1,217 @@
1
- // FUNCTIONS
2
- @import "util/scss/index";
3
-
4
- // SCREEN SIZE
5
- $cx-screen-size-small: 400px !default;
6
- $cx-screen-size-medium: 800px !default;
7
- $cx-screen-size-large: 1300px !default;
8
- $cx-screen-size-extra-large: 1800px !default;
9
-
10
- //
11
- // BESM
12
- //
13
- // B - block - top level HTML element
14
- // E - element - part of the component (block)
15
- // S - state - indicator of the component state which affects the appearance
16
- // M - mod - user supplied instruction which overrides default appearance
17
- //
18
-
19
- $cx-besm: (
20
- block: "cxb-",
21
- element: "cxe-",
22
- state: "cxs-",
23
- mod: "cxm-"
24
- ) !default;
25
-
26
- //
27
- // Boxes
28
- // -----
29
- //
30
- // Boxes are inline-block elements which are likely to appear in the same row, such as buttons and form elements.
31
- // These elements should have the same height in order to avoid problems when put together in a toolbar
32
- // or a complex form.
33
- //
34
- // To ensure the height consistency, all box models should use the same line-height, top/bottom padding and border-width;
35
- //
36
- // For elements which do not have a natural border, such as checkboxes, radios and buttons,
37
- // border-color should be set to transparent.
38
- //
39
- // box height = line-height + padding-top + padding-bottom + border-width-top + border-width-bottom
40
- //
41
- // Some browsers do not respect the line-height being set and therefore explicit height value is
42
- // calculated and set on all box elements.
43
- //
44
- // Hint: Use em units to make the box height grow with the font-size, but note that the elements
45
- // will not be aligned in case of pixel boundaries and icons may appear blurry in some desktop browsers.
46
- //
47
-
48
- $cx-default-box-font-size: 13px !default;
49
- $cx-default-box-font-family: inherit !default;
50
- $cx-default-box-line-height: 16px !default;
51
- $cx-default-box-padding: 5px !default; //should not be a list
52
- $cx-default-box-border-width: 1px !default;
53
-
54
- // Borders
55
- // -------
56
-
57
- $cx-default-border-color: #bfbfbf !default;
58
- $cx-default-border-radius: 0 !default;
59
- $cx-default-border-width: 1px !default;
60
-
61
- // Padding
62
- // -------
63
-
64
- $cx-default-container-padding: 5px !default;
65
-
66
- // Empty Texts
67
- // ------------
68
- //
69
- // Displayed instead of whitespace
70
-
71
- $cx-default-empty-text-color: rgba(128, 128, 128, 0.7) !default;
72
-
73
- $cx-empty-text: (
74
- color: $cx-default-empty-text-color
75
- ) !default;
76
-
77
- //Icons
78
- $cx-default-icon-size: 16px !default;
79
-
80
- //Selection
81
- $cx-selection-background-color: rgba(135, 206, 250, 0.6);
82
-
83
- //List
84
- $cx-default-list-item-padding: 5px 10px !default;
85
-
86
- //Lists
87
- $cx-list: (
88
- default: (
89
- -webkit-overflow-scrolling: touch
90
- ),
91
- hover: (),
92
- focus: (
93
- outline: none
94
- )
95
- );
96
-
97
- $cx-list-item: (
98
- default: (),
99
- hover: (
100
- background-color: rgba(128, 128, 128, 0.1),
101
- outline: none,
102
- cursor: pointer
103
- ),
104
- cursor: (
105
- background-color: rgba(123, 190, 255, 0.15),
106
- outline: none
107
- ),
108
- selected: (
109
- background-color: rgba(123, 190, 255, 0.4)
110
- ),
111
- selected-hover: (
112
- background-color: rgba(123, 190, 255, 0.2)
113
- ),
114
- selected-cursor: (
115
- background-color: rgba(123, 190, 255, 0.3),
116
- outline: none
117
- ),
118
- disabled: (
119
- cursor: default,
120
- opacity: 0.5,
121
- pointer-events: none
122
- ),
123
- active: (
124
- //causes flickering
125
- //background: rgba(123,190,255, 0.7)
126
- )
127
- ) !default;
128
-
129
- $cx-default-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
130
- "Helvetica Neue", Arial, sans-serif !default;
131
-
132
- $cx-default-font-size: 14px !default;
133
- $cx-default-color: #373a3c !default;
134
-
135
- $cx-element-style-map: (
136
- html: (
137
- font-family: $cx-default-font-family,
138
- font-size: $cx-default-font-size,
139
- height: 100%,
140
- background-color: #eee
141
- ),
142
- body: (
143
- margin: 0,
144
- padding: 0,
145
- height: 100%,
146
- color: $cx-default-color
147
- ),
148
- h1: (
149
- font-size: 2rem,
150
- line-height: 1.1,
151
- margin: 0 0 0.75rem 0,
152
- font-weight: 500
153
- ),
154
- h2: (
155
- font-size: 1.75rem,
156
- line-height: 1.1,
157
- margin: 0 0 0.5rem 0,
158
- font-weight: 500
159
- ),
160
- h3: (
161
- font-size: 1.5rem,
162
- line-height: 1.1,
163
- margin: 0 0 0.5rem 0,
164
- font-weight: 500
165
- ),
166
- h4: (
167
- font-size: 1.3rem,
168
- line-height: 1.1,
169
- margin: 0 0 0.5rem 0,
170
- font-weight: 500
171
- ),
172
- h5: (
173
- font-size: 1.15rem,
174
- line-height: 1.1,
175
- margin: 0 0 0.5rem 0,
176
- font-weight: 500
177
- ),
178
- h6: (
179
- font-size: 1rem,
180
- line-height: 1.1,
181
- margin: 0 0 0.5rem 0,
182
- font-weight: 500
183
- ),
184
- p: (
185
- margin: 0 0 1rem 0
186
- ),
187
- a: (
188
- text-decoration: none,
189
- color: #0275d8
190
- ),
191
- "a:hover": (
192
- text-decoration: underline
193
- ),
194
- ul: (
195
- margin: 0 0 1rem 0
196
- ),
197
- ol: (
198
- margin: 0 0 1rem 0
199
- ),
200
- th: (
201
- font-weight: 500
202
- ),
203
- text: (
204
- fill: currentColor,
205
- stroke: none
206
- ),
207
- table: (
208
- font-size: inherit
209
- )
210
- ) !default;
211
-
212
- $cx-default-cover-border-color: $cx-default-border-color !default;
213
- $cx-default-cover-background-color: white !default;
214
-
215
- @import "charts/variables";
216
- @import "ui/variables";
217
- @import "widgets/variables";
1
+ // FUNCTIONS
2
+ @import "util/scss/index";
3
+
4
+ // SCREEN SIZE
5
+ $cx-screen-size-small: 400px !default;
6
+ $cx-screen-size-medium: 800px !default;
7
+ $cx-screen-size-large: 1300px !default;
8
+ $cx-screen-size-extra-large: 1800px !default;
9
+
10
+ //
11
+ // BESM
12
+ //
13
+ // B - block - top level HTML element
14
+ // E - element - part of the component (block)
15
+ // S - state - indicator of the component state which affects the appearance
16
+ // M - mod - user supplied instruction which overrides default appearance
17
+ //
18
+
19
+ $cx-besm: (
20
+ block: "cxb-",
21
+ element: "cxe-",
22
+ state: "cxs-",
23
+ mod: "cxm-"
24
+ ) !default;
25
+
26
+ //
27
+ // Boxes
28
+ // -----
29
+ //
30
+ // Boxes are inline-block elements which are likely to appear in the same row, such as buttons and form elements.
31
+ // These elements should have the same height in order to avoid problems when put together in a toolbar
32
+ // or a complex form.
33
+ //
34
+ // To ensure the height consistency, all box models should use the same line-height, top/bottom padding and border-width;
35
+ //
36
+ // For elements which do not have a natural border, such as checkboxes, radios and buttons,
37
+ // border-color should be set to transparent.
38
+ //
39
+ // box height = line-height + padding-top + padding-bottom + border-width-top + border-width-bottom
40
+ //
41
+ // Some browsers do not respect the line-height being set and therefore explicit height value is
42
+ // calculated and set on all box elements.
43
+ //
44
+ // Hint: Use em units to make the box height grow with the font-size, but note that the elements
45
+ // will not be aligned in case of pixel boundaries and icons may appear blurry in some desktop browsers.
46
+ //
47
+
48
+ $cx-default-box-font-size: 13px !default;
49
+ $cx-default-box-font-family: inherit !default;
50
+ $cx-default-box-line-height: 16px !default;
51
+ $cx-default-box-padding: 5px !default; //should not be a list
52
+ $cx-default-box-border-width: 1px !default;
53
+
54
+ // Borders
55
+ // -------
56
+
57
+ $cx-default-border-color: #bfbfbf !default;
58
+ $cx-default-border-radius: 0 !default;
59
+ $cx-default-border-width: 1px !default;
60
+
61
+ // Padding
62
+ // -------
63
+
64
+ $cx-default-container-padding: 5px !default;
65
+
66
+ // Empty Texts
67
+ // ------------
68
+ //
69
+ // Displayed instead of whitespace
70
+
71
+ $cx-default-empty-text-color: rgba(128, 128, 128, 0.7) !default;
72
+
73
+ $cx-empty-text: (
74
+ color: $cx-default-empty-text-color
75
+ ) !default;
76
+
77
+ //Icons
78
+ $cx-default-icon-size: 16px !default;
79
+
80
+ //Selection
81
+ $cx-selection-background-color: rgba(135, 206, 250, 0.6);
82
+
83
+ //List
84
+ $cx-default-list-item-padding: 5px 10px !default;
85
+
86
+ //Lists
87
+ $cx-list: (
88
+ default: (
89
+ -webkit-overflow-scrolling: touch
90
+ ),
91
+ hover: (),
92
+ focus: (
93
+ outline: none
94
+ )
95
+ );
96
+
97
+ $cx-list-item: (
98
+ default: (),
99
+ hover: (
100
+ background-color: rgba(128, 128, 128, 0.1),
101
+ outline: none,
102
+ cursor: pointer
103
+ ),
104
+ cursor: (
105
+ background-color: rgba(123, 190, 255, 0.15),
106
+ outline: none
107
+ ),
108
+ selected: (
109
+ background-color: rgba(123, 190, 255, 0.4)
110
+ ),
111
+ selected-hover: (
112
+ background-color: rgba(123, 190, 255, 0.2)
113
+ ),
114
+ selected-cursor: (
115
+ background-color: rgba(123, 190, 255, 0.3),
116
+ outline: none
117
+ ),
118
+ disabled: (
119
+ cursor: default,
120
+ opacity: 0.5,
121
+ pointer-events: none
122
+ ),
123
+ active: (
124
+ //causes flickering
125
+ //background: rgba(123,190,255, 0.7)
126
+ )
127
+ ) !default;
128
+
129
+ $cx-default-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
130
+ "Helvetica Neue", Arial, sans-serif !default;
131
+
132
+ $cx-default-font-size: 14px !default;
133
+ $cx-default-color: #373a3c !default;
134
+
135
+ $cx-element-style-map: (
136
+ html: (
137
+ font-family: $cx-default-font-family,
138
+ font-size: $cx-default-font-size,
139
+ height: 100%,
140
+ background-color: #eee
141
+ ),
142
+ body: (
143
+ margin: 0,
144
+ padding: 0,
145
+ height: 100%,
146
+ color: $cx-default-color
147
+ ),
148
+ h1: (
149
+ font-size: 2rem,
150
+ line-height: 1.1,
151
+ margin: 0 0 0.75rem 0,
152
+ font-weight: 500
153
+ ),
154
+ h2: (
155
+ font-size: 1.75rem,
156
+ line-height: 1.1,
157
+ margin: 0 0 0.5rem 0,
158
+ font-weight: 500
159
+ ),
160
+ h3: (
161
+ font-size: 1.5rem,
162
+ line-height: 1.1,
163
+ margin: 0 0 0.5rem 0,
164
+ font-weight: 500
165
+ ),
166
+ h4: (
167
+ font-size: 1.3rem,
168
+ line-height: 1.1,
169
+ margin: 0 0 0.5rem 0,
170
+ font-weight: 500
171
+ ),
172
+ h5: (
173
+ font-size: 1.15rem,
174
+ line-height: 1.1,
175
+ margin: 0 0 0.5rem 0,
176
+ font-weight: 500
177
+ ),
178
+ h6: (
179
+ font-size: 1rem,
180
+ line-height: 1.1,
181
+ margin: 0 0 0.5rem 0,
182
+ font-weight: 500
183
+ ),
184
+ p: (
185
+ margin: 0 0 1rem 0
186
+ ),
187
+ a: (
188
+ text-decoration: none,
189
+ color: #0275d8
190
+ ),
191
+ "a:hover": (
192
+ text-decoration: underline
193
+ ),
194
+ ul: (
195
+ margin: 0 0 1rem 0
196
+ ),
197
+ ol: (
198
+ margin: 0 0 1rem 0
199
+ ),
200
+ th: (
201
+ font-weight: 500
202
+ ),
203
+ text: (
204
+ fill: currentColor,
205
+ stroke: none
206
+ ),
207
+ table: (
208
+ font-size: inherit
209
+ )
210
+ ) !default;
211
+
212
+ $cx-default-cover-border-color: $cx-default-border-color !default;
213
+ $cx-default-cover-background-color: white !default;
214
+
215
+ @import "charts/variables";
216
+ @import "ui/variables";
217
+ @import "widgets/variables";
@@ -1,66 +1,66 @@
1
- import assert from "assert";
2
- import reactTestRenderer from "react-test-renderer";
3
- import { createAccessorModelProxy } from "../data/createAccessorModelProxy";
4
- import { Store } from "../data/Store";
5
- import { expr } from "../ui";
6
- import { Cx } from "../ui/Cx";
7
- import { HtmlElement } from "./HtmlElement";
8
-
9
- let DummyHack = HtmlElement;
10
-
11
- interface Model {
12
- $page: {
13
- text?: string;
14
- a?: number;
15
- b?: number;
16
- };
17
- }
18
-
19
- let { $page } = createAccessorModelProxy<Model>();
20
-
21
- describe("Accessors", () => {
22
- it("work as regular bindings", () => {
23
- let widget = (
24
- <cx>
25
- <div text={$page.text} />
26
- </cx>
27
- );
28
-
29
- let store = new Store<Model>({
30
- data: {
31
- $page: {
32
- text: "Test",
33
- },
34
- },
35
- });
36
-
37
- const component = reactTestRenderer.create(<Cx widget={widget} store={store} />);
38
-
39
- let tree = component.toJSON();
40
- assert(tree.type === "div");
41
- assert.deepStrictEqual(tree.children, ["Test"]);
42
- });
43
-
44
- it("support expressions", () => {
45
- let widget = (
46
- <cx>
47
- <div text={expr($page.a, $page.b, (a, b) => a + b)} />
48
- </cx>
49
- );
50
-
51
- let store = new Store<Model>({
52
- data: {
53
- $page: {
54
- a: 1,
55
- b: 3,
56
- },
57
- },
58
- });
59
-
60
- const component = reactTestRenderer.create(<Cx widget={widget} store={store} />);
61
-
62
- let tree = component.toJSON();
63
- assert(tree.type === "div");
64
- assert.deepStrictEqual(tree.children, ["4"]);
65
- });
66
- });
1
+ import assert from "assert";
2
+ import reactTestRenderer from "react-test-renderer";
3
+ import { createAccessorModelProxy } from "../data/createAccessorModelProxy";
4
+ import { Store } from "../data/Store";
5
+ import { expr } from "../ui";
6
+ import { Cx } from "../ui/Cx";
7
+ import { HtmlElement } from "./HtmlElement";
8
+
9
+ let DummyHack = HtmlElement;
10
+
11
+ interface Model {
12
+ $page: {
13
+ text?: string;
14
+ a?: number;
15
+ b?: number;
16
+ };
17
+ }
18
+
19
+ let { $page } = createAccessorModelProxy<Model>();
20
+
21
+ describe("Accessors", () => {
22
+ it("work as regular bindings", () => {
23
+ let widget = (
24
+ <cx>
25
+ <div text={$page.text} />
26
+ </cx>
27
+ );
28
+
29
+ let store = new Store<Model>({
30
+ data: {
31
+ $page: {
32
+ text: "Test",
33
+ },
34
+ },
35
+ });
36
+
37
+ const component = reactTestRenderer.create(<Cx widget={widget} store={store} />);
38
+
39
+ let tree = component.toJSON();
40
+ assert(tree.type === "div");
41
+ assert.deepStrictEqual(tree.children, ["Test"]);
42
+ });
43
+
44
+ it("support expressions", () => {
45
+ let widget = (
46
+ <cx>
47
+ <div text={expr($page.a, $page.b, (a, b) => a + b)} />
48
+ </cx>
49
+ );
50
+
51
+ let store = new Store<Model>({
52
+ data: {
53
+ $page: {
54
+ a: 1,
55
+ b: 3,
56
+ },
57
+ },
58
+ });
59
+
60
+ const component = reactTestRenderer.create(<Cx widget={widget} store={store} />);
61
+
62
+ let tree = component.toJSON();
63
+ assert(tree.type === "div");
64
+ assert.deepStrictEqual(tree.children, ["4"]);
65
+ });
66
+ });