sample-cross-fx 0.14.9-beta.3522 → 0.14.10-beta.3616

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.
@@ -129975,17 +129975,19 @@ __webpack_require__.r(__webpack_exports__);
129975
129975
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
129976
129976
  /* harmony export */ "ErrorBoundary": () => (/* binding */ ErrorBoundary)
129977
129977
  /* harmony export */ });
129978
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "../../../node_modules/tslib/tslib.es6.js");
129978
129979
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
129979
- /* harmony import */ var piral_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! piral-base */ "../../framework/piral-base/esm/utils.js");
129980
+ /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components */ "../../framework/piral-core/esm/components/components.js");
129981
+
129980
129982
 
129981
129983
 
129982
129984
  /**
129983
- * The React component for catching errors and displaying error information.
129985
+ * The component for catching errors and displaying error information.
129984
129986
  */
129985
129987
 
129986
129988
  class ErrorBoundary extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
129987
- constructor(props) {
129988
- super(props);
129989
+ constructor() {
129990
+ super(...arguments);
129989
129991
  this.state = {
129990
129992
  error: undefined
129991
129993
  };
@@ -129993,42 +129995,40 @@ class ErrorBoundary extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
129993
129995
 
129994
129996
  componentDidCatch(error) {
129995
129997
  const {
129996
- onError
129998
+ piral,
129999
+ errorType
129997
130000
  } = this.props;
129998
-
129999
- if ((0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(onError)) {
130000
- onError(error);
130001
- }
130002
-
130001
+ const pilet = piral.meta.name;
130002
+ console.error(`[${pilet}] Exception in component of type "${errorType}".`, error);
130003
130003
  this.setState({
130004
130004
  error
130005
130005
  });
130006
130006
  }
130007
130007
 
130008
130008
  render() {
130009
- const {
130009
+ const _a = this.props,
130010
+ {
130010
130011
  children,
130011
- renderError,
130012
- renderChild,
130013
- renderProps
130014
- } = this.props;
130012
+ piral,
130013
+ errorType
130014
+ } = _a,
130015
+ renderProps = (0,tslib__WEBPACK_IMPORTED_MODULE_1__.__rest)(_a, ["children", "piral", "errorType"]);
130016
+
130015
130017
  const {
130016
130018
  error
130017
130019
  } = this.state;
130020
+ const rest = renderProps;
130018
130021
 
130019
130022
  if (error) {
130020
- if ((0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(renderError)) {
130021
- return renderError(error, renderProps);
130022
- }
130023
-
130024
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", {
130025
- style: {
130026
- whiteSpace: 'pre-wrap'
130027
- }
130028
- }, error && error.message);
130023
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_2__.PiralError, Object.assign({
130024
+ type: errorType,
130025
+ error: error
130026
+ }, rest));
130029
130027
  }
130030
130028
 
130031
- return (0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(renderChild) ? renderChild(children, renderProps) : children;
130029
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Suspense, {
130030
+ fallback: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_2__.PiralLoadingIndicator, null)
130031
+ }, children);
130032
130032
  }
130033
130033
 
130034
130034
  }
@@ -130084,6 +130084,110 @@ ExtensionSlot.displayName = `ExtensionSlot`;
130084
130084
 
130085
130085
  /***/ }),
130086
130086
 
