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 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import assert from 'assert';
2
- import { Store } from '../Store';
3
- import { append } from './append';
4
- describe('append', function () {
5
- it('should add elements to an array', function () {
6
- let store = new Store({
7
- data: {
8
- array: []
9
- }
10
- });
11
- assert(store.update('array', append, 1));
12
- assert.deepEqual(store.get('array'), [1]);
13
- });
14
- it('should work with undefined arrays', function () {
15
- let store = new Store();
16
- assert(store.update('array', append, 1));
17
- assert.deepEqual(store.get('array'), [1]);
18
- });
19
- it('accepts multiple arguments', function () {
20
- let store = new Store();
21
- assert(store.update('array', append, 1, 2, 3));
22
- assert.deepEqual(store.get('array'), [1, 2, 3]);
23
- });
24
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- import assert from "assert";
2
- import { Store } from "../Store";
3
- import { filter } from "./filter";
4
- describe("filter", function () {
5
- it("should filter array elements", function () {
6
- let store = new Store({
7
- data: {
8
- array: [1, 2, 3],
9
- },
10
- });
11
- assert(store.update("array", filter, (x) => x > 1));
12
- assert.deepEqual(store.get("array"), [2, 3]);
13
- });
14
- it("should work with undefined arrays", function () {
15
- let store = new Store();
16
- assert.equal(false, store.update("array", filter, (x) => x > 1));
17
- assert.deepEqual(store.get("array"), undefined);
18
- });
19
- it("returns same array if all elements satisfy condition", function () {
20
- let array = [1, 2, 3];
21
- let store = new Store({ data: { array } });
22
- assert.equal(false, store.update("array", filter, (x) => x > 0));
23
- assert(store.get("array") === array);
24
- });
25
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- import assert from 'assert';
2
- import { findTreeNode } from './findTreeNode';
3
- describe('removeTreeNodes', function () {
4
- it('removes all nodes that satisfy criteria', function () {
5
- let array = [{
6
- id: 'n1',
7
- value: 1,
8
- children: [{
9
- id: 'n11',
10
- value: 2
11
- }, {
12
- id: 'n12',
13
- value: 3
14
- }]
15
- }];
16
- let node = findTreeNode(array, x => x.value == 3, 'children');
17
- assert(node);
18
- assert.equal(node.value, 3);
19
- });
20
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,23 +0,0 @@
1
- import { Store } from "../Store";
2
- import { merge } from "./merge";
3
- import assert from "assert";
4
- describe("merge", function () {
5
- it("performs multiple set operations", function () {
6
- let store = new Store({
7
- data: {
8
- person: { firstName: "John", lastName: "Doe" },
9
- },
10
- });
11
- assert(store.update("person", merge, { firstName: "Johny", age: 18 }));
12
- assert.deepEqual(store.get("person"), { firstName: "Johny", lastName: "Doe", age: 18 });
13
- });
14
- it("does not modify data if not necessary", function () {
15
- let store = new Store({
16
- data: {
17
- person: { firstName: "John", lastName: "Doe" },
18
- },
19
- });
20
- assert(store.update("person", merge, { firstName: "John" }) == false);
21
- assert.deepEqual(store.get("person"), { firstName: "John", lastName: "Doe" });
22
- });
23
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,35 +0,0 @@
1
- import { Store } from "../Store";
2
- import { removeTreeNodes } from "./removeTreeNodes";
3
- import assert from "assert";
4
- describe("removeTreeNodes", function () {
5
- it("removes all nodes that satisfy criteria", function () {
6
- let store = new Store({
7
- data: {
8
- array: [
9
- {
10
- id: "n1",
11
- value: 1,
12
- children: [
13
- {
14
- id: "n11",
15
- value: 2,
16
- },
17
- {
18
- id: "n12",
19
- value: 3,
20
- },
21
- ],
22
- },
23
- ],
24
- },
25
- });
26
- assert(store.update("array", removeTreeNodes, (x) => x.value > 1, "children"));
27
- assert.deepEqual(store.get("array"), [
28
- {
29
- id: "n1",
30
- value: 1,
31
- children: [],
32
- },
33
- ]);
34
- });
35
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- import { Store } from "../Store";
2
- import { updateArray } from "./updateArray";
3
- import assert from "assert";
4
- describe("updateArray", function () {
5
- it("updates all elements that satisfy criteria", function () {
6
- let store = new Store({
7
- data: { array: [1, 2, 3, 4, 5, 6] },
8
- });
9
- assert(store.update("array", updateArray, (x) => x + 1, (x) => x > 3));
10
- assert.deepEqual(store.get("array"), [1, 2, 3, 5, 6, 7]);
11
- });
12
- it("does not modify data if not necessary", function () {
13
- let array = [1, 2, 3, 4, 5, 6];
14
- let store = new Store({
15
- data: { array },
16
- });
17
- assert(false ===
18
- store.update("array", updateArray, (x) => x + 1, (x) => x > 10));
19
- assert(store.get("array") === array);
20
- });
21
- it("works with null or undefined", function () {
22
- let store = new Store();
23
- assert(false ===
24
- store.update("array", updateArray, (x) => x + 1, (x) => x > 0));
25
- });
26
- it("can remove elements given the criteria", function () {
27
- let store = new Store({
28
- data: { array: [1, 2, 3, 4, 5, 6] },
29
- });
30
- assert(store.update("array", updateArray, (x) => x + 1, (x) => x > 3, (x) => x <= 3));
31
- assert.deepEqual(store.get("array"), [5, 6, 7]);
32
- });
33
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,44 +0,0 @@
1
- import { Store } from "../Store";
2
- import { updateTree } from "./updateTree";
3
- import assert from "assert";
4
- describe("updateTree", function () {
5
- it("updates all nodes that satisfy criteria", function () {
6
- let store = new Store({
7
- data: {
8
- array: [
9
- {
10
- id: "n1",
11
- value: 1,
12
- children: [
13
- {
14
- id: "n11",
15
- value: 2,
16
- },
17
- {
18
- id: "n12",
19
- value: 3,
20
- },
21
- ],
22
- },
23
- ],
24
- },
25
- });
26
- assert(store.update("array", updateTree, (x) => ({ ...x, value: x.value + 1 }), (x) => x.value > 1, "children"));
27
- assert.deepEqual(store.get("array"), [
28
- {
29
- id: "n1",
30
- value: 1,
31
- children: [
32
- {
33
- id: "n11",
34
- value: 3,
35
- },
36
- {
37
- id: "n12",
38
- value: 4,
39
- },
40
- ],
41
- },
42
- ]);
43
- });
44
- });
package/build/global.scss DELETED
@@ -1,14 +0,0 @@
1
-
2
- $cx-include-global-rules: false !default;
3
-
4
- @mixin cx-global-rules() {
5
- @each $tag, $styles in $cx-element-style-map {
6
- #{$tag} {
7
- @include cx-add-rules($styles)
8
- }
9
- }
10
- }
11
-
12
- @if ($cx-include-global-rules and cx-call-once('cx/globals')) {
13
- @include cx-global-rules();
14
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,44 +0,0 @@
1
- import { jsx as _jsx } from "cx/jsx-runtime";
2
- import assert from "assert";
3
- import { Store } from "../data/Store";
4
- import { createFunctionalComponent } from "../ui/createFunctionalComponent";
5
- import { createTestRenderer } from "../util/test/createTestRenderer";
6
- import { invokeCallback } from "./invokeCallback";
7
- describe("invokeCallback", () => {
8
- it("works with functions", () => {
9
- const FComp = createFunctionalComponent(({ onTest }) => {
10
- invokeCallback(null, onTest, "works");
11
- return (_jsx("cx", { children: _jsx("div", {}) }));
12
- });
13
- let store = new Store();
14
- let value;
15
- const component = createTestRenderer(store, {
16
- type: FComp,
17
- onTest: (v) => {
18
- value = v;
19
- },
20
- });
21
- component.toJSON();
22
- assert.equal(value, "works");
23
- });
24
- it("works with controller methods", () => {
25
- const FComp = createFunctionalComponent(({ onTest }) => {
26
- return (_jsx("cx", { children: _jsx("div", { onExplore: (context, instance) => {
27
- invokeCallback(instance, onTest, "works");
28
- } }) }));
29
- });
30
- let store = new Store();
31
- let value;
32
- const component = createTestRenderer(store, {
33
- type: FComp,
34
- onTest: "onTest",
35
- controller: {
36
- onTest(v) {
37
- value = v;
38
- },
39
- },
40
- });
41
- component.toJSON();
42
- assert.equal(value, "works");
43
- });
44
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx } from "cx/jsx-runtime";
2
- import assert from "assert";
3
- import { Store } from "../data/Store";
4
- import { createFunctionalComponent } from "../ui/createFunctionalComponent";
5
- import { createTestRenderer } from "../util/test/createTestRenderer";
6
- import { resolveCallback } from "./resolveCallback";
7
- describe("resolveCallback", () => {
8
- it("works with functions", () => {
9
- const FComp = createFunctionalComponent(({ onTest }) => {
10
- let callback = resolveCallback(onTest);
11
- assert(typeof callback === 'function');
12
- callback("works");
13
- return (_jsx("cx", { children: _jsx("div", {}) }));
14
- });
15
- let store = new Store();
16
- let value;
17
- const component = createTestRenderer(store, _jsx("cx", { children: _jsx(FComp, { onTest: (v) => { value = v; } }) }));
18
- component.toJSON();
19
- assert.equal(value, "works");
20
- });
21
- it("works with controller methods", () => {
22
- const FComp = createFunctionalComponent(({ onTest }) => {
23
- let callback = resolveCallback(onTest);
24
- assert(typeof callback === 'function');
25
- return (_jsx("cx", { children: _jsx("div", { onInit: () => { callback("works"); } }) }));
26
- });
27
- let store = new Store();
28
- let value;
29
- const component = createTestRenderer(store, _jsx("cx", { children: _jsx(FComp, { onTest: "onTest", controller: {
30
- onTest(v) { value = v; }
31
- } }) }));
32
- component.toJSON();
33
- assert.equal(value, "works");
34
- });
35
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,48 +0,0 @@
1
- import { jsx as _jsx } from "cx/jsx-runtime";
2
- import assert from "assert";
3
- import { createTestRenderer } from "src/util/test/createTestRenderer";
4
- import { computable } from "../data";
5
- import { Store } from "../data/Store";
6
- import { createFunctionalComponent } from "../ui/createFunctionalComponent";
7
- import { ref } from "./store";
8
- describe("ref", () => {
9
- it("allows store references in functional components", () => {
10
- const FComp = createFunctionalComponent(({}) => {
11
- let testValue = ref({ bind: "x", defaultValue: 10 });
12
- return (_jsx("cx", { children: _jsx("div", { text: testValue }) }));
13
- });
14
- let store = new Store();
15
- const component = createTestRenderer(store, FComp);
16
- let tree = component.toJSON();
17
- assert.deepEqual(tree, {
18
- type: "div",
19
- children: ["10"],
20
- props: {},
21
- });
22
- });
23
- it("can be used to adapt any prop passed to a functional component", () => {
24
- const FComp = createFunctionalComponent(({ value }) => {
25
- return (_jsx("cx", { children: _jsx("div", { text: computable(ref(value), (value) => `x${value}`) }) }));
26
- });
27
- let store = new Store({ data: { value: 100 } });
28
- function test(value, expectation) {
29
- const component = createTestRenderer(store, _jsx(FComp, { value: value }));
30
- let tree = component.toJSON();
31
- assert.deepEqual(tree, {
32
- type: "div",
33
- children: [expectation],
34
- props: {},
35
- });
36
- }
37
- test({ bind: "value" }, "x100");
38
- test({ expr: "{value}" }, "x100");
39
- test({ tpl: "{value:n;2}" }, "x100.00");
40
- test(200, "x200");
41
- test(() => 500, "x500");
42
- test(computable("value", (value) => value + 100), "x200");
43
- test(null, "xnull");
44
- test(undefined, "xundefined");
45
- test(0, "x0");
46
- test(false, "xfalse");
47
- });
48
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,59 +0,0 @@
1
- import { jsx as _jsx } from "cx/jsx-runtime";
2
- import assert from "assert";
3
- import { createTestRenderer } from "src/util/test/createTestRenderer";
4
- import { Store } from "../data/Store";
5
- import { createFunctionalComponent } from "../ui/createFunctionalComponent";
6
- import { useTrigger } from "./useTrigger";
7
- describe("useTrigger", () => {
8
- it("works", () => {
9
- let last = null;
10
- const FComp = createFunctionalComponent(({ ...props }) => {
11
- useTrigger(["test"], (test) => {
12
- last = test;
13
- });
14
- return (_jsx("cx", { children: _jsx("div", {}) }));
15
- });
16
- let store = new Store();
17
- let test = store.ref("test", 1);
18
- const component = createTestRenderer(store, FComp);
19
- component.toJSON();
20
- assert.equal(last, null); //trigger did not fire because it didn't receive true as the last argument
21
- test.set(2);
22
- component.toJSON();
23
- assert.equal(last, 2);
24
- });
25
- it("fires immediately if the last argument is true", () => {
26
- let last = null;
27
- const FComp = createFunctionalComponent(({ ...props }) => {
28
- useTrigger(["test"], (test) => {
29
- last = test;
30
- }, true);
31
- return (_jsx("cx", { children: _jsx("div", {}) }));
32
- });
33
- let store = new Store();
34
- let test = store.ref("test", 1);
35
- const component = createTestRenderer(store, FComp);
36
- component.toJSON();
37
- assert.equal(last, 1);
38
- test.set(2);
39
- component.toJSON();
40
- assert.equal(last, 2);
41
- });
42
- it("accepts refs as arguments", () => {
43
- let last = null;
44
- let store = new Store();
45
- let test = store.ref("test", 1);
46
- const FComp = createFunctionalComponent(({ ...props }) => {
47
- useTrigger([test], (test) => {
48
- last = test;
49
- }, true);
50
- return (_jsx("cx", { children: _jsx("div", {}) }));
51
- });
52
- const component = createTestRenderer(store, FComp);
53
- component.toJSON();
54
- assert.equal(last, 1);
55
- test.set(2);
56
- component.toJSON();
57
- assert.equal(last, 2);
58
- });
59
- });
package/build/index.scss DELETED
@@ -1,6 +0,0 @@
1
- @import "global";
2
- @import "util/index";
3
- @import "ui/index";
4
- @import "widgets/index";
5
- @import "svg/index";
6
- @import "charts/index";
@@ -1,28 +0,0 @@
1
- @use "sass:map";
2
-
3
- @mixin cx-svg(
4
- $name: 'svg',
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}#{$name} {
13
- box-sizing: border-box;
14
- overflow: hidden;
15
- position: relative;
16
- height: 150px; //default height
17
-
18
- & > svg {
19
- width: 100%;
20
- height: 100%;
21
- position: absolute;
22
- }
23
- }
24
- }
25
-
26
- @if (cx-should-include('cx/svg/Svg')) {
27
- @include cx-svg;
28
- }
@@ -1,9 +0,0 @@
1
- .cxs-text-anchor-middle {
2
- text-anchor: middle;
3
- }
4
-
5
- .cxs-text-anchor-right {
6
- text-anchor: end;
7
- }
8
-
9
- @import "Svg";
@@ -1 +0,0 @@
1
- export {};