cx 26.0.9 → 26.0.11

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 (238) hide show
  1. package/build/jsx-dev-runtime.d.ts +3 -0
  2. package/build/jsx-dev-runtime.js +3 -0
  3. package/build/ui/Controller.d.ts +2 -2
  4. package/build/ui/index.d.ts +2 -1
  5. package/build/ui/index.js +2 -1
  6. package/build.js +133 -133
  7. package/dist/manifest.js +887 -990
  8. package/dist/ui.js +1 -1
  9. package/package.json +4 -4
  10. package/src/jsx-dev-runtime.ts +4 -0
  11. package/src/ui/Controller.ts +2 -2
  12. package/src/ui/index.ts +2 -1
  13. package/src/widgets/HtmlElement.spec.tsx +8 -6
  14. package/build/charts/Bar.scss +0 -29
  15. package/build/charts/BarGraph.scss +0 -29
  16. package/build/charts/BubbleGraph.scss +0 -32
  17. package/build/charts/Column.scss +0 -29
  18. package/build/charts/ColumnGraph.scss +0 -30
  19. package/build/charts/Gridlines.scss +0 -25
  20. package/build/charts/Legend.scss +0 -50
  21. package/build/charts/LegendEntry.scss +0 -29
  22. package/build/charts/LineGraph.scss +0 -25
  23. package/build/charts/Marker.scss +0 -44
  24. package/build/charts/MarkerLine.scss +0 -20
  25. package/build/charts/PieChart.scss +0 -29
  26. package/build/charts/Range.scss +0 -20
  27. package/build/charts/RangeMarker.scss +0 -17
  28. package/build/charts/ScatterGraph.scss +0 -24
  29. package/build/charts/Swimlane.scss +0 -16
  30. package/build/charts/Swimlanes.scss +0 -16
  31. package/build/charts/axis/Axis.scss +0 -23
  32. package/build/charts/axis/CategoryAxis.scss +0 -35
  33. package/build/charts/axis/NumericAxis.scss +0 -35
  34. package/build/charts/axis/TimeAxis.scss +0 -34
  35. package/build/charts/axis/index.scss +0 -5
  36. package/build/charts/axis/variables.scss +0 -3
  37. package/build/charts/index.scss +0 -22
  38. package/build/charts/palette.scss +0 -97
  39. package/build/charts/variables.scss +0 -22
  40. package/build/data/ArrayElementView.spec.d.ts +0 -1
  41. package/build/data/ArrayElementView.spec.js +0 -81
  42. package/build/data/Binding.spec.d.ts +0 -1
  43. package/build/data/Binding.spec.js +0 -61
  44. package/build/data/Expression.spec.d.ts +0 -1
  45. package/build/data/Expression.spec.js +0 -196
  46. package/build/data/Grouper.spec.d.ts +0 -1
  47. package/build/data/Grouper.spec.js +0 -48
  48. package/build/data/Ref.spec.d.ts +0 -1
  49. package/build/data/Ref.spec.js +0 -72
  50. package/build/data/Store.spec.d.ts +0 -1
  51. package/build/data/Store.spec.js +0 -19
  52. package/build/data/StoreRef.spec.d.ts +0 -1
  53. package/build/data/StoreRef.spec.js +0 -22
  54. package/build/data/StringTemplate.spec.d.ts +0 -1
  55. package/build/data/StringTemplate.spec.js +0 -112
  56. package/build/data/StructuredSelector.spec.d.ts +0 -1
  57. package/build/data/StructuredSelector.spec.js +0 -102
  58. package/build/data/View.spec.d.ts +0 -1
  59. package/build/data/View.spec.js +0 -44
  60. package/build/data/ZoomIntoPropertyView.spec.d.ts +0 -1
  61. package/build/data/ZoomIntoPropertyView.spec.js +0 -54
  62. package/build/data/comparer.spec.d.ts +0 -1
  63. package/build/data/comparer.spec.js +0 -50
  64. package/build/data/computable.spec.d.ts +0 -1
  65. package/build/data/computable.spec.js +0 -56
  66. package/build/data/createAccessorModelProxy.spec.d.ts +0 -1
  67. package/build/data/createAccessorModelProxy.spec.js +0 -30
  68. package/build/data/createStructuredSelector.spec.d.ts +0 -1
  69. package/build/data/createStructuredSelector.spec.js +0 -42
  70. package/build/data/diff/diffs.spec.d.ts +0 -1
  71. package/build/data/diff/diffs.spec.js +0 -45
  72. package/build/data/getAccessor.spec.d.ts +0 -1
  73. package/build/data/getAccessor.spec.js +0 -10
  74. package/build/data/getSelector.spec.d.ts +0 -1
  75. package/build/data/getSelector.spec.js +0 -36
  76. package/build/data/ops/append.spec.d.ts +0 -1
  77. package/build/data/ops/append.spec.js +0 -24
  78. package/build/data/ops/filter.spec.d.ts +0 -1
  79. package/build/data/ops/filter.spec.js +0 -25
  80. package/build/data/ops/findTreeNode.spec.d.ts +0 -1
  81. package/build/data/ops/findTreeNode.spec.js +0 -20
  82. package/build/data/ops/merge.spec.d.ts +0 -1
  83. package/build/data/ops/merge.spec.js +0 -23
  84. package/build/data/ops/removeTreeNodes.spec.d.ts +0 -1
  85. package/build/data/ops/removeTreeNodes.spec.js +0 -35
  86. package/build/data/ops/updateArray.spec.d.ts +0 -1
  87. package/build/data/ops/updateArray.spec.js +0 -33
  88. package/build/data/ops/updateTree.spec.d.ts +0 -1
  89. package/build/data/ops/updateTree.spec.js +0 -44
  90. package/build/global.scss +0 -14
  91. package/build/hooks/invokeCallback.spec.d.ts +0 -1
  92. package/build/hooks/invokeCallback.spec.js +0 -44
  93. package/build/hooks/resolveCallback.spec.d.ts +0 -1
  94. package/build/hooks/resolveCallback.spec.js +0 -35
  95. package/build/hooks/store.spec.d.ts +0 -1
  96. package/build/hooks/store.spec.js +0 -48
  97. package/build/hooks/useTrigger.spec.d.ts +0 -1
  98. package/build/hooks/useTrigger.spec.js +0 -59
  99. package/build/index.scss +0 -6
  100. package/build/svg/Svg.scss +0 -28
  101. package/build/svg/index.scss +0 -9
  102. package/build/ui/Controller.spec.d.ts +0 -1
  103. package/build/ui/Controller.spec.js +0 -251
  104. package/build/ui/Cx.spec.d.ts +0 -1
  105. package/build/ui/Cx.spec.js +0 -153
  106. package/build/ui/DataProxy.spec.d.ts +0 -1
  107. package/build/ui/DataProxy.spec.js +0 -208
  108. package/build/ui/IsolatedScope.spec.d.ts +0 -1
  109. package/build/ui/IsolatedScope.spec.js +0 -42
  110. package/build/ui/Repeater.spec.d.ts +0 -1
  111. package/build/ui/Repeater.spec.js +0 -109
  112. package/build/ui/Rescope.spec.d.ts +0 -1
  113. package/build/ui/Rescope.spec.js +0 -134
  114. package/build/ui/Restate.spec.d.ts +0 -1
  115. package/build/ui/Restate.spec.js +0 -257
  116. package/build/ui/adapter/ArrayAdapter.spec.d.ts +0 -1
  117. package/build/ui/adapter/ArrayAdapter.spec.js +0 -44
  118. package/build/ui/adapter/TreeAdapter.spec.d.ts +0 -1
  119. package/build/ui/adapter/TreeAdapter.spec.js +0 -71
  120. package/build/ui/app/Url.spec.d.ts +0 -1
  121. package/build/ui/app/Url.spec.js +0 -43
  122. package/build/ui/createFunctionalComponent.spec.d.ts +0 -1
  123. package/build/ui/createFunctionalComponent.spec.js +0 -272
  124. package/build/ui/index.scss +0 -2
  125. package/build/ui/layout/ContentPlaceholder.spec.d.ts +0 -1
  126. package/build/ui/layout/ContentPlaceholder.spec.js +0 -333
  127. package/build/ui/layout/FirstVisibleChildLayout.spec.d.ts +0 -1
  128. package/build/ui/layout/FirstVisibleChildLayout.spec.js +0 -101
  129. package/build/ui/layout/LabelsLeftLayout.scss +0 -47
  130. package/build/ui/layout/LabelsTopLayout.scss +0 -65
  131. package/build/ui/layout/index.scss +0 -3
  132. package/build/ui/layout/variables.scss +0 -2
  133. package/build/ui/variables.scss +0 -2
  134. package/build/util/Format.spec.d.ts +0 -1
  135. package/build/util/Format.spec.js +0 -58
  136. package/build/util/TraversalStack.spec.d.ts +0 -1
  137. package/build/util/TraversalStack.spec.js +0 -43
  138. package/build/util/call-once.scss +0 -7
  139. package/build/util/date/upperBoundCheck.spec.d.ts +0 -1
  140. package/build/util/date/upperBoundCheck.spec.js +0 -22
  141. package/build/util/getSearchQueryPredicate.spec.d.ts +0 -1
  142. package/build/util/getSearchQueryPredicate.spec.js +0 -33
  143. package/build/util/index.scss +0 -11
  144. package/build/util/isValidIdentifierName.spec.d.ts +0 -1
  145. package/build/util/isValidIdentifierName.spec.js +0 -28
  146. package/build/util/routeAppend.spec.d.ts +0 -1
  147. package/build/util/routeAppend.spec.js +0 -14
  148. package/build/util/scss/add-rules.scss +0 -40
  149. package/build/util/scss/calc.scss +0 -45
  150. package/build/util/scss/call-once.scss +0 -13
  151. package/build/util/scss/clockwise.scss +0 -49
  152. package/build/util/scss/colors.scss +0 -10
  153. package/build/util/scss/deep-get.scss +0 -12
  154. package/build/util/scss/deep-merge.scss +0 -21
  155. package/build/util/scss/divide.scss +0 -3
  156. package/build/util/scss/include.scss +0 -48
  157. package/build/util/scss/index.scss +0 -9
  158. package/build/variables.scss +0 -217
  159. package/build/widgets/AccessorBindings.spec.d.ts +0 -1
  160. package/build/widgets/AccessorBindings.spec.js +0 -40
  161. package/build/widgets/Button.scss +0 -119
  162. package/build/widgets/Button.variables.scss +0 -117
  163. package/build/widgets/CxCredit.scss +0 -39
  164. package/build/widgets/FlexBox.scss +0 -148
  165. package/build/widgets/Heading.scss +0 -40
  166. package/build/widgets/HighlightedSearchText.scss +0 -20
  167. package/build/widgets/HtmlElement.spec.d.ts +0 -1
  168. package/build/widgets/HtmlElement.spec.js +0 -38
  169. package/build/widgets/Icon.scss +0 -22
  170. package/build/widgets/List.scss +0 -93
  171. package/build/widgets/ProgressBar.scss +0 -51
  172. package/build/widgets/Resizer.scss +0 -44
  173. package/build/widgets/Section.scss +0 -56
  174. package/build/widgets/animations.scss +0 -11
  175. package/build/widgets/drag-drop/DragClone.scss +0 -36
  176. package/build/widgets/drag-drop/DragHandle.scss +0 -19
  177. package/build/widgets/drag-drop/DragSource.scss +0 -27
  178. package/build/widgets/drag-drop/DropZone.scss +0 -77
  179. package/build/widgets/drag-drop/index.scss +0 -4
  180. package/build/widgets/drag-drop/variables.scss +0 -15
  181. package/build/widgets/form/Calendar.scss +0 -199
  182. package/build/widgets/form/Calendar.variables.scss +0 -64
  183. package/build/widgets/form/Checkbox.scss +0 -129
  184. package/build/widgets/form/Checkbox.variables.scss +0 -40
  185. package/build/widgets/form/ColorField.scss +0 -98
  186. package/build/widgets/form/ColorPicker.scss +0 -285
  187. package/build/widgets/form/ColorPicker.variables.scss +0 -22
  188. package/build/widgets/form/DateTimeField.scss +0 -92
  189. package/build/widgets/form/DateTimePicker.scss +0 -47
  190. package/build/widgets/form/Field.scss +0 -164
  191. package/build/widgets/form/HelpText.scss +0 -24
  192. package/build/widgets/form/Label.scss +0 -38
  193. package/build/widgets/form/LookupField.scss +0 -221
  194. package/build/widgets/form/MonthField.scss +0 -100
  195. package/build/widgets/form/MonthPicker.scss +0 -125
  196. package/build/widgets/form/NumberField.scss +0 -63
  197. package/build/widgets/form/Radio.scss +0 -123
  198. package/build/widgets/form/Radio.variables.scss +0 -46
  199. package/build/widgets/form/Select.scss +0 -101
  200. package/build/widgets/form/Slider.scss +0 -121
  201. package/build/widgets/form/Switch.scss +0 -142
  202. package/build/widgets/form/TextArea.scss +0 -45
  203. package/build/widgets/form/TextField.scss +0 -57
  204. package/build/widgets/form/UploadButton.scss +0 -49
  205. package/build/widgets/form/ValidationError.scss +0 -23
  206. package/build/widgets/form/ValidationGroup.spec.d.ts +0 -1
  207. package/build/widgets/form/ValidationGroup.spec.js +0 -62
  208. package/build/widgets/form/Wheel.scss +0 -152
  209. package/build/widgets/form/index.scss +0 -24
  210. package/build/widgets/form/variables.scss +0 -355
  211. package/build/widgets/grid/Grid.scss +0 -640
  212. package/build/widgets/grid/Pagination.scss +0 -115
  213. package/build/widgets/grid/TreeNode.scss +0 -90
  214. package/build/widgets/grid/index.scss +0 -4
  215. package/build/widgets/grid/variables.scss +0 -137
  216. package/build/widgets/index.scss +0 -16
  217. package/build/widgets/nav/Link.scss +0 -20
  218. package/build/widgets/nav/Menu.scss +0 -76
  219. package/build/widgets/nav/Menu.variables.scss +0 -25
  220. package/build/widgets/nav/MenuItem.scss +0 -130
  221. package/build/widgets/nav/Route.spec.d.ts +0 -1
  222. package/build/widgets/nav/Route.spec.js +0 -15
  223. package/build/widgets/nav/Scroller.scss +0 -148
  224. package/build/widgets/nav/Tab.scss +0 -82
  225. package/build/widgets/nav/Tab.variables.scss +0 -84
  226. package/build/widgets/nav/cover.scss +0 -22
  227. package/build/widgets/nav/index.scss +0 -6
  228. package/build/widgets/nav/variables.scss +0 -27
  229. package/build/widgets/overlay/Dropdown.scss +0 -186
  230. package/build/widgets/overlay/Overlay.scss +0 -68
  231. package/build/widgets/overlay/Toast.scss +0 -164
  232. package/build/widgets/overlay/Tooltip.scss +0 -177
  233. package/build/widgets/overlay/Window.scss +0 -129
  234. package/build/widgets/overlay/Window.variables.scss +0 -62
  235. package/build/widgets/overlay/captureMouse.scss +0 -13
  236. package/build/widgets/overlay/index.scss +0 -15
  237. package/build/widgets/overlay/variables.scss +0 -85
  238. package/build/widgets/variables.scss +0 -146