130087
+ /***/ "../../framework/piral-core/esm/components/ForeignComponentContainer.js":
130088
+ /*!******************************************************************************!*\
130089
+ !*** ../../framework/piral-core/esm/components/ForeignComponentContainer.js ***!
130090
+ \******************************************************************************/
130091
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
130092
+
130093
+ "use strict";
130094
+ __webpack_require__.r(__webpack_exports__);
130095
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
130096
+ /* harmony export */ "ForeignComponentContainer": () => (/* binding */ ForeignComponentContainer)
130097
+ /* harmony export */ });
130098
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
130099
+ /* harmony import */ var piral_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! piral-base */ "../../framework/piral-base/esm/utils.js");
130100
+
130101
+
130102
+ class ForeignComponentContainer extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
130103
+ constructor() {
130104
+ super(...arguments);
130105
+
130106
+ this.handler = ev => {
130107
+ const {
130108
+ innerProps
130109
+ } = this.props;
130110
+ ev.stopPropagation();
130111
+ innerProps.piral.renderHtmlExtension(ev.detail.target, ev.detail.props);
130112
+ };
130113
+
130114
+ this.setNode = node => {
130115
+ this.current = node;
130116
+ };
130117
+ }
130118
+
130119
+ componentDidMount() {
130120
+ const node = this.current;
130121
+ const {
130122
+ $component,
130123
+ $context,
130124
+ innerProps
130125
+ } = this.props;
130126
+ const {
130127
+ mount
130128
+ } = $component;
130129
+
130130
+ if (node && (0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(mount)) {
130131
+ mount(node, innerProps, $context);
130132
+ node.addEventListener('render-html', this.handler, false);
130133
+ }
130134
+
130135
+ this.previous = node;
130136
+ }
130137
+
130138
+ componentDidUpdate() {
130139
+ const {
130140
+ current,
130141
+ previous
130142
+ } = this;
130143
+ const {
130144
+ $component,
130145
+ $context,
130146
+ innerProps
130147
+ } = this.props;
130148
+ const {
130149
+ update
130150
+ } = $component;
130151
+
130152
+ if (current !== previous) {
130153
+ previous && this.componentWillUnmount();
130154
+ current && this.componentDidMount();
130155
+ } else if ((0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(update)) {
130156
+ update(current, innerProps, $context);
130157
+ }
130158
+ }
130159
+
130160
+ componentWillUnmount() {
130161
+ const node = this.previous;
130162
+ const {
130163
+ $component
130164
+ } = this.props;
130165
+ const {
130166
+ unmount
130167
+ } = $component;
130168
+
130169
+ if (node && (0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(unmount)) {
130170
+ unmount(node);
130171
+ node.removeEventListener('render-html', this.handler, false);
130172
+ }
130173
+
130174
+ this.previous = undefined;
130175
+ }
130176
+
130177
+ render() {
130178
+ const {
130179
+ $portalId
130180
+ } = this.props;
130181
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", {
130182
+ "data-portal-id": $portalId,
130183
+ ref: this.setNode
130184
+ });
130185
+ }
130186
+
130187
+ }
130188
+
130189
+ /***/ }),
130190
+
130087
130191
  /***/ "../../framework/piral-core/esm/components/Mediator.js":
130088
130192
  /*!*************************************************************!*\
130089
130193
  !*** ../../framework/piral-core/esm/components/Mediator.js ***!
@@ -130694,7 +130798,8 @@ __webpack_require__.r(__webpack_exports__);
130694
130798
  /* harmony export */ "SetProvider": () => (/* reexport safe */ _SetProvider__WEBPACK_IMPORTED_MODULE_16__.SetProvider),
130695
130799
  /* harmony export */ "SetRedirect": () => (/* reexport safe */ _SetRedirect__WEBPACK_IMPORTED_MODULE_17__.SetRedirect),
130696
130800
  /* harmony export */ "SetRoute": () => (/* reexport safe */ _SetRoute__WEBPACK_IMPORTED_MODULE_18__.SetRoute),
130697
- /* harmony export */ "SwitchErrorInfo": () => (/* reexport safe */ _SwitchErrorInfo__WEBPACK_IMPORTED_MODULE_19__.SwitchErrorInfo)
130801
+ /* harmony export */ "SwitchErrorInfo": () => (/* reexport safe */ _SwitchErrorInfo__WEBPACK_IMPORTED_MODULE_19__.SwitchErrorInfo),
130802
+ /* harmony export */ "wrapComponent": () => (/* reexport safe */ _wrapComponent__WEBPACK_IMPORTED_MODULE_20__.wrapComponent)
130698
130803
  /* harmony export */ });
130699
130804
  /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components */ "../../framework/piral-core/esm/components/components.js");
130700
130805
  /* harmony import */ var _DefaultErrorInfo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DefaultErrorInfo */ "../../framework/piral-core/esm/components/DefaultErrorInfo.js");
@@ -130716,6 +130821,8 @@ __webpack_require__.r(__webpack_exports__);
130716
130821
  /* harmony import */ var _SetRedirect__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./SetRedirect */ "../../framework/piral-core/esm/components/SetRedirect.js");
130717
130822
  /* harmony import */ var _SetRoute__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./SetRoute */ "../../framework/piral-core/esm/components/SetRoute.js");
