cx 26.0.5 → 26.0.6
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.
- package/build/data/ArrayElementView.spec.js +1 -1
- package/build/hooks/store.spec.js +1 -1
- package/build/hooks/useTrigger.spec.js +1 -1
- package/build/ui/Controller.spec.js +6 -2
- package/build/ui/app/startAppLoop.d.ts +3 -2
- package/build/ui/app/startHotAppLoop.d.ts +3 -2
- package/build/ui/layout/ContentPlaceholder.spec.js +12 -12
- package/build.js +129 -129
- package/dist/manifest.js +844 -844
- package/package.json +2 -2
- package/src/charts/Chart.ts +108 -108
- package/src/data/ArrayElementView.ts +90 -90
- package/src/data/AugmentedViewBase.ts +88 -88
- package/src/data/Binding.ts +104 -104
- package/src/data/ExposedRecordView.ts +95 -95
- package/src/data/ExposedValueView.ts +89 -89
- package/src/data/Expression.spec.ts +229 -229
- package/src/data/Expression.ts +233 -233
- package/src/data/Grouper.spec.ts +57 -57
- package/src/data/Grouper.ts +158 -158
- package/src/data/NestedDataView.ts +43 -43
- package/src/data/ReadOnlyDataView.ts +39 -39
- package/src/data/Ref.ts +104 -104
- package/src/data/Selector.ts +10 -10
- package/src/data/Store.ts +52 -52
- package/src/data/StoreProxy.ts +19 -19
- package/src/data/StoreRef.ts +66 -66
- package/src/data/StringTemplate.spec.ts +132 -132
- package/src/data/StringTemplate.ts +93 -93
- package/src/data/StructuredSelector.spec.ts +113 -113
- package/src/data/StructuredSelector.ts +146 -146
- package/src/data/SubscribableView.ts +63 -63
- package/src/data/ZoomIntoPropertyView.spec.ts +64 -64
- package/src/data/ZoomIntoPropertyView.ts +45 -45
- package/src/data/computable.spec.ts +62 -62
- package/src/data/createAccessorModelProxy.ts +60 -60
- package/src/data/createStructuredSelector.ts +62 -62
- package/src/data/getAccessor.spec.ts +11 -11
- package/src/data/getAccessor.ts +74 -74
- package/src/data/getSelector.spec.ts +43 -43
- package/src/data/getSelector.ts +66 -66
- package/src/data/ops/filter.spec.ts +35 -35
- package/src/data/ops/filter.ts +9 -9
- package/src/data/ops/merge.ts +13 -13
- package/src/data/ops/removeTreeNodes.spec.ts +37 -37
- package/src/data/ops/removeTreeNodes.ts +15 -15
- package/src/data/ops/updateArray.spec.ts +69 -69
- package/src/data/ops/updateArray.ts +31 -31
- package/src/data/ops/updateTree.ts +23 -23
- package/src/data/test-types.ts +7 -7
- package/src/hooks/useTrigger.ts +26 -26
- package/src/index.scss +6 -6
- package/src/jsx-runtime.ts +72 -72
- package/src/svg/BoundedObject.ts +101 -101
- package/src/ui/CSSHelper.ts +17 -17
- package/src/ui/ContentResolver.ts +124 -124
- package/src/ui/Controller.ts +189 -189
- package/src/ui/Culture.ts +159 -159
- package/src/ui/DataProxy.ts +55 -55
- package/src/ui/FocusManager.ts +171 -171
- package/src/ui/Instance.ts +868 -868
- package/src/ui/RenderingContext.ts +99 -99
- package/src/ui/Rescope.ts +49 -49
- package/src/ui/StructuredInstanceDataAccessor.ts +32 -32
- package/src/ui/VDOM.ts +34 -34
- package/src/ui/adapter/ArrayAdapter.spec.ts +55 -55
- package/src/ui/adapter/ArrayAdapter.ts +226 -226
- package/src/ui/adapter/TreeAdapter.spec.ts +76 -76
- package/src/ui/adapter/TreeAdapter.ts +185 -185
- package/src/ui/app/History.ts +133 -133
- package/src/ui/app/Url.spec.ts +50 -50
- package/src/ui/app/startAppLoop.tsx +2 -1
- package/src/ui/app/startHotAppLoop.ts +2 -1
- package/src/ui/createFunctionalComponent.ts +65 -65
- package/src/ui/index.ts +45 -45
- package/src/ui/layout/Content.ts +30 -30
- package/src/ui/layout/FirstVisibleChildLayout.ts +60 -60
- package/src/ui/selection/KeySelection.ts +165 -165
- package/src/ui/selection/PropertySelection.ts +87 -87
- package/src/ui/selection/Selection.ts +118 -118
- package/src/util/Format.ts +267 -267
- package/src/util/browserSupportsPassiveEventHandlers.ts +20 -20
- package/src/util/color/rgbToHsl.ts +35 -35
- package/src/util/getActiveElement.ts +4 -4
- package/src/util/hasKey.ts +18 -18
- package/src/util/index.ts +55 -55
- package/src/util/innerTextTrim.ts +10 -10
- package/src/util/isArray.ts +3 -3
- package/src/util/isDataRecord.ts +5 -5
- package/src/util/isDefined.ts +3 -3
- package/src/util/isString.ts +3 -3
- package/src/widgets/Sandbox.ts +103 -103
- package/src/widgets/autoFocus.ts +9 -9
- package/src/widgets/cx.ts +63 -63
- package/src/widgets/drag-drop/ops.tsx +1 -1
- package/src/widgets/grid/GridCell.ts +143 -143
- package/src/widgets/icons/calendar.tsx +17 -17
- package/src/widgets/icons/check.tsx +13 -13
- package/src/widgets/icons/clear.tsx +15 -15
- package/src/widgets/icons/close.tsx +20 -20
- package/src/widgets/icons/cx.tsx +38 -38
- package/src/widgets/icons/drop-down.tsx +15 -15
- package/src/widgets/icons/file.tsx +13 -13
- package/src/widgets/icons/folder-open.tsx +15 -15
- package/src/widgets/icons/folder.tsx +13 -13
- package/src/widgets/icons/forward.tsx +22 -22
- package/src/widgets/icons/loading.tsx +24 -24
- package/src/widgets/icons/menu.tsx +17 -17
- package/src/widgets/icons/pixel-picker.tsx +18 -18
- package/src/widgets/icons/search.tsx +13 -13
- package/src/widgets/icons/sort-asc.tsx +14 -14
- package/src/widgets/icons/square.tsx +18 -18
- package/src/widgets/nav/Route.ts +142 -142
- package/src/widgets/overlay/ContextMenu.ts +42 -42
- package/src/widgets/overlay/Dropdown.tsx +762 -762
- package/src/widgets/overlay/MsgBox.tsx +141 -141
- package/src/widgets/overlay/Toast.ts +111 -111
- package/src/widgets/overlay/Window.tsx +299 -299
- package/src/widgets/overlay/alerts.ts +46 -46
- package/src/widgets/overlay/captureMouse.ts +195 -195
- package/src/widgets/overlay/createHotPromiseWindowFactory.ts +72 -72
- package/src/widgets/overlay/index.d.ts +11 -11
- package/src/widgets/overlay/index.ts +11 -11
- package/src/widgets/overlay/tooltip-ops.ts +173 -173
- package/build/ui/PureContainer.spec.d.ts +0 -1
- package/build/ui/PureContainer.spec.js +0 -149
- package/dist/manifest.d.ts +0 -1443
|
@@ -23,7 +23,7 @@ describe("ArrayElementView", function () {
|
|
|
23
23
|
let store = new Store({ data: { letters } });
|
|
24
24
|
let elementView = new ArrayElementView({ store, itemIndex: 1, arrayAccessor: getAccessor({ bind: "letters" }) });
|
|
25
25
|
elementView.delete("$record");
|
|
26
|
-
assert.deepEqual(store.get("letters"), [letters[0]]);
|
|
26
|
+
assert.deepEqual(store.get("letters"), [...letters[0]]);
|
|
27
27
|
});
|
|
28
28
|
it("exposes the element as under the given alias", function () {
|
|
29
29
|
let letters = [{ letter: "A" }, { letter: "B" }];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "cx/jsx-runtime";
|
|
2
2
|
import assert from "assert";
|
|
3
|
-
import { createTestRenderer } from "
|
|
3
|
+
import { createTestRenderer } from "src/util/test/createTestRenderer";
|
|
4
4
|
import { computable } from "../data";
|
|
5
5
|
import { Store } from "../data/Store";
|
|
6
6
|
import { createFunctionalComponent } from "../ui/createFunctionalComponent";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "cx/jsx-runtime";
|
|
2
2
|
import assert from "assert";
|
|
3
|
-
import { createTestRenderer } from "
|
|
3
|
+
import { createTestRenderer } from "src/util/test/createTestRenderer";
|
|
4
4
|
import { Store } from "../data/Store";
|
|
5
5
|
import { createFunctionalComponent } from "../ui/createFunctionalComponent";
|
|
6
6
|
import { useTrigger } from "./useTrigger";
|
|
@@ -39,9 +39,11 @@ describe("Controller", () => {
|
|
|
39
39
|
}
|
|
40
40
|
class Cmp extends Widget {
|
|
41
41
|
render(context, instance, key) {
|
|
42
|
-
instance.invoke("onTest");
|
|
43
42
|
return null;
|
|
44
43
|
}
|
|
44
|
+
onInit(context, instance) {
|
|
45
|
+
instance.invoke("onTest");
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
48
|
let store = new Store();
|
|
47
49
|
const component = createTestRenderer(store, _jsx("cx", { children: _jsx(Cmp, { controller: TestController, onTest: "callback" }) }));
|
|
@@ -63,9 +65,11 @@ describe("Controller", () => {
|
|
|
63
65
|
}
|
|
64
66
|
class Cmp extends Widget {
|
|
65
67
|
render(context, instance, key) {
|
|
66
|
-
instance.invoke("onTest");
|
|
67
68
|
return null;
|
|
68
69
|
}
|
|
70
|
+
onInit(context, instance) {
|
|
71
|
+
instance.invoke("onTest");
|
|
72
|
+
}
|
|
69
73
|
}
|
|
70
74
|
let store = new Store();
|
|
71
75
|
const component = createTestRenderer(store, _jsx("cx", { children: _jsx("div", { controller: TestController1, children: _jsx(Cmp, { controller: TestController2, onTest: "callback1" }) }) }));
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/** @jsxImportSource react */
|
|
2
|
-
import { Widget
|
|
2
|
+
import { Widget } from "../Widget";
|
|
3
3
|
import { Store } from "../../data/Store";
|
|
4
4
|
import { Instance } from "../Instance";
|
|
5
|
+
import { Create } from "../../util/Component";
|
|
5
6
|
export interface StartAppLoopOptions {
|
|
6
7
|
destroyDelay?: number;
|
|
7
8
|
removeParentDOMElement?: boolean;
|
|
8
9
|
[key: string]: any;
|
|
9
10
|
}
|
|
10
|
-
export declare function startAppLoop(parentDOMElement: HTMLElement, storeOrInstance?: Store | Instance, widget?: Widget |
|
|
11
|
+
export declare function startAppLoop(parentDOMElement: HTMLElement, storeOrInstance?: Store | Instance, widget?: Create<typeof Widget> | Create<typeof Widget>[], options?: StartAppLoopOptions): () => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StartAppLoopOptions } from "./startAppLoop";
|
|
2
|
-
import { Widget
|
|
2
|
+
import { Widget } from "../Widget";
|
|
3
3
|
import { Store } from "../../data/Store";
|
|
4
|
+
import { Create } from "../../util/Component";
|
|
4
5
|
export interface HotModule {
|
|
5
6
|
hot?: {
|
|
6
7
|
accept: () => void;
|
|
@@ -8,4 +9,4 @@ export interface HotModule {
|
|
|
8
9
|
data?: any;
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
|
-
export declare function startHotAppLoop(appModule: HotModule, element: HTMLElement, store: Store, widgets: Widget |
|
|
12
|
+
export declare function startHotAppLoop(appModule: HotModule, element: HTMLElement, store: Store, widgets: Create<typeof Widget> | Create<typeof Widget>[], options?: StartAppLoopOptions): () => void;
|
|
@@ -8,7 +8,7 @@ import { bind } from "../bind";
|
|
|
8
8
|
describe("ContentPlaceholder", () => {
|
|
9
9
|
it("allows putting content inside", () => {
|
|
10
10
|
let store = new Store();
|
|
11
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsxs("div", { children: [_jsx("header", { children: _jsx(ContentPlaceholder, { name: "header" }) }), _jsx("main", { children: _jsx("h2", { putInto: "header", children: "Header" }) })] }) }));
|
|
11
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsxs("div", { children: [_jsx("header", { children: _jsx(ContentPlaceholder, { name: "header" }) }), _jsx("main", { children: _jsx("h2", { putInto: "header", children: "Header" }) })] }) })));
|
|
12
12
|
let tree = component.toJSON();
|
|
13
13
|
assert.deepEqual(tree, {
|
|
14
14
|
type: "div",
|
|
@@ -39,7 +39,7 @@ describe("ContentPlaceholder", () => {
|
|
|
39
39
|
headerText: "Header",
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsxs("div", { children: [_jsx(ContentPlaceholder, { name: "header" }), _jsx("h2", { putInto: "header", text: bind("headerText") })] }) }));
|
|
42
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsxs("div", { children: [_jsx(ContentPlaceholder, { name: "header" }), _jsx("h2", { putInto: "header", text: bind("headerText") })] }) })));
|
|
43
43
|
let getTree = (headerText) => ({
|
|
44
44
|
type: "div",
|
|
45
45
|
props: {},
|
|
@@ -57,7 +57,7 @@ describe("ContentPlaceholder", () => {
|
|
|
57
57
|
});
|
|
58
58
|
it("allows putting multiple entries inside", () => {
|
|
59
59
|
let store = new Store();
|
|
60
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsxs("div", { children: [_jsx("header", { children: _jsx(ContentPlaceholder, { name: "headers", allowMultiple: true }) }), _jsxs("main", { children: [_jsx("h2", { putInto: "headers", children: "Header1" }), _jsx("h2", { putInto: "headers", children: "Header2" })] })] }) }));
|
|
60
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsxs("div", { children: [_jsx("header", { children: _jsx(ContentPlaceholder, { name: "headers", allowMultiple: true }) }), _jsxs("main", { children: [_jsx("h2", { putInto: "headers", children: "Header1" }), _jsx("h2", { putInto: "headers", children: "Header2" })] })] }) })));
|
|
61
61
|
let tree = component.toJSON();
|
|
62
62
|
assert.deepEqual(tree, {
|
|
63
63
|
type: "div",
|
|
@@ -89,7 +89,7 @@ describe("ContentPlaceholder", () => {
|
|
|
89
89
|
});
|
|
90
90
|
it("allows putting multiple entries inside when content is defined before and after the placeholder", () => {
|
|
91
91
|
let store = new Store();
|
|
92
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsxs("div", { children: [_jsxs(PureContainer, { children: [_jsx("h2", { putInto: "headers", children: "Header1" }), _jsx("h2", { putInto: "headers", children: "Header2" })] }), _jsx("header", { children: _jsx(ContentPlaceholder, { name: "headers", allowMultiple: true }) }), _jsxs(PureContainer, { children: [_jsx("h2", { putInto: "headers", children: "Header3" }), _jsx("h2", { putInto: "headers", children: "Header4" })] })] }) }));
|
|
92
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsxs("div", { children: [_jsxs(PureContainer, { children: [_jsx("h2", { putInto: "headers", children: "Header1" }), _jsx("h2", { putInto: "headers", children: "Header2" })] }), _jsx("header", { children: _jsx(ContentPlaceholder, { name: "headers", allowMultiple: true }) }), _jsxs(PureContainer, { children: [_jsx("h2", { putInto: "headers", children: "Header3" }), _jsx("h2", { putInto: "headers", children: "Header4" })] })] }) })));
|
|
93
93
|
let tree = component.toJSON();
|
|
94
94
|
assert.deepEqual(tree, {
|
|
95
95
|
type: "div",
|
|
@@ -126,7 +126,7 @@ describe("ContentPlaceholder", () => {
|
|
|
126
126
|
});
|
|
127
127
|
it("allows putting multiple entries into separate placeholders using content placeholder scopes", () => {
|
|
128
128
|
let store = new Store();
|
|
129
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsxs("div", { children: [_jsxs(ContentPlaceholderScope, { name: "headers", children: [_jsx("h2", { putInto: "headers", children: "Header1" }), _jsx("h2", { putInto: "headers", children: "Header2" }), _jsx("header", { children: _jsx(ContentPlaceholder, { name: "headers", allowMultiple: true }) })] }), _jsxs(ContentPlaceholderScope, { name: "headers", children: [_jsx("header", { children: _jsx(ContentPlaceholder, { name: "headers", allowMultiple: true }) }), _jsx("h2", { putInto: "headers", children: "Header3" }), _jsx("h2", { putInto: "headers", children: "Header4" })] })] }) }));
|
|
129
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsxs("div", { children: [_jsxs(ContentPlaceholderScope, { name: "headers", children: [_jsx("h2", { putInto: "headers", children: "Header1" }), _jsx("h2", { putInto: "headers", children: "Header2" }), _jsx("header", { children: _jsx(ContentPlaceholder, { name: "headers", allowMultiple: true }) })] }), _jsxs(ContentPlaceholderScope, { name: "headers", children: [_jsx("header", { children: _jsx(ContentPlaceholder, { name: "headers", allowMultiple: true }) }), _jsx("h2", { putInto: "headers", children: "Header3" }), _jsx("h2", { putInto: "headers", children: "Header4" })] })] }) })));
|
|
130
130
|
let tree = component.toJSON();
|
|
131
131
|
assert.deepEqual(tree, {
|
|
132
132
|
type: "div",
|
|
@@ -170,7 +170,7 @@ describe("ContentPlaceholder", () => {
|
|
|
170
170
|
it("is used for defining body position in outer layouts", () => {
|
|
171
171
|
let store = new Store();
|
|
172
172
|
let layout = (_jsx("cx", { children: _jsxs("div", { children: [_jsx("header", { children: "Header" }), _jsx(ContentPlaceholder, {}), _jsx("footer", { children: "Footer" })] }) }));
|
|
173
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsx("main", { outerLayout: layout }) }));
|
|
173
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsx("main", { outerLayout: layout }) })));
|
|
174
174
|
assert.deepEqual(component.toJSON(), {
|
|
175
175
|
type: "div",
|
|
176
176
|
props: {},
|
|
@@ -202,7 +202,7 @@ describe("ContentPlaceholder", () => {
|
|
|
202
202
|
},
|
|
203
203
|
});
|
|
204
204
|
let layout = (_jsx("cx", { children: _jsxs("div", { children: [_jsx("header", { children: _jsx(ContentPlaceholder, { name: "header" }) }), _jsx(ContentPlaceholder, {}), _jsx("footer", { children: _jsx(ContentPlaceholder, { name: "footer" }) })] }) }));
|
|
205
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsxs("main", { outerLayout: layout, children: [_jsx("div", { putInto: "header", children: _jsx("span", { text: bind("header") }) }), _jsx("div", { putInto: "footer", children: _jsx("span", { text: bind("footer") }) }), _jsx("span", { text: bind("body") })] }) }));
|
|
205
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsxs("main", { outerLayout: layout, children: [_jsx("div", { putInto: "header", children: _jsx("span", { text: bind("header") }) }), _jsx("div", { putInto: "footer", children: _jsx("span", { text: bind("footer") }) }), _jsx("span", { text: bind("body") })] }) })));
|
|
206
206
|
let getTree = (h, b, f) => ({
|
|
207
207
|
type: "div",
|
|
208
208
|
props: {},
|
|
@@ -236,7 +236,7 @@ describe("ContentPlaceholder", () => {
|
|
|
236
236
|
let store = new Store();
|
|
237
237
|
let outerLayout = (_jsx("cx", { children: _jsx("div", { children: _jsx(ContentPlaceholder, {}) }) }));
|
|
238
238
|
let innerLayout = (_jsx("cx", { children: _jsx("main", { outerLayout: outerLayout, children: _jsx(ContentPlaceholder, {}) }) }));
|
|
239
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsx("section", { outerLayout: innerLayout }) }));
|
|
239
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsx("section", { outerLayout: innerLayout }) })));
|
|
240
240
|
let tree = component.toJSON();
|
|
241
241
|
//console.log(tree);
|
|
242
242
|
assert.deepEqual(tree, {
|
|
@@ -259,7 +259,7 @@ describe("ContentPlaceholder", () => {
|
|
|
259
259
|
});
|
|
260
260
|
it("works in strange order", () => {
|
|
261
261
|
let store = new Store();
|
|
262
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsxs("div", { children: [_jsx(ContentPlaceholder, { name: "footer" }), _jsx(PureContainer, { putInto: "footer-content", children: "works" }), _jsxs(PureContainer, { putInto: "footer", children: ["It", _jsx(ContentPlaceholder, { name: "footer-content", children: "doesn't work" })] })] }) }));
|
|
262
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsxs("div", { children: [_jsx(ContentPlaceholder, { name: "footer" }), _jsx(PureContainer, { putInto: "footer-content", children: "works" }), _jsxs(PureContainer, { putInto: "footer", children: ["It", _jsx(ContentPlaceholder, { name: "footer-content", children: "doesn't work" })] })] }) })));
|
|
263
263
|
let tree = component.toJSON();
|
|
264
264
|
//console.log(tree);
|
|
265
265
|
assert.deepEqual(tree, {
|
|
@@ -272,7 +272,7 @@ describe("ContentPlaceholder", () => {
|
|
|
272
272
|
let store = new Store();
|
|
273
273
|
let outerLayout = (_jsx("cx", { children: _jsx("div", { children: _jsx(ContentPlaceholder, {}) }) }));
|
|
274
274
|
let innerLayout = (_jsx("cx", { children: _jsx(PureContainer, { children: _jsx("main", { outerLayout: outerLayout, children: _jsx(ContentPlaceholder, {}) }) }) }));
|
|
275
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsx("section", { outerLayout: innerLayout }) }));
|
|
275
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsx("section", { outerLayout: innerLayout }) })));
|
|
276
276
|
assert.deepEqual(component.toJSON(), {
|
|
277
277
|
type: "div",
|
|
278
278
|
props: {},
|
|
@@ -283,7 +283,7 @@ describe("ContentPlaceholder", () => {
|
|
|
283
283
|
let store = new Store();
|
|
284
284
|
let outerLayout1 = (_jsx("cx", { children: _jsx("div", { children: _jsx(ContentPlaceholder, {}) }) }));
|
|
285
285
|
let outerLayout2 = (_jsx("cx", { children: _jsx("main", { children: _jsx(ContentPlaceholder, {}) }) }));
|
|
286
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsx(PureContainer, { outerLayout: outerLayout1, children: _jsx(PureContainer, { outerLayout: outerLayout2, children: "Content" }) }) }));
|
|
286
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsx(PureContainer, { outerLayout: outerLayout1, children: _jsx(PureContainer, { outerLayout: outerLayout2, children: "Content" }) }) })));
|
|
287
287
|
assert.deepEqual(component.toJSON(), {
|
|
288
288
|
type: "div",
|
|
289
289
|
props: {},
|
|
@@ -300,7 +300,7 @@ describe("ContentPlaceholder", () => {
|
|
|
300
300
|
});
|
|
301
301
|
let outerLayout = (_jsx("cx", { children: _jsxs("div", { children: [_jsx(ContentPlaceholder, {}), _jsx("footer", { children: _jsx(ContentPlaceholder, { name: "footer" }) })] }) }));
|
|
302
302
|
let innerLayout = (_jsx("cx", { children: _jsx(PureContainer, { children: _jsxs(PureContainer, { outerLayout: outerLayout, children: [_jsx("header", { children: _jsx(ContentPlaceholder, { name: "header" }) }), _jsx(ContentPlaceholder, {})] }) }) }));
|
|
303
|
-
const component = createTestRenderer(store, _jsx("cx", { children: _jsxs("main", { outerLayout: innerLayout, children: [_jsx("div", { putInto: "header", children: _jsx("span", { text: bind("header") }) }), _jsx("div", { putInto: "footer", children: _jsx("span", { text: bind("footer") }) }), _jsx("span", { text: bind("body") })] }) }));
|
|
303
|
+
const component = createTestRenderer(store, (_jsx("cx", { children: _jsxs("main", { outerLayout: innerLayout, children: [_jsx("div", { putInto: "header", children: _jsx("span", { text: bind("header") }) }), _jsx("div", { putInto: "footer", children: _jsx("span", { text: bind("footer") }) }), _jsx("span", { text: bind("body") })] }) })));
|
|
304
304
|
let getTree = (h, b, f) => ({
|
|
305
305
|
type: "div",
|
|
306
306
|
props: {},
|
package/build.js
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
const buildJS = require("cx-build-tools/buildJS"),
|
|
2
|
-
buildSCSS = require("cx-build-tools/buildSCSS"),
|
|
3
|
-
getPathResolver = require("cx-build-tools/getPathResolver"),
|
|
4
|
-
fs = require("fs"),
|
|
5
|
-
resolvePath = getPathResolver(__dirname),
|
|
6
|
-
cxSrc = getPathResolver(resolvePath("./src")),
|
|
7
|
-
cxBuild = getPathResolver(resolvePath("./build"));
|
|
8
|
-
|
|
9
|
-
const entries = [
|
|
10
|
-
{
|
|
11
|
-
name: "util",
|
|
12
|
-
options: {
|
|
13
|
-
input: cxBuild("util/index.js"),
|
|
14
|
-
},
|
|
15
|
-
output: {},
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "data",
|
|
19
|
-
|
|
20
|
-
options: {
|
|
21
|
-
input: cxBuild("data/index.js"),
|
|
22
|
-
},
|
|
23
|
-
output: {},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "ui",
|
|
27
|
-
options: {
|
|
28
|
-
input: cxBuild("ui/index.js"),
|
|
29
|
-
},
|
|
30
|
-
output: {},
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "widgets",
|
|
34
|
-
options: {
|
|
35
|
-
input: cxBuild("widgets/index.js"),
|
|
36
|
-
},
|
|
37
|
-
output: {},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "svg",
|
|
41
|
-
options: {
|
|
42
|
-
input: cxBuild("svg/index.js"),
|
|
43
|
-
},
|
|
44
|
-
output: {},
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "charts",
|
|
48
|
-
options: {
|
|
49
|
-
input: cxBuild("charts/index.js"),
|
|
50
|
-
},
|
|
51
|
-
output: {},
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "hooks",
|
|
55
|
-
options: {
|
|
56
|
-
input: cxBuild("hooks/index.js"),
|
|
57
|
-
},
|
|
58
|
-
output: {},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "jsx-runtime",
|
|
62
|
-
options: {
|
|
63
|
-
input: cxBuild("jsx-runtime.js"),
|
|
64
|
-
},
|
|
65
|
-
output: {},
|
|
66
|
-
},
|
|
67
|
-
];
|
|
68
|
-
|
|
69
|
-
const externalPaths = {
|
|
70
|
-
[cxBuild("./util/")]: "cx/util",
|
|
71
|
-
[cxBuild("./data/")]: "cx/data",
|
|
72
|
-
[cxBuild("./ui/")]: "cx/ui",
|
|
73
|
-
[cxBuild("./widgets")]: "cx/widgets",
|
|
74
|
-
[cxBuild("./charts")]: "cx/charts",
|
|
75
|
-
[cxBuild("./svg/")]: "cx/svg",
|
|
76
|
-
[cxBuild("./hooks/")]: "cx/hooks",
|
|
77
|
-
[cxBuild("./jsx-runtime")]: "cx/jsx-runtime",
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
(async function buildAll() {
|
|
81
|
-
console.log("Building cx...");
|
|
82
|
-
try {
|
|
83
|
-
let distPath = resolvePath("./dist");
|
|
84
|
-
if (!fs.existsSync(distPath)) {
|
|
85
|
-
fs.mkdirSync(distPath);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
await Promise.all([
|
|
89
|
-
buildJS(resolvePath("./src"), resolvePath("./dist"), entries, externalPaths),
|
|
90
|
-
buildSCSS([resolvePath("../cx-build-tools/reset.scss")], resolvePath("./dist/reset.css")),
|
|
91
|
-
buildSCSS(
|
|
92
|
-
[
|
|
93
|
-
cxSrc("variables.scss"),
|
|
94
|
-
resolvePath("../cx-build-tools/divide.scss"),
|
|
95
|
-
cxSrc("widgets/index.scss"),
|
|
96
|
-
cxSrc("ui/index.scss"),
|
|
97
|
-
],
|
|
98
|
-
resolvePath("./dist/widgets.css"),
|
|
99
|
-
),
|
|
100
|
-
buildSCSS(
|
|
101
|
-
[cxSrc("variables.scss"), resolvePath("../cx-build-tools/divide.scss"), cxSrc("charts/index.scss")],
|
|
102
|
-
resolvePath("./dist/charts.css"),
|
|
103
|
-
),
|
|
104
|
-
buildSCSS(
|
|
105
|
-
[cxSrc("variables.scss"), resolvePath("../cx-build-tools/divide.scss"), cxSrc("svg/index.scss")],
|
|
106
|
-
resolvePath("./dist/svg.css"),
|
|
107
|
-
),
|
|
108
|
-
]);
|
|
109
|
-
} catch (err) {
|
|
110
|
-
console.log("Build error.", err);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// console.log("Building cx-redux...");
|
|
114
|
-
// await build(
|
|
115
|
-
// resolvePath("../../cx-redux/src"),
|
|
116
|
-
// resolvePath("../../cx-redux/dist"),
|
|
117
|
-
// [
|
|
118
|
-
// {
|
|
119
|
-
// name: "index",
|
|
120
|
-
// options: {
|
|
121
|
-
// input: [resolvePath("../../cx-redux/src/index.js")]
|
|
122
|
-
// },
|
|
123
|
-
// output: {}
|
|
124
|
-
// }
|
|
125
|
-
// ],
|
|
126
|
-
// null,
|
|
127
|
-
// ["redux", "cx/data"]
|
|
128
|
-
// );
|
|
129
|
-
})();
|
|
1
|
+
const buildJS = require("cx-build-tools/buildJS"),
|
|
2
|
+
buildSCSS = require("cx-build-tools/buildSCSS"),
|
|
3
|
+
getPathResolver = require("cx-build-tools/getPathResolver"),
|
|
4
|
+
fs = require("fs"),
|
|
5
|
+
resolvePath = getPathResolver(__dirname),
|
|
6
|
+
cxSrc = getPathResolver(resolvePath("./src")),
|
|
7
|
+
cxBuild = getPathResolver(resolvePath("./build"));
|
|
8
|
+
|
|
9
|
+
const entries = [
|
|
10
|
+
{
|
|
11
|
+
name: "util",
|
|
12
|
+
options: {
|
|
13
|
+
input: cxBuild("util/index.js"),
|
|
14
|
+
},
|
|
15
|
+
output: {},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "data",
|
|
19
|
+
|
|
20
|
+
options: {
|
|
21
|
+
input: cxBuild("data/index.js"),
|
|
22
|
+
},
|
|
23
|
+
output: {},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "ui",
|
|
27
|
+
options: {
|
|
28
|
+
input: cxBuild("ui/index.js"),
|
|
29
|
+
},
|
|
30
|
+
output: {},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "widgets",
|
|
34
|
+
options: {
|
|
35
|
+
input: cxBuild("widgets/index.js"),
|
|
36
|
+
},
|
|
37
|
+
output: {},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "svg",
|
|
41
|
+
options: {
|
|
42
|
+
input: cxBuild("svg/index.js"),
|
|
43
|
+
},
|
|
44
|
+
output: {},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "charts",
|
|
48
|
+
options: {
|
|
49
|
+
input: cxBuild("charts/index.js"),
|
|
50
|
+
},
|
|
51
|
+
output: {},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "hooks",
|
|
55
|
+
options: {
|
|
56
|
+
input: cxBuild("hooks/index.js"),
|
|
57
|
+
},
|
|
58
|
+
output: {},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "jsx-runtime",
|
|
62
|
+
options: {
|
|
63
|
+
input: cxBuild("jsx-runtime.js"),
|
|
64
|
+
},
|
|
65
|
+
output: {},
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const externalPaths = {
|
|
70
|
+
[cxBuild("./util/")]: "cx/util",
|
|
71
|
+
[cxBuild("./data/")]: "cx/data",
|
|
72
|
+
[cxBuild("./ui/")]: "cx/ui",
|
|
73
|
+
[cxBuild("./widgets")]: "cx/widgets",
|
|
74
|
+
[cxBuild("./charts")]: "cx/charts",
|
|
75
|
+
[cxBuild("./svg/")]: "cx/svg",
|
|
76
|
+
[cxBuild("./hooks/")]: "cx/hooks",
|
|
77
|
+
[cxBuild("./jsx-runtime")]: "cx/jsx-runtime",
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
(async function buildAll() {
|
|
81
|
+
console.log("Building cx...");
|
|
82
|
+
try {
|
|
83
|
+
let distPath = resolvePath("./dist");
|
|
84
|
+
if (!fs.existsSync(distPath)) {
|
|
85
|
+
fs.mkdirSync(distPath);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
await Promise.all([
|
|
89
|
+
buildJS(resolvePath("./src"), resolvePath("./dist"), entries, externalPaths),
|
|
90
|
+
buildSCSS([resolvePath("../cx-build-tools/reset.scss")], resolvePath("./dist/reset.css")),
|
|
91
|
+
buildSCSS(
|
|
92
|
+
[
|
|
93
|
+
cxSrc("variables.scss"),
|
|
94
|
+
resolvePath("../cx-build-tools/divide.scss"),
|
|
95
|
+
cxSrc("widgets/index.scss"),
|
|
96
|
+
cxSrc("ui/index.scss"),
|
|
97
|
+
],
|
|
98
|
+
resolvePath("./dist/widgets.css"),
|
|
99
|
+
),
|
|
100
|
+
buildSCSS(
|
|
101
|
+
[cxSrc("variables.scss"), resolvePath("../cx-build-tools/divide.scss"), cxSrc("charts/index.scss")],
|
|
102
|
+
resolvePath("./dist/charts.css"),
|
|
103
|
+
),
|
|
104
|
+
buildSCSS(
|
|
105
|
+
[cxSrc("variables.scss"), resolvePath("../cx-build-tools/divide.scss"), cxSrc("svg/index.scss")],
|
|
106
|
+
resolvePath("./dist/svg.css"),
|
|
107
|
+
),
|
|
108
|
+
]);
|
|
109
|
+
} catch (err) {
|
|
110
|
+
console.log("Build error.", err);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// console.log("Building cx-redux...");
|
|
114
|
+
// await build(
|
|
115
|
+
// resolvePath("../../cx-redux/src"),
|
|
116
|
+
// resolvePath("../../cx-redux/dist"),
|
|
117
|
+
// [
|
|
118
|
+
// {
|
|
119
|
+
// name: "index",
|
|
120
|
+
// options: {
|
|
121
|
+
// input: [resolvePath("../../cx-redux/src/index.js")]
|
|
122
|
+
// },
|
|
123
|
+
// output: {}
|
|
124
|
+
// }
|
|
125
|
+
// ],
|
|
126
|
+
// null,
|
|
127
|
+
// ["redux", "cx/data"]
|
|
128
|
+
// );
|
|
129
|
+
})();
|