mathbox-react 0.2.3-rc1 → 0.2.3-rc2
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/esm/components/ContainedMathbox.js +33 -27
- package/build/esm/components/ContainedMathbox.js.map +1 -1
- package/build/esm/components/Mathbox.js +49 -40
- package/build/esm/components/Mathbox.js.map +1 -1
- package/build/esm/components/MathboxAPIContext.js +9 -6
- package/build/esm/components/MathboxAPIContext.js.map +1 -1
- package/build/esm/components/components.js +116 -97
- package/build/esm/components/components.js.map +1 -1
- package/build/esm/components/components.spec.js +167 -212
- package/build/esm/components/components.spec.js.map +1 -1
- package/build/esm/components/index.js +27 -4
- package/build/esm/components/index.js.map +1 -1
- package/build/esm/components/types.js +2 -1
- package/build/esm/components/util.js +26 -18
- package/build/esm/components/util.js.map +1 -1
- package/build/esm/index.js +32 -3
- package/build/esm/index.js.map +1 -1
- package/build/esm/testSetup.js +4 -2
- package/build/esm/testSetup.js.map +1 -1
- package/build/esm/testUtils.js +14 -10
- package/build/esm/testUtils.js.map +1 -1
- package/build/esm/threestrap/Controls.js +24 -23
- package/build/esm/threestrap/Controls.js.map +1 -1
- package/build/esm/threestrap/Renderer.js +8 -6
- package/build/esm/threestrap/Renderer.js.map +1 -1
- package/build/esm/threestrap/ThreestrapContext.js +9 -6
- package/build/esm/threestrap/ThreestrapContext.js.map +1 -1
- package/build/esm/threestrap/index.js +12 -3
- package/build/esm/threestrap/index.js.map +1 -1
- package/build/esm/threestrap/threestrap.js +2 -1
- package/package.json +7 -7
|
@@ -1,20 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useDeepCompareMemo = exports.capitalize = exports.canNodeHaveChildren = exports.isSelectionParent = exports.isRootDestroyed = void 0;
|
|
1
7
|
/* eslint-disable no-underscore-dangle */
|
|
2
|
-
|
|
3
|
-
|
|
8
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
9
|
+
const react_1 = require("react");
|
|
4
10
|
/**
|
|
5
11
|
* Get root node given any node in Mathbox tree
|
|
6
12
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
const getRoot = (selection) => {
|
|
14
|
+
let current = selection;
|
|
9
15
|
while (current._up) {
|
|
10
16
|
current = current._up;
|
|
11
17
|
}
|
|
12
18
|
return current;
|
|
13
19
|
};
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
const isRootDestroyed = (selection) => {
|
|
21
|
+
const root = getRoot(selection);
|
|
16
22
|
return root.three === undefined;
|
|
17
23
|
};
|
|
24
|
+
exports.isRootDestroyed = isRootDestroyed;
|
|
18
25
|
/**
|
|
19
26
|
* Check that parent is actually the selection's parent.
|
|
20
27
|
* The mathbox components occasionally render with a selection value whose
|
|
@@ -30,12 +37,12 @@ export var isRootDestroyed = function (selection) {
|
|
|
30
37
|
* in a render function. Hooks seem nice for dependencies, but mathbox is pretty
|
|
31
38
|
* smart about diffing out the actual changes.
|
|
32
39
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var selectionParentNode = (_a = selection._up) === null || _a === void 0 ? void 0 : _a[0];
|
|
40
|
+
const isSelectionParent = (selection, parent) => {
|
|
41
|
+
const selectionParentNode = selection._up?.[0];
|
|
36
42
|
return selectionParentNode === parent[0];
|
|
37
43
|
};
|
|
38
|
-
|
|
44
|
+
exports.isSelectionParent = isSelectionParent;
|
|
45
|
+
const CAN_HAVE_CHILDREN = [
|
|
39
46
|
"view",
|
|
40
47
|
"cartesian",
|
|
41
48
|
"cartesian4",
|
|
@@ -61,14 +68,14 @@ var CAN_HAVE_CHILDREN = [
|
|
|
61
68
|
"reveal",
|
|
62
69
|
"slide",
|
|
63
70
|
];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
export var capitalize = function (s) {
|
|
71
|
+
const canNodeHaveChildren = (type) => CAN_HAVE_CHILDREN.includes(type);
|
|
72
|
+
exports.canNodeHaveChildren = canNodeHaveChildren;
|
|
73
|
+
const capitalize = (s) => {
|
|
68
74
|
if (!s)
|
|
69
75
|
return "";
|
|
70
76
|
return s[0].toLocaleUpperCase() + s.slice(1);
|
|
71
77
|
};
|
|
78
|
+
exports.capitalize = capitalize;
|
|
72
79
|
/**
|
|
73
80
|
* Returns the same reference to `value` as long as the the given values are
|
|
74
81
|
* deep equal.
|
|
@@ -83,14 +90,15 @@ export var capitalize = function (s) {
|
|
|
83
90
|
*
|
|
84
91
|
* But should work OK for mathbox options.
|
|
85
92
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
93
|
+
const useDeepCompareMemo = (value, initial) => {
|
|
94
|
+
const oldValue = (0, react_1.useRef)(initial);
|
|
95
|
+
const memoOptions = (0, react_1.useMemo)(() => {
|
|
96
|
+
if ((0, isEqual_1.default)(value, oldValue.current))
|
|
90
97
|
return oldValue.current;
|
|
91
98
|
oldValue.current = value;
|
|
92
99
|
return value;
|
|
93
100
|
}, [value]);
|
|
94
101
|
return memoOptions;
|
|
95
102
|
};
|
|
103
|
+
exports.useDeepCompareMemo = useDeepCompareMemo;
|
|
96
104
|
//# sourceMappingURL=util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/components/util.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/components/util.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAyC;AACzC,6DAAoC;AACpC,iCAAuC;AAKvC;;GAEG;AACH,MAAM,OAAO,GAAG,CAAC,SAA2B,EAAE,EAAE;IAC9C,IAAI,OAAO,GAAG,SAA0B,CAAA;IACxC,OAAO,OAAO,CAAC,GAAG,EAAE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U,cAGtB;AAED;;;;;;;;;;;;;GAaG;AACI,MAAM,kBAAkB,GAAG,CAAI,KAAQ,EAAE,OAAU,EAAK,EAAE;IAC/D,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAI,OAAO,CAAC,CAAA;IACnC,MAAM,WAAW,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC/B,IAAI,IAAA,iBAAO,EAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,QAAQ,CAAC,OAAO,CAAA;QAC7D,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAA;QACxB,OAAO,KAAK,CAAA;IACd,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACX,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AARY,QAAA,kBAAkB,sBAQ9B"}
|
package/build/esm/index.js
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Threestrap = void 0;
|
|
30
|
+
const Threestrap = __importStar(require("./threestrap"));
|
|
31
|
+
exports.Threestrap = Threestrap;
|
|
32
|
+
__exportStar(require("./components"), exports);
|
|
4
33
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA0C;AAGjC,gCAAU;AADnB,+CAA4B"}
|
package/build/esm/testSetup.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const testUtils_1 = require("./testUtils");
|
|
4
|
+
HTMLCanvasElement.prototype.getContext = testUtils_1.getMockContext;
|
|
3
5
|
//# sourceMappingURL=testSetup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testSetup.js","sourceRoot":"","sources":["../../src/testSetup.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"testSetup.js","sourceRoot":"","sources":["../../src/testSetup.ts"],"names":[],"mappings":";;AAAA,2CAA4C;AAE5C,iBAAiB,CAAC,SAAS,CAAC,UAAU,GAAG,0BAAc,CAAA"}
|
package/build/esm/testUtils.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMockContext = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* A mock that uses proxies to create properties as they are accessed. Supports
|
|
3
6
|
* function calls and toPrimitive.
|
|
@@ -7,15 +10,15 @@
|
|
|
7
10
|
* accessed on automock.
|
|
8
11
|
* @returns
|
|
9
12
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
get
|
|
13
|
+
const getAutomock = (specifics) => {
|
|
14
|
+
const autmockSeed = jest.fn();
|
|
15
|
+
const handler = {
|
|
16
|
+
get(target, prop) {
|
|
14
17
|
if (prop === Symbol.toPrimitive) {
|
|
15
|
-
return
|
|
18
|
+
return () => `Automock: ${JSON.stringify(specifics)}`;
|
|
16
19
|
}
|
|
17
20
|
if (specifics && Reflect.has(specifics, prop)) {
|
|
18
|
-
|
|
21
|
+
const value = Reflect.get(specifics, prop);
|
|
19
22
|
return value;
|
|
20
23
|
}
|
|
21
24
|
if (!Reflect.has(target, prop)) {
|
|
@@ -23,15 +26,15 @@ var getAutomock = function (specifics) {
|
|
|
23
26
|
}
|
|
24
27
|
return Reflect.get(target, prop);
|
|
25
28
|
},
|
|
26
|
-
apply
|
|
29
|
+
apply() {
|
|
27
30
|
return getAutomock();
|
|
28
31
|
},
|
|
29
32
|
};
|
|
30
33
|
return new Proxy(autmockSeed, handler);
|
|
31
34
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
getParameter: jest.fn(
|
|
35
|
+
const getMockContext = () => {
|
|
36
|
+
const mockContext = getAutomock({
|
|
37
|
+
getParameter: jest.fn((name) => {
|
|
35
38
|
if (name === mockContext.VERSION)
|
|
36
39
|
return "Fake version!";
|
|
37
40
|
return getAutomock();
|
|
@@ -39,4 +42,5 @@ export var getMockContext = function () {
|
|
|
39
42
|
});
|
|
40
43
|
return mockContext;
|
|
41
44
|
};
|
|
45
|
+
exports.getMockContext = getMockContext;
|
|
42
46
|
//# sourceMappingURL=testUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../../src/testUtils.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../../src/testUtils.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAG,CAClB,SAAa,EACH,EAAE;IACZ,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC7B,MAAM,OAAO,GAAG;QACd,GAAG,CAAC,MAAgB,EAAE,IAAqB;YACzC,IAAI,IAAI,KAAK,MAAM,CAAC,WAAW,EAAE;gBAC/B,OAAO,GAAG,EAAE,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAA;aACtD;YACD,IAAI,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;gBAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;gBAC1C,OAAO,KAAK,CAAA;aACb;YACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE;gBAC9B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAA;aACzC;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;QACD,KAAK;YACH,OAAO,WAAW,EAAE,CAAA;QACtB,CAAC;KACF,CAAA;IACD,OAAO,IAAI,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;AACxC,CAAC,CAAA;AAEM,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG,WAAW,CAAC;QAC9B,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE;YAC7B,IAAI,IAAI,KAAK,WAAW,CAAC,OAAO;gBAAE,OAAO,eAAe,CAAA;YACxD,OAAO,WAAW,EAAE,CAAA;QACtB,CAAC,CAAC;KACH,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AARY,QAAA,cAAc,kBAQ1B"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
3
|
/* eslint-disable react/no-unused-prop-types */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
useEffect(function () {
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const ThreestrapContext_1 = require("./ThreestrapContext");
|
|
6
|
+
const ALLOWED_CONTROLS = ["orbit"];
|
|
7
|
+
const useOrbitControls = (threestrap, { type, enablePan, enableRotate, enableZoom, target, onStart, onEnd, }) => {
|
|
8
|
+
(0, react_1.useEffect)(() => {
|
|
8
9
|
if (type !== "orbit")
|
|
9
10
|
return;
|
|
10
11
|
if (!threestrap.controls)
|
|
11
12
|
return;
|
|
12
|
-
|
|
13
|
+
const controls = threestrap.controls;
|
|
13
14
|
if (enablePan !== undefined) {
|
|
14
15
|
controls.enablePan = enablePan;
|
|
15
16
|
}
|
|
@@ -20,54 +21,54 @@ var useOrbitControls = function (threestrap, _a) {
|
|
|
20
21
|
controls.enableRotate = enableRotate;
|
|
21
22
|
}
|
|
22
23
|
}, [type, enablePan, enableRotate, enableZoom, threestrap.controls]);
|
|
23
|
-
|
|
24
|
+
(0, react_1.useEffect)(() => {
|
|
24
25
|
if (type !== "orbit")
|
|
25
26
|
return;
|
|
26
27
|
if (!threestrap.controls)
|
|
27
28
|
return;
|
|
28
|
-
|
|
29
|
+
const controls = threestrap.controls;
|
|
29
30
|
if (target) {
|
|
30
31
|
controls.target = target;
|
|
31
32
|
}
|
|
32
33
|
}, [type, target, threestrap.controls]);
|
|
33
|
-
|
|
34
|
+
(0, react_1.useEffect)(() => {
|
|
34
35
|
if (type !== "orbit")
|
|
35
|
-
return
|
|
36
|
+
return () => { };
|
|
36
37
|
if (!threestrap.controls)
|
|
37
|
-
return
|
|
38
|
-
|
|
38
|
+
return () => { };
|
|
39
|
+
const controls = threestrap.controls;
|
|
39
40
|
if (onStart) {
|
|
40
41
|
controls.addEventListener("start", onStart);
|
|
41
42
|
}
|
|
42
|
-
return
|
|
43
|
+
return () => {
|
|
43
44
|
if (onStart) {
|
|
44
45
|
controls.removeEventListener("start", onStart);
|
|
45
46
|
}
|
|
46
47
|
};
|
|
47
48
|
}, [type, onStart, threestrap.controls]);
|
|
48
|
-
|
|
49
|
+
(0, react_1.useEffect)(() => {
|
|
49
50
|
if (type !== "orbit")
|
|
50
|
-
return
|
|
51
|
+
return () => { };
|
|
51
52
|
if (!threestrap.controls)
|
|
52
|
-
return
|
|
53
|
-
|
|
53
|
+
return () => { };
|
|
54
|
+
const controls = threestrap.controls;
|
|
54
55
|
if (onEnd) {
|
|
55
56
|
controls.addEventListener("end", onEnd);
|
|
56
57
|
}
|
|
57
|
-
return
|
|
58
|
+
return () => {
|
|
58
59
|
if (onEnd) {
|
|
59
60
|
controls.removeEventListener("end", onEnd);
|
|
60
61
|
}
|
|
61
62
|
};
|
|
62
63
|
}, [type, onEnd, threestrap.controls]);
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
+
const Controls = (props) => {
|
|
65
66
|
if (!ALLOWED_CONTROLS.includes(props.type)) {
|
|
66
|
-
throw new Error(
|
|
67
|
+
throw new Error(`Invalid control type ${props.type}`);
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
const threestrap = (0, ThreestrapContext_1.useThreestrap)();
|
|
69
70
|
useOrbitControls(threestrap, props);
|
|
70
71
|
return null;
|
|
71
72
|
};
|
|
72
|
-
|
|
73
|
+
exports.default = Controls;
|
|
73
74
|
//# sourceMappingURL=Controls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controls.js","sourceRoot":"","sources":["../../../src/threestrap/Controls.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"Controls.js","sourceRoot":"","sources":["../../../src/threestrap/Controls.ts"],"names":[],"mappings":";;AAAA,+CAA+C;AAC/C,iCAAwC;AAGxC,2DAAmD;AAcnD,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,CAAA;AAElC,MAAM,gBAAgB,GAAG,CACvB,UAAsB,EACtB,EACE,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,UAAU,EACV,MAAM,EACN,OAAO,EACP,KAAK,GACS,EAChB,EAAE;IACF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,IAAI,KAAK,OAAO;YAAE,OAAM;QAC5B,IAAI,CAAC,UAAU,CAAC,QAAQ;YAAE,OAAM;QAChC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAyB,CAAA;QACrD,IAAI,SAAS,KAAK,SAAS,EAAE;YAC3B,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAA;SAC/B;QACD,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAA;SACjC;QACD,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAA;SACrC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEpE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,IAAI,KAAK,OAAO;YAAE,OAAM;QAC5B,IAAI,CAAC,UAAU,CA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,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;AACxC,CAAC,CAAA;AAED,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;IAClD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QAC1C,MAAM,IAAI,KAAK,CAAC,wBAAwB,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;KACtD;IACD,MAAM,UAAU,GAAG,IAAA,iCAAa,GAAE,CAAA;IAClC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;IACnC,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,kBAAe,QAAQ,CAAA"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const ThreestrapContext_1 = require("./ThreestrapContext");
|
|
5
|
+
const Renderer = (props) => {
|
|
6
|
+
const threestrap = (0, ThreestrapContext_1.useThreestrap)();
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
6
8
|
if (props.clearColor) {
|
|
7
9
|
threestrap.renderer.setClearColor(props.clearColor);
|
|
8
10
|
}
|
|
9
11
|
});
|
|
10
12
|
return null;
|
|
11
13
|
};
|
|
12
|
-
|
|
14
|
+
exports.default = Renderer;
|
|
13
15
|
//# sourceMappingURL=Renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.js","sourceRoot":"","sources":["../../../src/threestrap/Renderer.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Renderer.js","sourceRoot":"","sources":["../../../src/threestrap/Renderer.ts"],"names":[],"mappings":";;AAAA,iCAAwC;AAExC,2DAAmD;AAMnD,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;IAClD,MAAM,UAAU,GAAG,IAAA,iCAAa,GAAE,CAAA;IAClC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,KAAK,CAAC,UAAU,EAAE;YACpB,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;SACpD;IACH,CAAC,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,kBAAe,QAAQ,CAAA"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useThreestrap = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const ThreestrapContext = (0, react_1.createContext)(null);
|
|
6
|
+
exports.default = ThreestrapContext;
|
|
7
|
+
const useThreestrap = () => {
|
|
8
|
+
const threestrap = (0, react_1.useContext)(ThreestrapContext);
|
|
6
9
|
if (!threestrap) {
|
|
7
10
|
throw new Error("Threestrap context is not available");
|
|
8
11
|
}
|
|
9
12
|
return threestrap;
|
|
10
13
|
};
|
|
11
|
-
|
|
14
|
+
exports.useThreestrap = useThreestrap;
|
|
12
15
|
//# sourceMappingURL=ThreestrapContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreestrapContext.js","sourceRoot":"","sources":["../../../src/threestrap/ThreestrapContext.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ThreestrapContext.js","sourceRoot":"","sources":["../../../src/threestrap/ThreestrapContext.ts"],"names":[],"mappings":";;;AAAA,iCAAiD;AAGjD,MAAM,iBAAiB,GAAG,IAAA,qBAAa,EAAoB,IAAI,CAAC,CAAA;AAEhE,kBAAe,iBAAiB,CAAA;AAEhC,MAAM,aAAa,GAAG,GAAG,EAAE;IACzB,MAAM,UAAU,GAAG,IAAA,kBAAU,EAAC,iBAAiB,CAAC,CAAA;IAChD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;KACvD;IACD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAEQ,sCAAa"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useThreestrap = exports.Controls = exports.Renderer = void 0;
|
|
7
|
+
var Renderer_1 = require("./Renderer");
|
|
8
|
+
Object.defineProperty(exports, "Renderer", { enumerable: true, get: function () { return __importDefault(Renderer_1).default; } });
|
|
9
|
+
var Controls_1 = require("./Controls");
|
|
10
|
+
Object.defineProperty(exports, "Controls", { enumerable: true, get: function () { return __importDefault(Controls_1).default; } });
|
|
11
|
+
var ThreestrapContext_1 = require("./ThreestrapContext");
|
|
12
|
+
Object.defineProperty(exports, "useThreestrap", { enumerable: true, get: function () { return ThreestrapContext_1.useThreestrap; } });
|
|
4
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/threestrap/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/threestrap/index.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAgD;AAAvC,qHAAA,OAAO,OAAY;AAC5B,uCAAgD;AAAvC,qHAAA,OAAO,OAAY;AAC5B,yDAAmD;AAA1C,kHAAA,aAAa,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mathbox-react",
|
|
3
|
-
"version": "0.2.3-
|
|
3
|
+
"version": "0.2.3-rc2",
|
|
4
4
|
"description": "React wrapper for Mathbox",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "rm -rf ./build && yarn build-esm && yarn build-cjs",
|
|
28
|
-
"build-esm": "tsc",
|
|
28
|
+
"build-esm": "tsc --project tsconfig.esm.json",
|
|
29
29
|
"build-cjs": "tsc --project tsconfig.cjs.json",
|
|
30
30
|
"build-watch": "tsc --watch",
|
|
31
31
|
"storybook": "start-storybook -p 6006",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@mathbox-react/eslint-config": "workspace:*",
|
|
40
40
|
"@mathbox-react/tsconfig": "workspace:*",
|
|
41
41
|
"@storybook/addon-actions": "7.0.18",
|
|
42
|
-
"@storybook/addon-essentials": "7.
|
|
42
|
+
"@storybook/addon-essentials": "^7.4.2",
|
|
43
43
|
"@storybook/addon-interactions": "7.0.18",
|
|
44
44
|
"@storybook/addon-links": "7.0.18",
|
|
45
|
-
"@storybook/builder-webpack5": "^7.
|
|
46
|
-
"@storybook/manager-webpack5": "^6.5.
|
|
47
|
-
"@storybook/react": "7.
|
|
45
|
+
"@storybook/builder-webpack5": "^7.4.2",
|
|
46
|
+
"@storybook/manager-webpack5": "^6.5.16",
|
|
47
|
+
"@storybook/react": "^7.4.2",
|
|
48
48
|
"@storybook/testing-library": "0.1.0",
|
|
49
49
|
"@testing-library/react": "14.0.0",
|
|
50
50
|
"@types/jest": "27.5.2",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"react-dom": "18.2.0",
|
|
61
61
|
"three": "0.152.2",
|
|
62
62
|
"ts-jest": "27.1.5",
|
|
63
|
-
"typescript": "^5.
|
|
63
|
+
"typescript": "^5.2.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"mathbox": "^2.3.1",
|