130718
130823
  /* harmony import */ var _SwitchErrorInfo__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./SwitchErrorInfo */ "../../framework/piral-core/esm/components/SwitchErrorInfo.js");
130824
+ /* harmony import */ var _wrapComponent__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./wrapComponent */ "../../framework/piral-core/esm/components/wrapComponent.js");
130825
+
130719
130826
 
130720
130827
 
130721
130828
 
@@ -130736,6 +130843,86 @@ __webpack_require__.r(__webpack_exports__);
130736
130843
 
130737
130844
 
130738
130845
 
130846
+
130847
+ /***/ }),
130848
+
130849
+ /***/ "../../framework/piral-core/esm/components/wrapComponent.js":
130850
+ /*!******************************************************************!*\
130851
+ !*** ../../framework/piral-core/esm/components/wrapComponent.js ***!
130852
+ \******************************************************************/
130853
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
130854
+
130855
+ "use strict";
130856
+ __webpack_require__.r(__webpack_exports__);
130857
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
130858
+ /* harmony export */ "wrapComponent": () => (/* binding */ wrapComponent)
130859
+ /* harmony export */ });
130860
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
130861
+ /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-router */ "../../../node_modules/react-router/esm/react-router.js");
130862
+ /* harmony import */ var _PortalRenderer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./PortalRenderer */ "../../framework/piral-core/esm/components/PortalRenderer.js");
130863
+ /* harmony import */ var _ForeignComponentContainer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./ForeignComponentContainer */ "../../framework/piral-core/esm/components/ForeignComponentContainer.js");
130864
+ /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../hooks */ "../../framework/piral-core/esm/hooks/globalState.js");
130865
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/helpers.js");
130866
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/foreign.js");
130867
+
130868
+
130869
+
130870
+
130871
+
130872
+ // this is an arbitrary start number to have 6 digits
130873
+
130874
+ let portalIdBase = 123456;
130875
+
130876
+ function wrapReactComponent(Component, captured, Wrapper) {
130877
+ return props => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Wrapper, Object.assign({}, props), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Component, Object.assign({}, props, captured)));
130878
+ }
130879
+
130880
+ function wrapForeignComponent(component, captured, Wrapper) {
130881
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.memo(props => {
130882
+ const {
130883
+ state,
130884
+ readState,
130885
+ destroyPortal
130886
+ } = (0,_hooks__WEBPACK_IMPORTED_MODULE_1__.useGlobalStateContext)();
130887
+ const router = react__WEBPACK_IMPORTED_MODULE_0__.useContext(react_router__WEBPACK_IMPORTED_MODULE_2__.__RouterContext);
130888
+ const id = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => (portalIdBase++).toString(26), _utils__WEBPACK_IMPORTED_MODULE_3__.none);
130889
+ const context = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({
130890
+ router,
130891
+ state,
130892
+ readState
130893
+ }), [router, state]);
130894
+ const innerProps = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => Object.assign(Object.assign({}, props), captured), [props]);
130895
+ react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => () => destroyPortal(id), _utils__WEBPACK_IMPORTED_MODULE_3__.none);
130896
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Wrapper, Object.assign({}, props), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_PortalRenderer__WEBPACK_IMPORTED_MODULE_4__.PortalRenderer, {
130897
+ id: id
130898
+ }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ForeignComponentContainer__WEBPACK_IMPORTED_MODULE_5__.ForeignComponentContainer, {
130899
+ innerProps: innerProps,
130900
+ "$portalId": id,
130901
+ "$component": component,
130902
+ "$context": context
130903
+ }));
130904
+ });
130905
+ }
130906
+
130907
+ function isNotExotic(component) {
130908
+ return !component.$$typeof;
130909
+ }
130910
+
130911
+ function wrapComponent(converters, component, captured, Wrapper) {
130912
+ if (!component) {
130913
+ const pilet = captured.piral.meta.name;
130914
+ console.error(`[${pilet}] The given value is not a valid component.`); // tslint:disable-next-line:no-null-keyword
130915
+
130916
+ component = () => null;
130917
+ }
130918
+
130919
+ if (typeof component === 'object' && isNotExotic(component)) {
130920
+ const result = (0,_utils__WEBPACK_IMPORTED_MODULE_6__.convertComponent)(converters[component.type], component);
130921
+ return wrapForeignComponent(result, captured, Wrapper);
130922
+ }
130923
+
130924
+ return wrapReactComponent(component, captured, Wrapper);
130925
+ }
130739
130926
 
