@cuemath/leap 3.0.22-aa17 → 3.0.22-aa18

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.
@@ -1,5 +1,5 @@
1
1
  import { useCallback as c } from "react";
2
- import { useErrorBoundary as ot } from "../../../../node_modules/react-error-boundary/dist/react-error-boundary.esm.js";
2
+ import { useErrorBoundary as ot } from "react-error-boundary";
3
3
  import it from "../../../hooks/use-audio-player.js";
4
4
  import ct from "../../constants/events.js";
5
5
  import { SYSTEM_VALIDATION_AUDIO_LIST as rt } from "../constants.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.0.22-aa17",
3
+ "version": "3.0.22-aa18",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,33 +0,0 @@
1
- import { createContext as s, useContext as u, useState as a, useMemo as d } from "react";
2
- const E = s(null);
3
- function f(r) {
4
- if (r == null || typeof r.didCatch != "boolean" || typeof r.resetErrorBoundary != "function")
5
- throw new Error("ErrorBoundaryContext not found");
6
- }
7
- function c() {
8
- const r = u(E);
9
- f(r);
10
- const [o, t] = a({
11
- error: null,
12
- hasError: !1
13
- }), e = d(() => ({
14
- resetBoundary: () => {
15
- r.resetErrorBoundary(), t({
16
- error: null,
17
- hasError: !1
18
- });
19
- },
20
- showBoundary: (n) => t({
21
- error: n,
22
- hasError: !0
23
- })
24
- }), [r.resetErrorBoundary]);
25
- if (o.hasError)
26
- throw o.error;
27
- return e;
28
- }
29
- export {
30
- E as ErrorBoundaryContext,
31
- c as useErrorBoundary
32
- };
33
- //# sourceMappingURL=react-error-boundary.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-error-boundary.esm.js","sources":["../../../../node_modules/react-error-boundary/dist/react-error-boundary.esm.js"],"sourcesContent":["'use client';\nimport { createContext, Component, createElement, isValidElement, useContext, useState, useMemo, forwardRef } from 'react';\n\nconst ErrorBoundaryContext = createContext(null);\n\nconst initialState = {\n didCatch: false,\n error: null\n};\nclass ErrorBoundary extends Component {\n constructor(props) {\n super(props);\n this.resetErrorBoundary = this.resetErrorBoundary.bind(this);\n this.state = initialState;\n }\n static getDerivedStateFromError(error) {\n return {\n didCatch: true,\n error\n };\n }\n resetErrorBoundary() {\n const {\n error\n } = this.state;\n if (error !== null) {\n var _this$props$onReset, _this$props;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n (_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 ? void 0 : _this$props$onReset.call(_this$props, {\n args,\n reason: \"imperative-api\"\n });\n this.setState(initialState);\n }\n }\n componentDidCatch(error, info) {\n var _this$props$onError, _this$props2;\n (_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);\n }\n componentDidUpdate(prevProps, prevState) {\n const {\n didCatch\n } = this.state;\n const {\n resetKeys\n } = this.props;\n\n // There's an edge case where if the thing that triggered the error happens to *also* be in the resetKeys array,\n // we'd end up resetting the error boundary immediately.\n // This would likely trigger a second error to be thrown.\n // So we make sure that we don't check the resetKeys on the first call of cDU after the error is set.\n\n if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {\n var _this$props$onReset2, _this$props3;\n (_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {\n next: resetKeys,\n prev: prevProps.resetKeys,\n reason: \"keys\"\n });\n this.setState(initialState);\n }\n }\n render() {\n const {\n children,\n fallbackRender,\n FallbackComponent,\n fallback\n } = this.props;\n const {\n didCatch,\n error\n } = this.state;\n let childToRender = children;\n if (didCatch) {\n const props = {\n error,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof fallbackRender === \"function\") {\n childToRender = fallbackRender(props);\n } else if (FallbackComponent) {\n childToRender = createElement(FallbackComponent, props);\n } else if (fallback === null || isValidElement(fallback)) {\n childToRender = fallback;\n } else {\n throw error;\n }\n }\n return createElement(ErrorBoundaryContext.Provider, {\n value: {\n didCatch,\n error,\n resetErrorBoundary: this.resetErrorBoundary\n }\n }, childToRender);\n }\n}\nfunction hasArrayChanged() {\n let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));\n}\n\nfunction assertErrorBoundaryContext(value) {\n if (value == null || typeof value.didCatch !== \"boolean\" || typeof value.resetErrorBoundary !== \"function\") {\n throw new Error(\"ErrorBoundaryContext not found\");\n }\n}\n\nfunction useErrorBoundary() {\n const context = useContext(ErrorBoundaryContext);\n assertErrorBoundaryContext(context);\n const [state, setState] = useState({\n error: null,\n hasError: false\n });\n const memoized = useMemo(() => ({\n resetBoundary: () => {\n context.resetErrorBoundary();\n setState({\n error: null,\n hasError: false\n });\n },\n showBoundary: error => setState({\n error,\n hasError: true\n })\n }), [context.resetErrorBoundary]);\n if (state.hasError) {\n throw state.error;\n }\n return memoized;\n}\n\nfunction withErrorBoundary(component, errorBoundaryProps) {\n const Wrapped = forwardRef((props, ref) => createElement(ErrorBoundary, errorBoundaryProps, createElement(component, {\n ...props,\n ref\n })));\n\n // Format for display in DevTools\n const name = component.displayName || component.name || \"Unknown\";\n Wrapped.displayName = \"withErrorBoundary(\".concat(name, \")\");\n return Wrapped;\n}\n\nexport { ErrorBoundary, ErrorBoundaryContext, useErrorBoundary, withErrorBoundary };\n"],"names":["ErrorBoundaryContext","createContext","assertErrorBoundaryContext","value","useErrorBoundary","context","useContext","state","setState","useState","memoized","useMemo","error"],"mappings":";AAGK,MAACA,IAAuBC,EAAc,IAAI;AAuG/C,SAASC,EAA2BC,GAAO;AACzC,MAAIA,KAAS,QAAQ,OAAOA,EAAM,YAAa,aAAa,OAAOA,EAAM,sBAAuB;AAC9F,UAAM,IAAI,MAAM,gCAAgC;AAEpD;AAEA,SAASC,IAAmB;AAC1B,QAAMC,IAAUC,EAAWN,CAAoB;AAC/C,EAAAE,EAA2BG,CAAO;AAClC,QAAM,CAACE,GAAOC,CAAQ,IAAIC,EAAS;AAAA,IACjC,OAAO;AAAA,IACP,UAAU;AAAA,EACd,CAAG,GACKC,IAAWC,EAAQ,OAAO;AAAA,IAC9B,eAAe,MAAM;AACnB,MAAAN,EAAQ,mBAAkB,GAC1BG,EAAS;AAAA,QACP,OAAO;AAAA,QACP,UAAU;AAAA,MAClB,CAAO;AAAA,IACF;AAAA,IACD,cAAc,CAAAI,MAASJ,EAAS;AAAA,MAC9B,OAAAI;AAAA,MACA,UAAU;AAAA,IAChB,CAAK;AAAA,EACF,IAAG,CAACP,EAAQ,kBAAkB,CAAC;AAChC,MAAIE,EAAM;AACR,UAAMA,EAAM;AAEd,SAAOG;AACT;","x_google_ignoreList":[0]}