@gamelearn/arcade-components 2.7.0 → 2.8.0
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/dist/components/decision-component/components/DecisionBody.js +4 -2
- package/dist/components/decision-component/components/DecisionComponent.js +1 -0
- package/dist/components/decision-component/components/Options.js +41 -7
- package/dist/components/dialog-component/components/DialogComponent.js +2 -1
- package/package.json +2 -2
|
@@ -47,7 +47,8 @@ var DecisionBody = function DecisionBody(_ref) {
|
|
|
47
47
|
translate = _ref.translate,
|
|
48
48
|
hasRewards = _ref.hasRewards,
|
|
49
49
|
inScene = _ref.inScene,
|
|
50
|
-
required = _ref.required
|
|
50
|
+
required = _ref.required,
|
|
51
|
+
simplifiedOptions = _ref.simplifiedOptions;
|
|
51
52
|
|
|
52
53
|
var _useState = (0, _react.useState)(currentSelectedChoice),
|
|
53
54
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -70,7 +71,8 @@ var DecisionBody = function DecisionBody(_ref) {
|
|
|
70
71
|
selectedChoice: selectedChoice,
|
|
71
72
|
selectChoice: (!required || branched) && selectedChoice.id !== undefined || required && !failed ? noop : choose,
|
|
72
73
|
options: options,
|
|
73
|
-
showingResults: showingResults
|
|
74
|
+
showingResults: showingResults,
|
|
75
|
+
simplifiedOptions: simplifiedOptions
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
var BasicDecision = function BasicDecision(_ref2) {
|
|
@@ -114,6 +114,7 @@ var DecisionComponent = function DecisionComponent(_ref) {
|
|
|
114
114
|
failed: failed,
|
|
115
115
|
inScene: inScene,
|
|
116
116
|
required: required,
|
|
117
|
+
simplifiedOptions: simplifiedOptions,
|
|
117
118
|
changeOption: function changeOption(option) {
|
|
118
119
|
playSound('click-ui');
|
|
119
120
|
setResultChoice(option);
|
|
@@ -1,26 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.default = void 0;
|
|
7
9
|
|
|
8
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
|
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
9
23
|
|
|
10
|
-
function
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
27
|
|
|
12
28
|
var Options = function Options(_ref) {
|
|
13
29
|
var inherited = _ref.inherited,
|
|
14
30
|
options = _ref.options,
|
|
15
31
|
selectedChoice = _ref.selectedChoice,
|
|
16
32
|
selectChoice = _ref.selectChoice,
|
|
17
|
-
showingResults = _ref.showingResults
|
|
18
|
-
|
|
33
|
+
showingResults = _ref.showingResults,
|
|
34
|
+
simplifiedOptions = _ref.simplifiedOptions;
|
|
35
|
+
|
|
36
|
+
var _useState = (0, _react.useState)(null),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
neutralDecisionVisualEffect = _useState2[0],
|
|
39
|
+
setNeutralDecisionVisualEffect = _useState2[1];
|
|
40
|
+
|
|
41
|
+
var selectChoiceFirstTime = function selectChoiceFirstTime(option) {
|
|
42
|
+
if (!simplifiedOptions) {
|
|
43
|
+
selectChoice(option);
|
|
44
|
+
} else {
|
|
45
|
+
setNeutralDecisionVisualEffect(option.id);
|
|
46
|
+
setTimeout(function () {
|
|
47
|
+
selectChoice(option);
|
|
48
|
+
}, 1000);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, options && options.filter(function (option) {
|
|
19
53
|
return option.text;
|
|
20
54
|
}).map(function (option) {
|
|
21
55
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
56
|
key: option.id,
|
|
23
|
-
className: inherited ? 'conversation--question' : 'radio'
|
|
57
|
+
className: "".concat(inherited ? 'conversation--question' : 'radio', "\n ").concat(neutralDecisionVisualEffect === option.id ? 'radio-text-clicked' : '')
|
|
24
58
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
25
59
|
type: "radio",
|
|
26
60
|
name: option.id,
|
|
@@ -34,10 +68,10 @@ var Options = function Options(_ref) {
|
|
|
34
68
|
}, option.text) : /*#__PURE__*/_react.default.createElement("label", {
|
|
35
69
|
htmlFor: option.id,
|
|
36
70
|
onClick: function onClick() {
|
|
37
|
-
|
|
71
|
+
selectChoiceFirstTime(option);
|
|
38
72
|
}
|
|
39
73
|
}, option.text));
|
|
40
|
-
});
|
|
74
|
+
}));
|
|
41
75
|
};
|
|
42
76
|
|
|
43
77
|
var _default = Options;
|
|
@@ -783,7 +783,8 @@ var DialogComponent = function DialogComponent(_ref) {
|
|
|
783
783
|
}) : null, /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.HtmlPro, {
|
|
784
784
|
style: {
|
|
785
785
|
width: '100vw',
|
|
786
|
-
height: '100vh'
|
|
786
|
+
height: '100vh',
|
|
787
|
+
position: 'static'
|
|
787
788
|
},
|
|
788
789
|
portal: container ? {
|
|
789
790
|
current: container
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gamelearn/arcade-components",
|
|
3
3
|
"author": "Gamelearn",
|
|
4
4
|
"license": "unlicense",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.8.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.18.6",
|
|
17
|
-
"@gamelearn/arcade-styles": "2.
|
|
17
|
+
"@gamelearn/arcade-styles": "2.8.1",
|
|
18
18
|
"@gamelearn/arcade-three-core": "1.17.2",
|
|
19
19
|
"@react-three/drei": "9.4.3",
|
|
20
20
|
"@react-three/fiber": "8.0.17",
|