130740
130927
  /***/ }),
130741
130928
 
@@ -130811,7 +130998,7 @@ function createInstance(config = {}) {
130811
130998
  const createApi = apiFactory(context, usedPlugins);
130812
130999
  const root = createApi({
130813
131000
  name: 'root',
130814
- version: "0.14.9-beta.3522" || 0,
131001
+ version: "0.14.10-beta.3616" || 0,
130815
131002
  spec: ''
130816
131003
  });
130817
131004
  const options = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createPiletOptions)({
@@ -131171,6 +131358,7 @@ __webpack_require__.r(__webpack_exports__);
131171
131358
  /* harmony export */ "SetRoute": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_3__.SetRoute),
131172
131359
  /* harmony export */ "SwitchErrorInfo": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_3__.SwitchErrorInfo),
131173
131360
  /* harmony export */ "getPiralComponent": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_3__.getPiralComponent),
131361
+ /* harmony export */ "wrapComponent": () => (/* reexport safe */ _components__WEBPACK_IMPORTED_MODULE_3__.wrapComponent),
131174
131362
  /* harmony export */ "useAction": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useAction),
131175
131363
  /* harmony export */ "useActions": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useActions),
131176
131364
  /* harmony export */ "useGlobalState": () => (/* reexport safe */ _hooks__WEBPACK_IMPORTED_MODULE_4__.useGlobalState),
@@ -131320,11 +131508,14 @@ function createCoreApi(context) {
131320
131508
  return context.tryWriteDataItem(name, value, pilet, target, expiration);
131321
131509
  },
131322
131510
 
131323
- registerPage(route, arg, meta) {
131511
+ registerPage(route, arg, meta = {}) {
131512
+ const component = (0,_state__WEBPACK_IMPORTED_MODULE_1__.withApi)(context, arg, api, 'page', undefined, {
131513
+ meta
131514
+ });
131324
131515
  context.registerPage(route, {
131325
131516
  pilet,
131326
131517
  meta,
131327
- component: (0,_state__WEBPACK_IMPORTED_MODULE_1__.withApi)(context, arg, api, 'page')
131518
+ component
131328
131519
  });
131329
131520
  return () => api.unregisterPage(route);
131330
131521
  },
@@ -131715,199 +131906,40 @@ __webpack_require__.r(__webpack_exports__);
131715
131906
  /* harmony export */ "withApi": () => (/* binding */ withApi)
131716
131907
  /* harmony export */ });
131717
131908
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
131718
- /* harmony import */ var piral_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! piral-base */ "../../framework/piral-base/esm/utils.js");
131719
- /* harmony import */ var react_router__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-router */ "../../../node_modules/react-router/esm/react-router.js");
131720
- /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components */ "../../framework/piral-core/esm/components/ErrorBoundary.js");
131721
- /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../components */ "../../framework/piral-core/esm/components/PortalRenderer.js");
131722
- /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../components */ "../../framework/piral-core/esm/components/components.js");
131723
- /* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../hooks */ "../../framework/piral-core/esm/hooks/globalState.js");
131909
+ /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components */ "../../framework/piral-core/esm/components/ErrorBoundary.js");
131910
+ /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components */ "../../framework/piral-core/esm/components/wrapComponent.js");
131724
131911
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/react.js");
131725
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/helpers.js");
131726
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils */ "../../framework/piral-core/esm/utils/foreign.js");
131727
-
131728
131912
 
131729
131913
 
131730
131914
 
131731
131915
 
131732
- // this is an arbitrary start number to have 6 digits
131733
-
131734
- let portalIdBase = 123456;
131735
-
131736
131916
  const DefaultWrapper = props => (0,_utils__WEBPACK_IMPORTED_MODULE_1__.defaultRender)(props.children);
131737
131917
 