@@ -1,101 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "cx/jsx-runtime";
2
- import { Store } from "../../data/Store";
3
- import { expr } from "../expr";
4
- import { createTestRenderer } from "../../util/test/createTestRenderer";
5
- import assert from "assert";
6
- import { FirstVisibleChildLayout } from "./FirstVisibleChildLayout";
7
- import { UseParentLayout } from "./UseParentLayout";
8
- import { PureContainer } from "../PureContainer";
9
- import { createFunctionalComponent } from "../createFunctionalComponent";
10
- describe("FirstVisibleChildLayout", () => {
11
- it("renders only the first child", () => {
12
- let widget = (_jsx("cx", { children: _jsxs("div", { layout: FirstVisibleChildLayout, children: [_jsx("header", {}), _jsx("main", {}), _jsx("footer", {})] }) }));
13
- let store = new Store();
14
- const component = createTestRenderer(store, widget);
15
- let tree = component.toJSON();
16
- assert.deepEqual(tree, {
17
- type: "div",
18
- props: {},
19
- children: [{ type: "header", props: {}, children: null }],
20
- });
21
- });
22
- it("does not process other widgets", () => {
23
- let h = false, m = false, f = false;
24
- let widget = (_jsx("cx", { children: _jsxs("div", { layout: FirstVisibleChildLayout, children: [_jsx("header", { onInit: () => {
25
- h = true;
26
- } }), _jsx("main", { onInit: () => {
27
- m = true;
28
- } }), _jsx("footer", { onInit: () => {
29
- f = true;
30
- } })] }) }));
31
- let store = new Store();
32
- const component = createTestRenderer(store, widget);
33
- let tree = component.toJSON();
34
- assert.deepEqual(tree, {
35
- type: "div",
36
- props: {},
37
- children: [{ type: "header", props: {}, children: null }],
38
- });
39
- assert.equal(h, true);
40
- assert.equal(m, false);
41
- assert.equal(f, false);
42
- });
43
- it("skips the first child if not visible", () => {
44
- let widget = (_jsx("cx", { children: _jsxs("div", { layout: FirstVisibleChildLayout, children: [_jsx("header", { visible: false }), _jsx("main", {}), _jsx("footer", {})] }) }));
45
- let store = new Store();
46
- const component = createTestRenderer(store, widget);
47
- let tree = component.toJSON();
48
- assert.deepEqual(tree, {
49
- type: "div",
50
- props: {},
51
- children: [{ type: "main", props: {}, children: null }],
52
- });
53
- });
54
- it("skips pure containers which use parent layouts", () => {
55
- let widget = (_jsx("cx", { children: _jsxs("div", { layout: FirstVisibleChildLayout, children: [_jsx(PureContainer, { layout: UseParentLayout, children: _jsx("header", { visible: false }) }), _jsx("main", {}), _jsx("footer", {})] }) }));
56
- let store = new Store();
57
- const component = createTestRenderer(store, widget);
58
- let tree = component.toJSON();
59
- assert.deepEqual(tree, {
60
- type: "div",
61
- props: {},
62
- children: [{ type: "main", props: {}, children: null }],
63
- });
64
- });
65
- it("works with functional components", () => {
66
- let FC = createFunctionalComponent(({ children }) => _jsx("cx", { children: children }));
67
- let widget = (_jsx("cx", { children: _jsxs("div", { layout: FirstVisibleChildLayout, children: [_jsx(FC, { dummy: true, children: _jsx("header", { visible: false }) }), _jsx("main", {}), _jsx("footer", {})] }) }));
68
- let store = new Store();
69
- const component = createTestRenderer(store, widget);
70
- let tree = component.toJSON();
71
- assert.deepEqual(tree, {
72
- type: "div",
73
- props: {},
74
- children: [{ type: "main", props: {}, children: null }],
75
- });
76
- });
77
- it("properly destroys invisible items", () => {
78
- let destroyList = [];
79
- let widget = (_jsx("cx", { children: _jsxs("div", { layout: FirstVisibleChildLayout, children: [_jsx("div", { visible: expr("{index} == 0"), onDestroy: () => destroyList.push(0) }), _jsx("div", { visible: expr("{index} == 1"), onDestroy: () => destroyList.push(1) }), _jsx("div", { visible: expr("{index} == 2"), onDestroy: () => destroyList.push(2) }), _jsx("div", { visible: expr("{index} == 3"), onDestroy: () => destroyList.push(3) }), _jsx("div", { visible: expr("{index} == 4"), onDestroy: () => destroyList.push(4) })] }) }));
80
- let store = new Store();
81
- const component = createTestRenderer(store, widget);
82
- store.set("index", 0);
83
- component.toJSON();
84
- assert.deepEqual(destroyList, []);
85
- store.set("index", 3);
86
- component.toJSON();
87
- assert.deepEqual(destroyList, [0]);
88
- store.set("index", 1);
89
- component.toJSON();
90
- assert.deepEqual(destroyList, [0, 3]);
91
- store.set("index", 4);
92
- component.toJSON();
93
- assert.deepEqual(destroyList, [0, 3, 1]);
94
- store.set("index", 0);
95
- component.toJSON();
96
- assert.deepEqual(destroyList, [0, 3, 1, 4]);
97
- store.set("index", -1);
98
- component.toJSON();
99
- assert.deepEqual(destroyList, [0, 3, 1, 4, 0]);
100
- });
101
- });
@@ -1,47 +0,0 @@
1
-
2
- @use "sass:map";
3
-
4
- @mixin cx-labelsleftlayout(
5
- $name: 'labelsleftlayout',
6
- $besm: $cx-besm
7
- ) {
8
- $block: map.get($besm, block);
9
- $element: map.get($besm, element);
10
- $state: map.get($besm, state);
11
- $mod: map.get($besm, mod);
12
-
13
- .#{$block}labelsleftlayout {
14
- border-spacing: 0;
15
-
16
- &.#{$mod}stretch {
17
- width: 100%;
18
-
19
- .#{$element}labelsleftlayout-label {
20
- width: 5em;
21
-
22
- .#{$block}label {
23
- white-space: nowrap;
24
- }
25
- }
26
- }
27
- }
28
-
29
- .#{$element}labelsleftlayout-field {
30
- padding: 5px 0 5px 5px;
31
- }
32
-
33
- .#{$element}labelsleftlayout-label {
34
- text-align: right;
35
- vertical-align: top;
36
-
37
- padding: 5px 5px 5px 0;
38
-
39
- .#{$block}label {
40
- padding-right: 0;
41
- }
42
- }
43
- }
44
-
45
- @if (cx-should-include('cx/ui/LabelsLeftLayout')) {
46
- @include cx-labelsleftlayout();
47
- }
@@ -1,65 +0,0 @@
1
- @use "sass:map";
2
-
3
- @mixin cx-labelstoplayout(
4
- $name: 'labelstoplayout',
5
- $besm: $cx-besm
6
- ) {
7
- $block: map.get($besm, block);
8
- $element: map.get($besm, element);
9
- $state: map.get($besm, state);
10
- $mod: map.get($besm, mod);
11
-
12
- .#{$block}labelstoplayout {
13
- border-spacing: 0 3px;
14
-
15
- &.#{$mod}stretch {
16
- width: 100%;
17
-
18
- //unsure what it does
19
- //.#{$element}labelstoplayout-label {
20
- // width: 10em;
21
- //}
22
- }
23
- }
24
-
25
- .#{$element}labelstoplayout-field {
26
- padding: 0 5px;
27
- box-sizing: border-box;
28
- vertical-align: top;
29
-
30
- &:first-child {
31
- padding-left: 0;
32
- }
33
-
34
- &:last-child {
35
- padding-right: 0;
36
- }
37
- }
38
-
39
- .#{$element}labelstoplayout-label {
40
- vertical-align: bottom;
41
- padding: 5px 5px 0 5px;
42
- box-sizing: border-box;
43
-
44
- .#{$block}label {
45
- padding-left: 0;
46
- padding-bottom: 0;
47
- }
48
-
49
- &:first-child {
50
- padding-left: 0;
51
- }
52
-
53
- &:last-child {
54
- padding-right: 0;
55
- }
56
- }
57
-
58
- .#{$mod}fixed {
59
- table-layout: fixed;
60
- }
61
- }
62
-
63
- @if (cx-should-include('cx/ui/LabelsTopLayout')) {
64
- @include cx-labelstoplayout();
65
- }
@@ -1,3 +0,0 @@
1
-
2
- @import "LabelsLeftLayout";
3
- @import "LabelsTopLayout";
@@ -1,2 +0,0 @@
1
-
2
- // Layout variables
@@ -1,2 +0,0 @@
1
-
2
- @import "layout/variables";
@@ -1 +0,0 @@
1
- export {};
@@ -1,58 +0,0 @@
1
- import assert from 'assert';
2
- import { Format } from './Format';
3
- describe('Format', function () {
4
- describe('n,number ', function () {
5
- it('correctly formats numbers with min and max allowed precision', function () {
6
- assert.equal(Format.value(0.5, 'n;2;4'), '0.50');
7
- assert.equal(Format.value(0.50101, 'n;2;4'), '0.501');
8
- assert.equal(Format.value(0.5012, 'n;2;4'), '0.5012');
9
- assert.equal(Format.value(0.0, 'n;0;4'), '0');
10
- });
11
- it('correctly formats numbers fixed precision', function () {
12
- assert.equal(Format.value(0.5, 'number;3'), '0.500');
13
- assert.equal(Format.value(0.50101, 'number;3'), '0.501');
14
- assert.equal(Format.value(0.5016, 'number;3'), '0.502');
15
- });
16
- });
17
- describe('p,percentage', function () {
18
- it('correctly formats numbers with min and max allowed precision', function () {
19
- assert.equal(Format.value(0.5, 'p;2;4'), '50.00%');
20
- assert.equal(Format.value(0.50101, 'p;2;4'), '50.101%');
21
- assert.equal(Format.value(0.50123456, 'p;2;4'), '50.1235%');
22
- assert.equal(Format.value(0.0, 'p;0;4'), '0%');
23
- });
24
- it('correctly formats numbers fixed precision', function () {
25
- assert.equal(Format.value(0.5, 'percentage;3'), '50.000%');
26
- assert.equal(Format.value(0.50101, 'percentage;3'), '50.101%');
27
- assert.equal(Format.value(0.5016, 'percentage;3'), '50.160%');
28
- });
29
- });
30
- describe('date,time,datetime', function () {
31
- it('correctly formats dates', function () {
32
- assert.equal(Format.value(new Date(2015, 3, 1), 'd'), '4/1/2015');
33
- });
34
- it('correctly formats time', function () {
35
- assert.equal(Format.value(new Date(2015, 3, 1, 16, 15, 14), 't'), '16:15');
36
- assert.equal(Format.value(new Date(2015, 3, 1, 5, 6, 14), 'time'), '05:06');
37
- });
38
- it('correctly formats date-time', function () {
39
- assert.equal(Format.value(new Date(2015, 3, 1, 5, 6, 14), 'dt'), '4/1/2015 05:06');
40
- });
41
- });
42
- describe('ellipsis', function () {
43
- it('can shorten long texts', function () {
44
- assert.equal(Format.value('This is a very long text.', 'ellipsis;7'), 'This...');
45
- });
46
- it('can be used at the start of string', function () {
47
- assert.equal(Format.value('This is a very long text.', 'ellipsis;8;start'), '...text.');
48
- });
49
- it('can be used in the middle of the string', function () {
50
- assert.equal(Format.value('First (Middle) Last', 'ellipsis;11;middle'), 'Firs...Last');
51
- });
52
- });
53
- describe('null text', function () {
54
- it('can contain null text', function () {
55
- assert.equal(Format.value(null, 'n;2|N/A'), 'N/A');
56
- });
57
- });
58
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,43 +0,0 @@
1
- import { TraversalStack } from './TraversalStack';
2
- import assert from 'assert';
3
- describe('TraversalStack', function () {
4
- it('push', function () {
5
- let stack = new TraversalStack();
6
- stack.push(1);
7
- assert.equal(stack.pop(), 1);
8
- });
9
- it('traverses the tree in the right order', function () {
10
- let stack = new TraversalStack();
11
- let tree = {
12
- id: 1,
13
- children: [{
14
- id: 2,
15
- children: [{
16
- id: 3
17
- }, {
18
- id: 4
19
- }]
20
- }, {
21
- id: 5,
22
- children: [{
23
- id: 6
24
- }]
25
- }]
26
- };
27
- let list = [];
28
- stack.push(tree);
29
- while (!stack.empty()) {
30
- let node = stack.pop();
31
- if (node) {
32
- list.push(node.id);
33
- if (node.children) {
34
- stack.hop();
35
- node.children.forEach((child) => {
36
- stack.push(child);
37
- });
38
- }
39
- }
40
- }
41
- assert.deepEqual(list, [1, 2, 3, 4, 5, 6]);
42
- });
43
- });
@@ -1,7 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,22 +0,0 @@
1
- import assert from 'assert';
2
- import { upperBoundCheck } from './upperBoundCheck';
3
- describe('upperBoundCheck', () => {
4
- let may18th = new Date('2017-05-18'); // May 18th
5
- let may19th = new Date('2017-05-19'); // May 19th
6
- let exclusive = true; // strictly less than...
7
- it('returns true for May 18th <= May 19th', () => {
8
- assert.equal(upperBoundCheck(may18th, may19th), true);
9
- });
10
- it('returns true for May 19th <= May 19th', () => {
11
- assert.equal(upperBoundCheck(may19th, may19th), true);
12
- });
13
- it('returns true for May 19th <= May 19th with exclusive=`false`', () => {
14
- assert.equal(upperBoundCheck(may19th, may19th, false), true);
15
- });
16
- it('returns false for May 19th < May 19th', () => {
17
- assert.equal(upperBoundCheck(may19th, may19th, exclusive), false);
18
- });
19
- it('returns false for May 19th <= May 18th', () => {
20
- assert.equal(upperBoundCheck(may19th, may18th), false);
21
- });
22
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- import { getSearchQueryPredicate, getSearchQueryHighlighter } from "./getSearchQueryPredicate";
2
- import assert from "assert";
3
- describe("getSearchQueryPredicate", function () {
4
- it("blank means allow all", function () {
5
- var m = getSearchQueryPredicate("");
6
- assert(m("cx"));
7
- });
8
- it("is case insensitive", function () {
9
- var m = getSearchQueryPredicate("Cx");
10
- assert(m("cx"));
11
- });
12
- it("if multiple words are provided, all must be matched", function () {
13
- var m = getSearchQueryPredicate("jo smi");
14
- assert(m("John Smith"));
15
- assert(!m("John Nash"));
16
- });
17
- it("regex special characters are properly escaped", function () {
18
- var m = getSearchQueryPredicate("*?");
19
- assert(m("*?"));
20
- });
21
- });
22
- describe("getSearchQueryHighlighter", function () {
23
- it("detects search parts", function () {
24
- var m = getSearchQueryHighlighter("jo smi");
25
- let items = m("John Smith");
26
- assert.deepStrictEqual(items, ["", "Jo", "hn ", "Smi", "th"]);
27
- });
28
- it("detects search parts occuring multiple times", function () {
29
- var m = getSearchQueryHighlighter("O");
30
- let items = m("Option 1");
31
- assert.deepStrictEqual(items, ["", "O", "pti", "o", "n 1"]);
32
- });
33
- });
@@ -1,11 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,28 +0,0 @@
1
- import { isValidIdentifierName } from "./isValidIdentifierName";
2
- import assert from "assert";
3
- describe("isValidIdentifierName", function () {
4
- it("names starting with a number are not valid", function () {
5
- assert(!isValidIdentifierName("1a"));
6
- assert(!isValidIdentifierName("00"));
7
- assert(!isValidIdentifierName("0_abc"));
8
- });
9
- it("names starting with a dollar sign are valid", function () {
10
- assert(isValidIdentifierName("$a"));
11
- assert(isValidIdentifierName("$"));
12
- });
13
- it("names starting with an underscore are valid", function () {
14
- assert(isValidIdentifierName("_a"));
15
- assert(isValidIdentifierName("_"));
16
- });
17
- it("names starting with a letter are valid", function () {
18
- assert(isValidIdentifierName("a"));
19
- assert(isValidIdentifierName("abc"));
20
- assert(isValidIdentifierName("abc0123"));
21
- });
22
- it("names with invalid characters are not valid", function () {
23
- assert(!isValidIdentifierName("a b"));
24
- assert(!isValidIdentifierName("a-b"));
25
- assert(!isValidIdentifierName("a.b"));
26
- assert(!isValidIdentifierName("a!b"));
27
- });
28
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- import { routeAppend } from './routeAppend';
2
- import assert from 'assert';
3
- describe('routeAppend', function () {
4
- it('adds / if necessary', function () {
5
- assert(routeAppend('x', 'y'), 'x/y');
6
- });
7
- it('does not add extra / if not necessary', function () {
8
- assert(routeAppend('x/', 'y'), 'x/y');
9
- assert(routeAppend('x', '/y'), 'x/y');
10
- });
11
- it('removes extra slash if both parts contain it', function () {
12
- assert(routeAppend('x/', '/y'), 'x/y');
13
- });
14
- });
@@ -1,40 +0,0 @@
1
- @use "sass:map";
2
-
3
- @mixin cx-add-rules($styles) {
4
- @each $rule, $value in $styles {
5
- #{$rule}: $value;
6
- }
7
- }
8
-
9
- @mixin cx-add-state-rules($state-style-map, $key) {
10
- @include cx-add-rules(map.get($state-style-map, $key));
11
- }
12
-
13
- @function cx-merge-state-style-maps($state-style-map, $override-style-map) {
14
- $result: $state-style-map;
15
-
16
- @if ($override-style-map != null) {
17
- @each $key, $new-value in $override-style-map {
18
- $old-value: map.get($state-style-map, $key);
19
- @if ($old-value != null) {
20
- $new-value: map.merge($old-value, $new-value);
21
- }
22
- $result: map.merge(
23
- $result,
24
- (
25
- $key: $new-value,
26
- )
27
- );
28
- }
29
- }
30
-
31
- @return $result;
32
- }
33
-
34
- @function cx-get-state-rule($state-style-map, $key, $rule, $default: null) {
35
- $result: map.get(map.get($state-style-map, $key), $rule);
36
- @if ($result != null) {
37
- @return $result;
38
- }
39
- @return $default;
40
- }
@@ -1,45 +0,0 @@
1
- @use "sass:list";
2
- @use "sass:map";
3
- @use "sass:math";
4
-
5
- @function cx-calc($lengths...) {
6
- $units: ();
7
-
8
- @each $l in $lengths {
9
- $unit: math.unit($l);
10
- @if (map.has-key($units, $unit)) {
11
- $nl: map.get($units, $unit) + $l;
12
- $units: map.merge($units, ($unit: $nl))
13
- } @else {
14
- $units: map.merge($units, ($unit: $l))
15
- }
16
- }
17
-
18
- $keys: map.keys($units);
19
- @if (list.length($keys) == 1) {
20
- @return map.get($units, list.nth($keys, 1));
21
- }
22
-
23
- $calc: '';
24
- $count: 0;
25
-
26
- @each $u, $v in $units {
27
- @if ($v != 0) {
28
- $count: $count + 1;
29
- @if ($count > 1) {
30
- $calc: $calc + ' + ';
31
- }
32
- $calc: $calc + $v;
33
- }
34
- }
35
-
36
- @if ($count == 0) {
37
- @return 0;
38
- }
39
-
40
- @if ($count == 1) {
41
- @return #{$calc};
42
- }
43
-
44
- @return #{'calc(' + $calc + ')'};
45
- }
@@ -1,13 +0,0 @@
1
- @use "sass:map";
2
-
3
- $cx-call-once-data: () !default;
4
-
5
- @function cx-call-once($name) {
6
- $result: map.get($cx-call-once-data, $name);
7
- $cx-call-once-data: map.merge($cx-call-once-data, ($name: true)) !global;
8
- @return $result != true;
9
- }
10
-
11
- @function cx-called-once($name) {
12
- @return map.get($cx-call-once-data, $name);
13
- }
@@ -1,49 +0,0 @@
1
- @use "sass:list";
2
-
3
- @function cx-top($list) {
4
- @if (list.length($list) > 0) {
5
- @return list.nth($list, 1);
6
- }
7
- @return null;
8
- }
9
-
10
- @function cx-right($list) {
11
- @if (list.length($list) == 1) {
12
- @return list.nth($list, 1);
13
- }
14
- @if (list.length($list) > 1) {
15
- @return list.nth($list, 2);
16
- }
17
- @return null;
18
- }
19
-
20
- @function cx-bottom($list) {
21
- @if (list.length($list) > 2) {
22
- @return list.nth($list, 3);
23
- }
24
-
25
- @if (list.length($list) >= 1) {
26
- @return list.nth($list, 1);
27
- }
28
-
29
- @return null;
30
- }
31
-
32
- @function cx-left($list) {
33
- @if (list.length($list) == 1) {
34
- @return list.nth($list, 1);
35
- }
36
-
37
- @if (list.length($list) == 2) {
38
- @return list.nth($list, 2);
39
- }
40
-
41
- @if (list.length($list) == 3) {
42
- @return list.nth($list, 2);
43
- }
44
-
45
- @if (list.length($list) == 4) {
46
- @return list.nth($list, 4);
47
- }
48
- @return null;
49
- }
@@ -1,10 +0,0 @@
1
-
2
- @use "sass:color";
3
-
4
- @function cx-whiten($color, $percentage) {
5
- @return color.mix(white, $color, $percentage);
6
- }
7
-
8
- @function cx-blacken($color, $percentage) {
9
- @return color.mix(black, $color, $percentage);
10
- }
@@ -1,12 +0,0 @@
1
- @use "sass:map";
2
-
3
- @function cx-map-deep-get($map, $keys...){
4
- @each $key in $keys {
5
- $map: map.get($map, $key)
6
- }
7
- @if $map != null {
8
- @return $map
9
- } @else {
10
- @return null
11
- }
12
- };
@@ -1,21 +0,0 @@
1
- @use "sass:map";
2
- @use "sass:meta";
3
-
4
- @function cx-deep-map-merge($parent-map, $child-map) {
5
- $result: $parent-map;
6
- @each $key, $value in $child-map {
7
- //If the parent map does not have the child map's key, or
8
- //If their type don't match, or
9
- //If they are not both maps,
10
- @if (not map.has-key($result, $key)) or (meta.type-of(map.get($result, $key)) != meta.type-of($value)) or (not (meta.type-of(map.get($result, $key)) == map and meta.type-of($value) == map)) {
11
- //Simply add that key to the parent map.
12
- $result: map.merge($result, ($key: $value));
13
- }
14
- @else {
15
- //If they are both maps, we need another non-destructive merger.
16
- //Recursive, yay!
17
- $result: map.merge($result, ($key: cx-deep-map-merge(map.get($result, $key), $value)));
18
- }
19
- }
20
- @return $result;
21
- }