@gamelearn/arcade-components 2.27.0 → 2.29.2
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/animation-component/components/AnimationComponent.js +10 -28
- package/dist/components/animation-component/index.js +0 -3
- package/dist/components/animation-component/mocks/mockForStory.js +0 -3
- package/dist/components/auto-evaluation-component/components/AutoEvaluation.js +30 -71
- package/dist/components/auto-evaluation-component/components/EndScreen.js +1 -9
- package/dist/components/auto-evaluation-component/components/StartScreen.js +2 -6
- package/dist/components/auto-evaluation-component/index.js +0 -3
- package/dist/components/auto-evaluation-component/mocks/mockForStory.js +0 -2
- package/dist/components/cards-selector-puzzle-component/components/Board/index.js +23 -55
- package/dist/components/cards-selector-puzzle-component/components/Card/index.js +4 -23
- package/dist/components/cards-selector-puzzle-component/components/CardsSelectorPuzzleComponent.js +41 -92
- package/dist/components/cards-selector-puzzle-component/index.js +0 -3
- package/dist/components/cards-selector-puzzle-component/mocks/mockForStory.js +4 -10
- package/dist/components/cartel-component/components/CartelComponent.js +16 -42
- package/dist/components/cartel-component/index.js +0 -3
- package/dist/components/chained-image-click-puzzle-component/components/ChainedImageClickPuzzleComponent.js +20 -38
- package/dist/components/chained-image-click-puzzle-component/components/CurrentImagePuzzle.js +25 -64
- package/dist/components/chained-image-click-puzzle-component/index.js +0 -3
- package/dist/components/chained-image-click-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/comic-component/components/ComicComponent.js +37 -81
- package/dist/components/comic-component/components/Slide.js +2 -7
- package/dist/components/comic-component/components/Vignette.js +7 -23
- package/dist/components/comic-component/index.js +0 -3
- package/dist/components/comic-component/mocks/mockForStory.js +1 -2
- package/dist/components/conversational-component/components/ConversationalComponent.js +15 -39
- package/dist/components/conversational-component/index.js +0 -3
- package/dist/components/conversational-pro-component/components/ConversationalProComponent.js +54 -137
- package/dist/components/conversational-pro-component/components/Message.js +1 -9
- package/dist/components/conversational-pro-component/components/Slot.js +3 -20
- package/dist/components/conversational-pro-component/components/SlotList.js +16 -40
- package/dist/components/conversational-pro-component/components/scene/Panel.js +12 -54
- package/dist/components/conversational-pro-component/components/scene/Panels.js +10 -17
- package/dist/components/conversational-pro-component/components/scene/index.js +11 -30
- package/dist/components/conversational-pro-component/index.js +0 -3
- package/dist/components/conversational-pro-component/mocks/mockForStory.js +1 -2
- package/dist/components/cracker-puzzle-component/components/CrackerPuzzleComponent.js +35 -89
- package/dist/components/cracker-puzzle-component/components/DrawGrid/index.js +3 -7
- package/dist/components/cracker-puzzle-component/components/DrawItem/index.js +4 -9
- package/dist/components/cracker-puzzle-component/components/DrawRow/index.js +4 -9
- package/dist/components/cracker-puzzle-component/components/helpers.js +15 -55
- package/dist/components/cracker-puzzle-component/index.js +0 -3
- package/dist/components/cracker-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/decision-component/components/DecisionBody.js +26 -48
- package/dist/components/decision-component/components/DecisionComponent.js +22 -70
- package/dist/components/decision-component/components/Feedback.js +2 -11
- package/dist/components/decision-component/components/Options.js +12 -31
- package/dist/components/decision-component/index.js +0 -3
- package/dist/components/decision-component/mocks/mockForStory.js +0 -2
- package/dist/components/dialog-component/components/BubbleWrapper.js +1 -7
- package/dist/components/dialog-component/components/DialogComponent.js +118 -338
- package/dist/components/dialog-component/components/DialogDecision.js +3 -13
- package/dist/components/dialog-component/components/SpeechBubbleComponent.js +6 -24
- package/dist/components/dialog-component/index.js +0 -3
- package/dist/components/dialog-component/mocks/mockForStory.js +1 -5
- package/dist/components/drag-item-puzzle-component/components/DragItemPuzzleComponent.js +34 -90
- package/dist/components/drag-item-puzzle-component/components/Messages.js +0 -4
- package/dist/components/drag-item-puzzle-component/index.js +0 -3
- package/dist/components/drag-item-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/feedback-component/components/FeedbackComponent.js +34 -52
- package/dist/components/feedback-component/index.js +0 -3
- package/dist/components/feedback-component/mocks/mockForStory.js +1 -2
- package/dist/components/frame-click-puzzle-component/components/Counter/index.js +3 -8
- package/dist/components/frame-click-puzzle-component/components/CurrentFramePuzzle.js +36 -68
- package/dist/components/frame-click-puzzle-component/components/FrameClickPuzzleComponent.js +33 -68
- package/dist/components/frame-click-puzzle-component/components/Tooltip/index.js +0 -6
- package/dist/components/frame-click-puzzle-component/index.js +0 -3
- package/dist/components/frame-click-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/hacker-puzzle-component/components/HackerPuzzleComponent.js +29 -69
- package/dist/components/hacker-puzzle-component/index.js +0 -3
- package/dist/components/hacker-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/hanged-puzzle-component/components/HangedPuzzleComponent.js +48 -123
- package/dist/components/hanged-puzzle-component/index.js +0 -3
- package/dist/components/hanged-puzzle-component/mocks/mockForStory.js +0 -3
- package/dist/components/hanged-puzzle-component/utils.js +0 -20
- package/dist/components/image-click-puzzle-component/components/ImageClickPuzzleComponent.js +1 -8
- package/dist/components/image-click-puzzle-component/index.js +0 -3
- package/dist/components/image-click-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/image-click-wrapper-component/components/CountDown/index.js +0 -4
- package/dist/components/image-click-wrapper-component/components/ImageClickWrapperComponent.js +67 -134
- package/dist/components/image-click-wrapper-component/components/TimerDialog/index.js +2 -6
- package/dist/components/image-click-wrapper-component/index.js +0 -3
- package/dist/components/image-click-wrapper-component/mocks/mockForStory.js +0 -2
- package/dist/components/image-component/components/ImageComponent.js +14 -33
- package/dist/components/image-component/index.js +0 -3
- package/dist/components/image-component/mocks/mockForStory.js +0 -2
- package/dist/components/index.js +0 -39
- package/dist/components/inventory-item/components/InventoryItem.js +9 -35
- package/dist/components/inventory-item/index.js +0 -3
- package/dist/components/inventory-item/mocks/mockForStory.js +0 -3
- package/dist/components/keyboard-puzzle-component/components/KeyboardPuzzleComponent.js +33 -75
- package/dist/components/keyboard-puzzle-component/index.js +0 -3
- package/dist/components/keyboard-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/konva-components/Area/index.js +15 -44
- package/dist/components/konva-components/KonvaMapper.js +19 -42
- package/dist/components/lectures-component/components/LectureButtons.js +12 -13
- package/dist/components/lectures-component/components/LecturesComponent.js +29 -55
- package/dist/components/lectures-component/index.js +0 -3
- package/dist/components/lectures-component/mocks/mockForStory.js +6 -9
- package/dist/components/login-puzzle-component/components/LoginPuzzleComponent.js +38 -80
- package/dist/components/login-puzzle-component/index.js +0 -3
- package/dist/components/login-puzzle-component/mocks/mockForStory.js +0 -2
- package/dist/components/notice-component/components/NoticeComponent.js +8 -21
- package/dist/components/notice-component/index.js +0 -3
- package/dist/components/notice-component/mocks/mockForStory.js +0 -2
- package/dist/components/pattern-component/components/PatternComponent.js +8 -24
- package/dist/components/pattern-component/index.js +0 -3
- package/dist/components/pattern-component/mocks/mockForStory.js +0 -2
- package/dist/components/pdf-component/components/PdfComponent.js +23 -55
- package/dist/components/pdf-component/components/PdfVisor.js +22 -58
- package/dist/components/pdf-component/index.js +0 -3
- package/dist/components/pdf-component/mocks/mockForProps.js +1 -2
- package/dist/components/referral-component/components/EmailPill.js +2 -6
- package/dist/components/referral-component/components/ReferralComponent.js +30 -59
- package/dist/components/referral-component/components/StepOne.js +14 -48
- package/dist/components/referral-component/components/StepTwo.js +8 -23
- package/dist/components/referral-component/index.js +0 -3
- package/dist/components/referral-component/mocks/mockForStory.js +0 -2
- package/dist/components/survey-component/components/ApplicableBox.js +8 -15
- package/dist/components/survey-component/components/OpinionBox.js +8 -15
- package/dist/components/survey-component/components/SurveyComponent.js +13 -40
- package/dist/components/survey-component/components/TextBox.js +7 -13
- package/dist/components/survey-component/index.js +0 -3
- package/dist/components/survey-component/mocks/mockForStory.js +0 -2
- package/dist/components/terminal-puzzle-component/components/FilesGroup/Item.js +1 -6
- package/dist/components/terminal-puzzle-component/components/FilesGroup/index.js +4 -10
- package/dist/components/terminal-puzzle-component/components/Image/index.js +2 -6
- package/dist/components/terminal-puzzle-component/components/TerminalPuzzleComponent.js +26 -65
- package/dist/components/terminal-puzzle-component/components/Visor/index.js +15 -35
- package/dist/components/terminal-puzzle-component/components/utils/index.js +0 -3
- package/dist/components/terminal-puzzle-component/index.js +0 -3
- package/dist/components/terminal-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/test-component/components/Container.js +26 -60
- package/dist/components/test-component/components/Feedbacks.js +3 -13
- package/dist/components/test-component/components/Questions.js +11 -45
- package/dist/components/test-component/components/Results.js +28 -52
- package/dist/components/test-component/components/TestComponent.js +59 -110
- package/dist/components/test-component/index.js +0 -3
- package/dist/components/test-component/mocks/mockForStory.js +4 -8
- package/dist/components/text-click-puzzle-component/components/TextClickPuzzleComponent.js +58 -95
- package/dist/components/text-click-puzzle-component/index.js +0 -3
- package/dist/components/text-click-puzzle-component/mocks/mockForStory.js +1 -2
- package/dist/components/text-click-puzzle-component/utils/index.js +6 -31
- package/dist/components/url-component/components/UrlComponent.js +16 -34
- package/dist/components/url-component/index.js +0 -3
- package/dist/components/url-component/mocks/mockForProps.js +0 -2
- package/dist/components/video-component/components/VideoComponent.js +11 -25
- package/dist/components/video-component/index.js +0 -3
- package/dist/components/video-component/mocks/mockForStory.js +0 -2
- package/dist/components/video-visor/components/VideoControllers/BufferBar.js +10 -37
- package/dist/components/video-visor/components/VideoControllers/ControlButtons.js +2 -6
- package/dist/components/video-visor/components/VideoControllers/FinishedVideoButtons.js +1 -5
- package/dist/components/video-visor/components/VideoControllers/PlayInitButton.js +2 -8
- package/dist/components/video-visor/components/VideoControllers/SkipButton.js +5 -9
- package/dist/components/video-visor/components/VideoControllers/Timer.js +0 -5
- package/dist/components/video-visor/components/VideoControllers/VolumeBar.js +4 -20
- package/dist/components/video-visor/components/VideoControllers/index.js +17 -29
- package/dist/components/video-visor/components/VideoVisor.js +38 -92
- package/dist/components/video-visor/index.js +0 -3
- package/dist/components/video-visor/mocks/mockForStory.js +1 -2
- package/dist/components/web-builder-puzzle-component/Popups/PopupColorComponent/index.js +11 -28
- package/dist/components/web-builder-puzzle-component/Popups/PopupImageComponent/index.js +10 -27
- package/dist/components/web-builder-puzzle-component/Popups/PopupTextComponent/index.js +13 -36
- package/dist/components/web-builder-puzzle-component/Popups/index.js +0 -4
- package/dist/components/web-builder-puzzle-component/Templates/Facebook.js +0 -2
- package/dist/components/web-builder-puzzle-component/components/EditButton/index.js +1 -5
- package/dist/components/web-builder-puzzle-component/components/Feedback/index.js +3 -7
- package/dist/components/web-builder-puzzle-component/components/PublishButton/index.js +1 -5
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/BankBody.js +5 -12
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/FacebookBody.js +5 -11
- package/dist/components/web-builder-puzzle-component/components/WebBuilderBody/index.js +0 -7
- package/dist/components/web-builder-puzzle-component/components/WebBuilderFront/index.js +5 -14
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/BankHeader.js +5 -13
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/FacebookHeader.js +3 -8
- package/dist/components/web-builder-puzzle-component/components/WebBuilderHeader/index.js +3 -10
- package/dist/components/web-builder-puzzle-component/components/WebBuilderPuzzleComponent.js +47 -112
- package/dist/components/web-builder-puzzle-component/components/WebBuilderTopBar/index.js +3 -9
- package/dist/components/web-builder-puzzle-component/index.js +0 -3
- package/dist/components/web-builder-puzzle-component/mocks/mockForStory.js +0 -3
- package/dist/components/writer-puzzle-component/components/ElectionComponent.js +13 -30
- package/dist/components/writer-puzzle-component/components/FeedbackComponent.js +14 -30
- package/dist/components/writer-puzzle-component/components/FeedbackElement.js +2 -6
- package/dist/components/writer-puzzle-component/components/FinishedTextComponent.js +1 -6
- package/dist/components/writer-puzzle-component/components/FixedComponent.js +17 -52
- package/dist/components/writer-puzzle-component/components/SingleElection.js +13 -41
- package/dist/components/writer-puzzle-component/components/WriterPuzzleComponent.js +63 -145
- package/dist/components/writer-puzzle-component/index.js +0 -3
- package/dist/components/writer-puzzle-component/mocks/mockForStory.js +10 -7
- package/dist/components/zoom-test/components/ZoomTest.js +7 -25
- package/dist/components/zoom-test/index.js +0 -3
- package/dist/components/zoom-test/mocks/mockForStory.js +0 -4
- package/dist/helpers/LangIsRtl.js +0 -4
- package/dist/helpers/LightSet.js +0 -4
- package/dist/helpers/LodController.js +1 -10
- package/dist/helpers/deviceDetection.js +2 -5
- package/dist/helpers/drawLOD.js +11 -53
- package/dist/helpers/index.js +73 -102
- package/dist/helpers/lodStats.js +2 -10
- package/dist/helpers/mocker.js +1 -20
- package/dist/helpers/useEkho.js +64 -91
- package/dist/helpers/useGLB.js +5 -13
- package/dist/helpers/useStateMachine.js +257 -0
- package/dist/helpers/useTimeout.js +0 -6
- package/dist/helpers/useWindowSize.js +8 -22
- package/dist/index.js +0 -2
- package/dist/test/testSceneWrapper.js +0 -8
- package/package.json +3 -2
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _GLTFLoader = require("three/examples/jsm/loaders/GLTFLoader");
|
|
9
|
+
var _zustand = _interopRequireDefault(require("zustand"));
|
|
10
|
+
var _fiber = require("@react-three/fiber");
|
|
11
|
+
var _ = require(".");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
15
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
16
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
17
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
21
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
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."); }
|
|
24
|
+
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); }
|
|
25
|
+
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; }
|
|
26
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
32
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable no-restricted-syntax */
|
|
33
|
+
var loader = new _GLTFLoader.GLTFLoader();
|
|
34
|
+
var useAnimationFactory = (0, _zustand.default)(function (set) {
|
|
35
|
+
return {
|
|
36
|
+
active: {},
|
|
37
|
+
setActive: function setActive(uid, active) {
|
|
38
|
+
return set(function (s) {
|
|
39
|
+
return {
|
|
40
|
+
active: _objectSpread(_objectSpread({}, s.active), {}, _defineProperty({}, uid, active))
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
function useStateMachine(lines) {
|
|
47
|
+
var _useAnimationFactory = useAnimationFactory(),
|
|
48
|
+
active = _useAnimationFactory.active,
|
|
49
|
+
setActive = _useAnimationFactory.setActive;
|
|
50
|
+
var scene = (0, _fiber.useThree)(function (s) {
|
|
51
|
+
return s.scene;
|
|
52
|
+
});
|
|
53
|
+
var _useState = (0, _react.useState)(false),
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
loaded = _useState2[0],
|
|
56
|
+
setLoaded = _useState2[1];
|
|
57
|
+
var _useState3 = (0, _react.useState)([]),
|
|
58
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
+
queue = _useState4[0],
|
|
60
|
+
setQueue = _useState4[1];
|
|
61
|
+
var data = (0, _react.useMemo)(function () {
|
|
62
|
+
var urls = {};
|
|
63
|
+
var _iterator = _createForOfIteratorHelper(lines),
|
|
64
|
+
_step;
|
|
65
|
+
try {
|
|
66
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
67
|
+
var line = _step.value;
|
|
68
|
+
if (!line.slots) continue;
|
|
69
|
+
var _iterator2 = _createForOfIteratorHelper(line.slots),
|
|
70
|
+
_step2;
|
|
71
|
+
try {
|
|
72
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
73
|
+
var _slot$character3;
|
|
74
|
+
var slot = _step2.value;
|
|
75
|
+
if (!slot.uid) continue;
|
|
76
|
+
if (!urls[slot.uid]) {
|
|
77
|
+
var _slot$character;
|
|
78
|
+
urls[slot.uid] = _defineProperty({}, slot.emotion, (_slot$character = slot.character) === null || _slot$character === void 0 ? void 0 : _slot$character.resource.animations[slot.emotion].url);
|
|
79
|
+
} else {
|
|
80
|
+
var _slot$character2;
|
|
81
|
+
urls[slot.uid] = _objectSpread(_objectSpread({}, urls[slot.uid]), {}, _defineProperty({}, slot.emotion, (_slot$character2 = slot.character) === null || _slot$character2 === void 0 ? void 0 : _slot$character2.resource.animations[slot.emotion].url));
|
|
82
|
+
}
|
|
83
|
+
urls[slot.uid].talking = (_slot$character3 = slot.character) === null || _slot$character3 === void 0 ? void 0 : _slot$character3.resource.animations.talking.url;
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
_iterator2.e(err);
|
|
87
|
+
} finally {
|
|
88
|
+
_iterator2.f();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} catch (err) {
|
|
92
|
+
_iterator.e(err);
|
|
93
|
+
} finally {
|
|
94
|
+
_iterator.f();
|
|
95
|
+
}
|
|
96
|
+
return urls;
|
|
97
|
+
}, [lines]);
|
|
98
|
+
var resetActives = function resetActives() {
|
|
99
|
+
Object.keys(active).forEach(function (uid) {
|
|
100
|
+
startAnimation(uid, 'idle');
|
|
101
|
+
setActive(uid, 'idle');
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
(0, _react.useEffect)(function () {
|
|
105
|
+
if (loaded && queue.length) {
|
|
106
|
+
queue.forEach(function (q) {
|
|
107
|
+
startAnimation(q.uid, q.emotion);
|
|
108
|
+
});
|
|
109
|
+
setQueue([]);
|
|
110
|
+
}
|
|
111
|
+
}, [queue, loaded, startAnimation]);
|
|
112
|
+
var startAnimation = (0, _react.useCallback)(function (uid, emotion) {
|
|
113
|
+
var root = scene.getObjectByProperty('uid', uid);
|
|
114
|
+
if (!root) return;
|
|
115
|
+
if (!loaded) {
|
|
116
|
+
var q = {
|
|
117
|
+
uid: uid,
|
|
118
|
+
emotion: emotion
|
|
119
|
+
};
|
|
120
|
+
setQueue(function (s) {
|
|
121
|
+
return s.includes(q) ? s : [].concat(_toConsumableArray(s), [q]);
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
var _root$userData = root.userData,
|
|
125
|
+
mixer = _root$userData.mixer,
|
|
126
|
+
actionList = _root$userData.actionList;
|
|
127
|
+
var currentActive = active[uid];
|
|
128
|
+
var startAction = actionList[currentActive];
|
|
129
|
+
var endAction = actionList[emotion];
|
|
130
|
+
(0, _.resetActions)(mixer, startAction);
|
|
131
|
+
(0, _.executeCrossFade)(startAction, endAction);
|
|
132
|
+
setActive(uid, emotion);
|
|
133
|
+
}
|
|
134
|
+
}, [scene, loaded, active, setActive]);
|
|
135
|
+
var processAnimations = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
136
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
137
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
138
|
+
case 0:
|
|
139
|
+
_context4.next = 2;
|
|
140
|
+
return Promise.all(Object.keys(data).map( /*#__PURE__*/function () {
|
|
141
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(uid) {
|
|
142
|
+
var actions, root, _root$userData2, mixer, defaultAnim, actionList, defaultAction, loadEmotion;
|
|
143
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
144
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
145
|
+
case 0:
|
|
146
|
+
actions = _objectSpread({}, data[uid]);
|
|
147
|
+
root = scene.getObjectByProperty('uid', uid);
|
|
148
|
+
if (root) {
|
|
149
|
+
_context3.next = 4;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
return _context3.abrupt("return");
|
|
153
|
+
case 4:
|
|
154
|
+
_root$userData2 = root.userData, mixer = _root$userData2.mixer, defaultAnim = _root$userData2.defaultAnim;
|
|
155
|
+
if (!root.userData.actionList) root.userData.actionList = {};
|
|
156
|
+
actionList = root.userData.actionList;
|
|
157
|
+
if (!actionList.idle) {
|
|
158
|
+
defaultAction = mixer.existingAction(defaultAnim, root);
|
|
159
|
+
actionList.idle = defaultAction;
|
|
160
|
+
(0, _.activateAction)(defaultAction, 1);
|
|
161
|
+
setActive(uid, 'idle');
|
|
162
|
+
}
|
|
163
|
+
loadEmotion = /*#__PURE__*/function () {
|
|
164
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(emotion) {
|
|
165
|
+
var url, gltf, clip, clone, talkingClip, _action, action;
|
|
166
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
167
|
+
while (1) switch (_context.prev = _context.next) {
|
|
168
|
+
case 0:
|
|
169
|
+
if (!actionList[emotion]) {
|
|
170
|
+
_context.next = 2;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
return _context.abrupt("return");
|
|
174
|
+
case 2:
|
|
175
|
+
url = actions[emotion];
|
|
176
|
+
_context.next = 5;
|
|
177
|
+
return loader.loadAsync(url);
|
|
178
|
+
case 5:
|
|
179
|
+
gltf = _context.sent;
|
|
180
|
+
clip = gltf.animations[0];
|
|
181
|
+
if (emotion !== 'talking' && actionList.talking) {
|
|
182
|
+
clone = clip.clone();
|
|
183
|
+
clone.name = "".concat(emotion, "_talking");
|
|
184
|
+
talkingClip = actionList.talking.getClip();
|
|
185
|
+
_action = (0, _.mixWithTalkingClip)(root, talkingClip, clone);
|
|
186
|
+
(0, _.activateAction)(_action, 0);
|
|
187
|
+
actionList[clone.name] = _action;
|
|
188
|
+
}
|
|
189
|
+
clip.name = emotion;
|
|
190
|
+
action = mixer.clipAction(clip, root);
|
|
191
|
+
(0, _.activateAction)(action, 0);
|
|
192
|
+
actionList[clip.name] = action;
|
|
193
|
+
case 12:
|
|
194
|
+
case "end":
|
|
195
|
+
return _context.stop();
|
|
196
|
+
}
|
|
197
|
+
}, _callee);
|
|
198
|
+
}));
|
|
199
|
+
return function loadEmotion(_x3) {
|
|
200
|
+
return _ref3.apply(this, arguments);
|
|
201
|
+
};
|
|
202
|
+
}();
|
|
203
|
+
if (!(!actionList.talking && actions.talking)) {
|
|
204
|
+
_context3.next = 12;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
_context3.next = 12;
|
|
208
|
+
return loadEmotion('talking');
|
|
209
|
+
case 12:
|
|
210
|
+
_context3.next = 14;
|
|
211
|
+
return Promise.all(Object.keys(actions).map( /*#__PURE__*/function () {
|
|
212
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(emotion) {
|
|
213
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
214
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
215
|
+
case 0:
|
|
216
|
+
_context2.next = 2;
|
|
217
|
+
return loadEmotion(emotion);
|
|
218
|
+
case 2:
|
|
219
|
+
case "end":
|
|
220
|
+
return _context2.stop();
|
|
221
|
+
}
|
|
222
|
+
}, _callee2);
|
|
223
|
+
}));
|
|
224
|
+
return function (_x4) {
|
|
225
|
+
return _ref4.apply(this, arguments);
|
|
226
|
+
};
|
|
227
|
+
}()));
|
|
228
|
+
case 14:
|
|
229
|
+
case "end":
|
|
230
|
+
return _context3.stop();
|
|
231
|
+
}
|
|
232
|
+
}, _callee3);
|
|
233
|
+
}));
|
|
234
|
+
return function (_x2) {
|
|
235
|
+
return _ref2.apply(this, arguments);
|
|
236
|
+
};
|
|
237
|
+
}()));
|
|
238
|
+
case 2:
|
|
239
|
+
setLoaded(true);
|
|
240
|
+
case 3:
|
|
241
|
+
case "end":
|
|
242
|
+
return _context4.stop();
|
|
243
|
+
}
|
|
244
|
+
}, _callee4);
|
|
245
|
+
})), [data, scene, setActive]);
|
|
246
|
+
|
|
247
|
+
// Load emotions
|
|
248
|
+
(0, _react.useEffect)(function () {
|
|
249
|
+
processAnimations();
|
|
250
|
+
}, [processAnimations]);
|
|
251
|
+
return {
|
|
252
|
+
startAnimation: startAnimation,
|
|
253
|
+
resetActives: resetActives
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
var _default = useStateMachine;
|
|
257
|
+
exports.default = _default;
|
|
@@ -4,22 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var useTimeout = function useTimeout() {
|
|
11
9
|
var timeout = (0, _react.useRef)();
|
|
12
|
-
|
|
13
10
|
var start = function start(fn, ms) {
|
|
14
11
|
timeout.current = setTimeout(fn, ms);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
var stop = function stop() {
|
|
18
14
|
if (timeout.current) {
|
|
19
15
|
clearTimeout(timeout.current);
|
|
20
16
|
}
|
|
21
17
|
};
|
|
22
|
-
|
|
23
18
|
(0, _react.useEffect)(function () {
|
|
24
19
|
return function () {
|
|
25
20
|
if (timeout.current) {
|
|
@@ -33,6 +28,5 @@ var useTimeout = function useTimeout() {
|
|
|
33
28
|
running: !!timeout.current
|
|
34
29
|
};
|
|
35
30
|
};
|
|
36
|
-
|
|
37
31
|
var _default = useTimeout;
|
|
38
32
|
exports.default = _default;
|
|
@@ -4,47 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useWindowSize = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
-
|
|
12
9
|
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."); }
|
|
13
|
-
|
|
14
10
|
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); }
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
11
|
+
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; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
20
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
-
|
|
22
14
|
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); }
|
|
23
|
-
|
|
24
15
|
// Hook
|
|
25
16
|
var useWindowSize = function useWindowSize() {
|
|
26
17
|
var isClient = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object';
|
|
27
|
-
|
|
28
18
|
var _useState = (0, _react.useState)({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
width: isClient ? window.innerWidth : undefined,
|
|
20
|
+
height: isClient ? window.innerHeight : undefined
|
|
21
|
+
}),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
windowSize = _useState2[0],
|
|
24
|
+
setWindowSize = _useState2[1];
|
|
36
25
|
(0, _react.useEffect)(function () {
|
|
37
26
|
if (!isClient) {
|
|
38
27
|
return false;
|
|
39
28
|
}
|
|
40
|
-
|
|
41
29
|
function handleResize() {
|
|
42
30
|
setWindowSize({
|
|
43
31
|
width: isClient ? window.innerWidth : undefined,
|
|
44
32
|
height: isClient ? window.innerHeight : undefined
|
|
45
33
|
});
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
window.addEventListener('resize', handleResize);
|
|
49
36
|
return function () {
|
|
50
37
|
return window.removeEventListener('resize', handleResize);
|
|
@@ -52,7 +39,6 @@ var useWindowSize = function useWindowSize() {
|
|
|
52
39
|
}, [isClient]);
|
|
53
40
|
return windowSize;
|
|
54
41
|
};
|
|
55
|
-
|
|
56
42
|
exports.useWindowSize = useWindowSize;
|
|
57
43
|
var _default = useWindowSize;
|
|
58
44
|
exports.default = _default;
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _components = require("./components");
|
|
8
|
-
|
|
9
7
|
Object.keys(_components).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _components[key]) return;
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.mockScene = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _arcadeThreeCore = require("@gamelearn/arcade-three-core");
|
|
11
|
-
|
|
12
9
|
var _bg001_street = _interopRequireDefault(require("./mocks/bg001_street.json"));
|
|
13
|
-
|
|
14
10
|
var _characters = require("./mocks/characters.json");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
var mockScene = {
|
|
19
13
|
background: _bg001_street.default,
|
|
20
14
|
elements: _characters.elements,
|
|
@@ -23,7 +17,6 @@ var mockScene = {
|
|
|
23
17
|
}
|
|
24
18
|
};
|
|
25
19
|
exports.mockScene = mockScene;
|
|
26
|
-
|
|
27
20
|
var SceneWrapper = function SceneWrapper(_ref) {
|
|
28
21
|
var children = _ref.children;
|
|
29
22
|
return /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.Renderer, mockScene.scene, /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.Debugger, null), /*#__PURE__*/_react.default.createElement(_arcadeThreeCore.LodWrapper, {
|
|
@@ -34,6 +27,5 @@ var SceneWrapper = function SceneWrapper(_ref) {
|
|
|
34
27
|
elements: _characters.elements
|
|
35
28
|
}), children));
|
|
36
29
|
};
|
|
37
|
-
|
|
38
30
|
var _default = SceneWrapper;
|
|
39
31
|
exports.default = _default;
|
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.29.2",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"react-promise-suspense": "0.3.3",
|
|
36
36
|
"react-typist": "^2.0.5",
|
|
37
37
|
"three": "0.139.2",
|
|
38
|
-
"web-vitals": "0.2.4"
|
|
38
|
+
"web-vitals": "0.2.4",
|
|
39
|
+
"zustand": "4.3.8"
|
|
39
40
|
},
|
|
40
41
|
"scripts": {
|
|
41
42
|
"start": "npm run storybook",
|