131738
- class ForeignComponentContainer extends react__WEBPACK_IMPORTED_MODULE_0__.Component {
131739
- constructor() {
131740
- super(...arguments);
131741
-
131742
- this.handler = ev => {
131743
- const {
131744
- innerProps
131745
- } = this.props;
131746
- ev.stopPropagation();
131747
- innerProps.piral.renderHtmlExtension(ev.detail.target, ev.detail.props);
131748
- };
131749
-
131750
- this.setNode = node => {
131751
- this.current = node;
131752
- };
131753
- }
131754
-
131755
- componentDidMount() {
131756
- const node = this.current;
131757
- const {
131758
- $component,
131759
- $context,
131760
- innerProps
131761
- } = this.props;
131762
- const {
131763
- mount
131764
- } = $component;
131765
-
131766
- if (node && (0,piral_base__WEBPACK_IMPORTED_MODULE_2__.isfunc)(mount)) {
131767
- mount(node, innerProps, $context);
131768
- node.addEventListener('render-html', this.handler, false);
131769
- }
131770
-
131771
- this.previous = node;
131772
- }
131773
-
131774
- componentDidUpdate() {
131775
- const {
131776
- current,
131777
- previous
131778
- } = this;
131779
- const {
131780
- $component,
131781
- $context,
131782
- innerProps
131783
- } = this.props;
131784
- const {
131785
- update
131786
- } = $component;
131787
-
131788
- if (current !== previous) {
131789
- previous && this.componentWillUnmount();
131790
- current && this.componentDidMount();
131791
- } else if ((0,piral_base__WEBPACK_IMPORTED_MODULE_2__.isfunc)(update)) {
131792
- update(current, innerProps, $context);
131793
- }
131794
- }
131795
-
131796
- componentWillUnmount() {
131797
- const node = this.previous;
131798
- const {
131799
- $component
131800
- } = this.props;
131801
- const {
131802
- unmount
131803
- } = $component;
131804
-
131805
- if (node && (0,piral_base__WEBPACK_IMPORTED_MODULE_2__.isfunc)(unmount)) {
131806
- unmount(node);
131807
- node.removeEventListener('render-html', this.handler, false);
131808
- }
131809
-
131810
- this.previous = undefined;
131811
- }
131918
+ function getWrapper(wrappers, wrapperType) {
131919
+ const WrapAll = wrappers['*'];
131920
+ const WrapType = wrappers[wrapperType];
131812
131921
 
131813
- render() {
131814
- const {
131815
- $portalId
131816
- } = this.props;
131817
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", {
131818
- "data-portal-id": $portalId,
131819
- ref: this.setNode
131820
- });
131922
+ if (WrapAll && WrapType) {
131923
+ return props => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(WrapAll, Object.assign({}, props), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(WrapType, Object.assign({}, props)));
131821
131924
  }
131822
131925
 
131926
+ return WrapType || WrapAll || DefaultWrapper;
131823
131927
  }
131824
131928
 
131825
- function wrapReactComponent(Component, stasisOptions, piral, Wrapper) {
131826
- return props => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Wrapper, Object.assign({}, props, {
131827
- piral: piral
131828
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_3__.ErrorBoundary, Object.assign({}, stasisOptions, {
131829
- renderProps: props
131830
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Component, Object.assign({}, props, {
131831
- piral: piral
131832
- }))));
131929
+ function makeWrapper(context, outerProps, wrapperType, errorType) {
131930
+ const OuterWrapper = context.readState(m => getWrapper(m.registry.wrappers, wrapperType));
131931
+ return props => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(OuterWrapper, Object.assign({}, outerProps, props), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_2__.ErrorBoundary, Object.assign({}, outerProps, props, {
131932
+ errorType: errorType
131933
+ }), props.children));
131833
131934
  }
131834
131935
 
131835
- function wrapForeignComponent(component, stasisOptions, piral, Wrapper) {
131836
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.memo(props => {
131837
- const {
131838
- state,
131839
- readState,
131840
- destroyPortal
131841
- } = (0,_hooks__WEBPACK_IMPORTED_MODULE_4__.useGlobalStateContext)();
131842
- const router = react__WEBPACK_IMPORTED_MODULE_0__.useContext(react_router__WEBPACK_IMPORTED_MODULE_5__.__RouterContext);
131843
- const id = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => (portalIdBase++).toString(26), _utils__WEBPACK_IMPORTED_MODULE_6__.none);
131844
- const context = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => ({
131845
- router,
131846
- state,
131847
- readState
131848
- }), [router, state]);
131849
- const innerProps = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => Object.assign(Object.assign({}, props), {
131850
- piral
131851
- }), [props]);
131852
- react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => () => destroyPortal(id), _utils__WEBPACK_IMPORTED_MODULE_6__.none);
131853
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Wrapper, Object.assign({}, innerProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_3__.ErrorBoundary, Object.assign({}, stasisOptions, {
131854
- renderProps: props
131855
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_7__.PortalRenderer, {
131856
- id: id
131857
- }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(ForeignComponentContainer, {
131858
- innerProps: innerProps,
131859
- "$portalId": id,
131860
- "$component": component,
131861
- "$context": context
131862
- })));
131936
+ function withApi(context, component, piral, errorType, wrapperType = errorType, captured = {}) {
131937
+ const outerProps = Object.assign(Object.assign({}, captured), {
131938
+ piral
131863
131939
  });
131864
- }
131865
-
131866
- function isNotExotic(component) {
131867
- return !component.$$typeof;
131868
- }
131869
-
131870
- function wrapComponent(converters, component, piral, Wrapper, stasisOptions) {
131871
- if (!component) {
131872
- console.error('The given value is not a valid component.'); // tslint:disable-next-line:no-null-keyword
131873
-
131874
- component = () => null;
131875
- }
131876
-
131877
- if (typeof component === 'object' && isNotExotic(component)) {
131878
- const result = (0,_utils__WEBPACK_IMPORTED_MODULE_8__.convertComponent)(converters[component.type], component);
131879
- return wrapForeignComponent(result, stasisOptions, piral, Wrapper);
131880
- }
131881
-
131882
- return wrapReactComponent(component, stasisOptions, piral, Wrapper);
131883
- }
131884
-
131885
- function getWrapper(wrappers, wrapperType) {
131886
- return wrappers[wrapperType] || wrappers['*'] || DefaultWrapper;
131887
- }
131888
-
131889
- function withApi(context, component, piral, errorType, wrapperType = errorType) {
131890
131940
  const converters = context.converters;
131891
- const Wrapper = context.readState(m => getWrapper(m.registry.wrappers, wrapperType));
131892
- return wrapComponent(converters, component, piral, Wrapper, {
131893
- onError(error) {
131894
- console.error(piral, error);
131895
- },
131896
-
131897
- renderChild(child) {
131898
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Suspense, {
131899
- fallback: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_9__.PiralLoadingIndicator, null)
131900
- }, child);
131901
- },
131902
-
131903
- renderError(error, props) {
131904
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_9__.PiralError, Object.assign({
131905
- type: errorType,
131906
- error: error
131907
- }, props));
131908
- }
131909
-
131910
- });
131941
+ const Wrapper = makeWrapper(context, outerProps, wrapperType, errorType);
131942
+ return (0,_components__WEBPACK_IMPORTED_MODULE_3__.wrapComponent)(converters, component, outerProps, Wrapper);
131911
131943
  }
131912
131944
 
131913
131945
  /***/ }),
@@ -133353,12 +133385,12 @@ function installPiralDebug(options) {
133353
133385
  debug: debugApiVersion,
133354
133386
  instance: {
133355
133387
  name: "sample-cross-fx",
133356
- version: "0.14.9-beta.3522",
133388
+ version: "0.14.10-beta.3616",
133357
133389
  dependencies: "@angular/common,@angular/compiler,@angular/core,@angular/platform-browser,@angular/platform-browser-dynamic,@webcomponents/webcomponentsjs,angular,aurelia-framework,aurelia-templating-binding,aurelia-templating-resources,aurelia-pal-browser,aurelia-event-aggregator,aurelia-history-browser,hyperapp,inferno,inferno-create-element,mithril,lit-element,solid-js,solid-js/dom,preact,riot,rxjs,vue,zone.js,react,react-dom,react-router,react-router-dom,history,tslib,path-to-regexp,@libre/atom,@dbeining/react-atom"
133358
133390
  },
133359
133391
  build: {
133360
- date: "2022-01-21T00:58:23.969Z",
133361
- cli: "0.14.8",
133392
+ date: "2022-02-04T13:38:21.948Z",
133393
+ cli: "0.14.9",
133362
133394
  compat: "0.14"
133363
133395
  },
133364
133396
  pilets: {
@@ -255435,4 +255467,4 @@ const app = React.createElement(piral_core_1.Piral, {
255435
255467
 
255436
255468
  /******/ })()
255437
255469
  ;
255438
- //# sourceMappingURL=index.fc1cf0.js.map
255470
+ //# sourceMappingURL=index.00ccd7.js.map